Updated the entity names for all z-wave devices.

Z-Wave have a unique node id, this is now added to the entity name.

This is a change will break old configs.  The Z-Wave entity_id will have to be updated in configurations.

The reason for this change is that the old behavior created duplicate entity_ids if you have several similar devices. The order devices is included is not consistent so when the service was restarted the entity ids could change and the configuration for entities will be invalid.

There was also inconsistencies between the naming for sensors and switches.
(cherry picked from commit 33a78df)
This commit is contained in:
Stefan Jonasson 2016-01-24 09:57:40 +01:00
parent e541b9ba77
commit 1842e5909e
3 changed files with 7 additions and 5 deletions

View File

@ -94,9 +94,10 @@ class ZwaveDimmer(Light):
@property
def name(self):
""" Returns the name of the device if any. """
name = self._node.name or "{}".format(self._node.product_name)
name = self._node.name or "{} {}".format(
self._node.manufacturer_name, self._node.product_name)
return "{}".format(name or self._value.label)
return "{} {} {}".format(name, self._node.node_id, self._value.label)
@property
def brightness(self):

View File

@ -107,7 +107,7 @@ class ZWaveSensor(Entity):
name = self._node.name or "{} {}".format(
self._node.manufacturer_name, self._node.product_name)
return "{} {}".format(name, self._value.label)
return "{} {} {}".format(name, self._node.node_id, self._value.label)
@property
def state(self):

View File

@ -58,9 +58,10 @@ class ZwaveSwitch(SwitchDevice):
@property
def name(self):
""" Returns the name of the device if any. """
name = self._node.name or "{}".format(self._node.product_name)
name = self._node.name or "{} {}".format(
self._node.manufacturer_name, self._node.product_name)
return "{}".format(name or self._value.label)
return "{} {} {}".format(name, self._node.node_id, self._value.label)
@property
def is_on(self):