parent
0f90426023
commit
123f4acfc1
2 changed files with 7 additions and 7 deletions
|
@ -52,7 +52,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
node = zwave.NETWORK.nodes[discovery_info[zwave.const.ATTR_NODE_ID]]
|
node = zwave.NETWORK.nodes[discovery_info[zwave.const.ATTR_NODE_ID]]
|
||||||
value = node.values[discovery_info[zwave.const.ATTR_VALUE_ID]]
|
value = node.values[discovery_info[zwave.const.ATTR_VALUE_ID]]
|
||||||
customize = hass.data['zwave_customize']
|
customize = hass.data['zwave_customize']
|
||||||
name = super().entity_id
|
name = '{}.{}'.format(DOMAIN, zwave.object_id(value))
|
||||||
node_config = customize.get(name, {})
|
node_config = customize.get(name, {})
|
||||||
refresh = node_config.get(zwave.CONF_REFRESH_VALUE)
|
refresh = node_config.get(zwave.CONF_REFRESH_VALUE)
|
||||||
delay = node_config.get(zwave.CONF_REFRESH_DELAY)
|
delay = node_config.get(zwave.CONF_REFRESH_DELAY)
|
||||||
|
|
|
@ -193,19 +193,19 @@ def _node_object_id(node):
|
||||||
return node_object_id
|
return node_object_id
|
||||||
|
|
||||||
|
|
||||||
def _object_id(value):
|
def object_id(value):
|
||||||
"""Return the object_id of the device value.
|
"""Return the object_id of the device value.
|
||||||
|
|
||||||
The object_id contains node_id and value instance id
|
The object_id contains node_id and value instance id
|
||||||
to not collide with other entity_ids.
|
to not collide with other entity_ids.
|
||||||
"""
|
"""
|
||||||
object_id = "{}_{}_{}".format(slugify(_value_name(value)),
|
_object_id = "{}_{}_{}".format(slugify(_value_name(value)),
|
||||||
value.node.node_id, value.index)
|
value.node.node_id, value.index)
|
||||||
|
|
||||||
# Add the instance id if there is more than one instance for the value
|
# Add the instance id if there is more than one instance for the value
|
||||||
if value.instance > 1:
|
if value.instance > 1:
|
||||||
return '{}_{}'.format(object_id, value.instance)
|
return '{}_{}'.format(object_id, value.instance)
|
||||||
return object_id
|
return _object_id
|
||||||
|
|
||||||
|
|
||||||
def nice_print_node(node):
|
def nice_print_node(node):
|
||||||
|
@ -341,7 +341,7 @@ def setup(hass, config):
|
||||||
node.generic, node.specific,
|
node.generic, node.specific,
|
||||||
value.command_class, value.type,
|
value.command_class, value.type,
|
||||||
value.genre)
|
value.genre)
|
||||||
name = "{}.{}".format(component, _object_id(value))
|
name = "{}.{}".format(component, object_id(value))
|
||||||
|
|
||||||
node_config = customize.get(name, {})
|
node_config = customize.get(name, {})
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ class ZWaveDeviceEntity:
|
||||||
The object_id contains node_id and value instance id to not collide
|
The object_id contains node_id and value instance id to not collide
|
||||||
with other entity_ids.
|
with other entity_ids.
|
||||||
"""
|
"""
|
||||||
return _object_id(self._value)
|
return object_id(self._value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue