From 1842e5909e44a225db55ac745d2fb76b798846a6 Mon Sep 17 00:00:00 2001 From: Stefan Jonasson Date: Sun, 24 Jan 2016 09:57:40 +0100 Subject: [PATCH] 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) --- homeassistant/components/light/zwave.py | 5 +++-- homeassistant/components/sensor/zwave.py | 2 +- homeassistant/components/switch/zwave.py | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/light/zwave.py b/homeassistant/components/light/zwave.py index 02664ed896c..0dac1f37b37 100644 --- a/homeassistant/components/light/zwave.py +++ b/homeassistant/components/light/zwave.py @@ -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): diff --git a/homeassistant/components/sensor/zwave.py b/homeassistant/components/sensor/zwave.py index 869f4dbe810..f1d3e00e69f 100644 --- a/homeassistant/components/sensor/zwave.py +++ b/homeassistant/components/sensor/zwave.py @@ -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): diff --git a/homeassistant/components/switch/zwave.py b/homeassistant/components/switch/zwave.py index f4777340445..ab5c0bcd9f0 100644 --- a/homeassistant/components/switch/zwave.py +++ b/homeassistant/components/switch/zwave.py @@ -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):