From 37034a7450f94a16e05283b4799c3774723b0586 Mon Sep 17 00:00:00 2001 From: Kane610 Date: Tue, 30 Jan 2018 23:42:24 +0100 Subject: [PATCH] Deconz use entity registry (#12067) * Support for entity registry * Not everything is a sensor... --- homeassistant/components/binary_sensor/deconz.py | 5 +++++ homeassistant/components/deconz/__init__.py | 4 ++-- homeassistant/components/light/deconz.py | 5 +++++ homeassistant/components/sensor/deconz.py | 10 ++++++++++ requirements_all.txt | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/binary_sensor/deconz.py b/homeassistant/components/binary_sensor/deconz.py index 3c02dfb3508..0d7c3e086bb 100644 --- a/homeassistant/components/binary_sensor/deconz.py +++ b/homeassistant/components/binary_sensor/deconz.py @@ -65,6 +65,11 @@ class DeconzBinarySensor(BinarySensorDevice): """Return the name of the sensor.""" return self._sensor.name + @property + def unique_id(self): + """Return a unique identifier for this sensor.""" + return self._sensor.uniqueid + @property def device_class(self): """Return the class of the sensor.""" diff --git a/homeassistant/components/deconz/__init__.py b/homeassistant/components/deconz/__init__.py index 269b8136020..9d7d253c328 100644 --- a/homeassistant/components/deconz/__init__.py +++ b/homeassistant/components/deconz/__init__.py @@ -17,7 +17,7 @@ from homeassistant.helpers import discovery from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.util.json import load_json, save_json -REQUIREMENTS = ['pydeconz==25'] +REQUIREMENTS = ['pydeconz==27'] _LOGGER = logging.getLogger(__name__) @@ -38,7 +38,7 @@ SERVICE_DATA = 'data' SERVICE_SCHEMA = vol.Schema({ vol.Required(SERVICE_FIELD): cv.string, - vol.Required(SERVICE_DATA): cv.string, + vol.Required(SERVICE_DATA): dict, }) CONFIG_INSTRUCTIONS = """ diff --git a/homeassistant/components/light/deconz.py b/homeassistant/components/light/deconz.py index 6b22190dce9..82df352e5af 100644 --- a/homeassistant/components/light/deconz.py +++ b/homeassistant/components/light/deconz.py @@ -100,6 +100,11 @@ class DeconzLight(Light): """Return the name of the light.""" return self._light.name + @property + def unique_id(self): + """Return a unique identifier for this light.""" + return self._light.uniqueid + @property def supported_features(self): """Flag supported features.""" diff --git a/homeassistant/components/sensor/deconz.py b/homeassistant/components/sensor/deconz.py index 7c2c1e0895f..b3adaa412ff 100644 --- a/homeassistant/components/sensor/deconz.py +++ b/homeassistant/components/sensor/deconz.py @@ -74,6 +74,11 @@ class DeconzSensor(Entity): """Return the name of the sensor.""" return self._sensor.name + @property + def unique_id(self): + """Return a unique identifier for this sensor.""" + return self._sensor.uniqueid + @property def device_class(self): """Return the class of the sensor.""" @@ -139,6 +144,11 @@ class DeconzBattery(Entity): """Return the name of the battery.""" return self._name + @property + def unique_id(self): + """Return a unique identifier for the device.""" + return self._device.uniqueid + @property def device_class(self): """Return the class of the sensor.""" diff --git a/requirements_all.txt b/requirements_all.txt index cf603ae1436..e91cbaf381f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -687,7 +687,7 @@ pycsspeechtts==1.0.2 pydaikin==0.4 # homeassistant.components.deconz -pydeconz==25 +pydeconz==27 # homeassistant.components.zwave pydispatcher==2.0.5