Deconz use entity registry (#12067)

* Support for entity registry

* Not everything is a sensor...
This commit is contained in:
Kane610 2018-01-30 23:42:24 +01:00 committed by Paulus Schoutsen
parent 990fbdf3ca
commit 37034a7450
5 changed files with 23 additions and 3 deletions

View File

@ -65,6 +65,11 @@ class DeconzBinarySensor(BinarySensorDevice):
"""Return the name of the sensor.""" """Return the name of the sensor."""
return self._sensor.name return self._sensor.name
@property
def unique_id(self):
"""Return a unique identifier for this sensor."""
return self._sensor.uniqueid
@property @property
def device_class(self): def device_class(self):
"""Return the class of the sensor.""" """Return the class of the sensor."""

View File

@ -17,7 +17,7 @@ from homeassistant.helpers import discovery
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.util.json import load_json, save_json from homeassistant.util.json import load_json, save_json
REQUIREMENTS = ['pydeconz==25'] REQUIREMENTS = ['pydeconz==27']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -38,7 +38,7 @@ SERVICE_DATA = 'data'
SERVICE_SCHEMA = vol.Schema({ SERVICE_SCHEMA = vol.Schema({
vol.Required(SERVICE_FIELD): cv.string, vol.Required(SERVICE_FIELD): cv.string,
vol.Required(SERVICE_DATA): cv.string, vol.Required(SERVICE_DATA): dict,
}) })
CONFIG_INSTRUCTIONS = """ CONFIG_INSTRUCTIONS = """

View File

@ -100,6 +100,11 @@ class DeconzLight(Light):
"""Return the name of the light.""" """Return the name of the light."""
return self._light.name return self._light.name
@property
def unique_id(self):
"""Return a unique identifier for this light."""
return self._light.uniqueid
@property @property
def supported_features(self): def supported_features(self):
"""Flag supported features.""" """Flag supported features."""

View File

@ -74,6 +74,11 @@ class DeconzSensor(Entity):
"""Return the name of the sensor.""" """Return the name of the sensor."""
return self._sensor.name return self._sensor.name
@property
def unique_id(self):
"""Return a unique identifier for this sensor."""
return self._sensor.uniqueid
@property @property
def device_class(self): def device_class(self):
"""Return the class of the sensor.""" """Return the class of the sensor."""
@ -139,6 +144,11 @@ class DeconzBattery(Entity):
"""Return the name of the battery.""" """Return the name of the battery."""
return self._name return self._name
@property
def unique_id(self):
"""Return a unique identifier for the device."""
return self._device.uniqueid
@property @property
def device_class(self): def device_class(self):
"""Return the class of the sensor.""" """Return the class of the sensor."""

View File

@ -687,7 +687,7 @@ pycsspeechtts==1.0.2
pydaikin==0.4 pydaikin==0.4
# homeassistant.components.deconz # homeassistant.components.deconz
pydeconz==25 pydeconz==27
# homeassistant.components.zwave # homeassistant.components.zwave
pydispatcher==2.0.5 pydispatcher==2.0.5