Device Registry (#15980)

* First draft

* Generate device id

* No obscure registry

* Dont store config_entry_id in device

* Storage

* Small mistake on rebase

* Do storage more like entity registry

* Improve device identification

* Add tests

* Remove deconz device support from PR

* Fix hound comments, voff!

* Fix comments and clean up

* Fix proper indentation

* Fix pydoc issues

* Fix mochad component to not use self.device

* Fix mochad light platform to not use self.device

* Fix TankUtilitySensor to not use self.device

* Fix Soundtouch to not use self.device

* Fix Plex to not use self.device

* Fix Emby to not use self.device

* Fix Heatmiser to not use self.device

* Fix Wemo lights to not use self.device

* Fix Lifx to not use self.device

* Fix Radiotherm to not use self.device

* Fix Juicenet to not use self.device

* Fix Qwikswitch to not use self.device

* Fix Xiaomi miio to not use self.device

* Fix Nest to not use self.device

* Fix Tellduslive to not use self.device

* Fix Knx to not use self.device

* Clean up a small mistake in soundtouch

* Fix comment from Ballob

* Fix bad indentation

* Fix indentatin

* Lint

* Remove unused variable

* Lint
This commit is contained in:
Robert Svensson 2018-08-22 10:46:37 +02:00 committed by Paulus Schoutsen
parent 7e7f9bc6ac
commit 0009be595c
40 changed files with 538 additions and 331 deletions

View file

@ -46,29 +46,29 @@ class JuicenetDevice(Entity):
def __init__(self, device, sensor_type, hass):
"""Initialise the sensor."""
self.hass = hass
self.device = device
self._device = device
self.type = sensor_type
@property
def name(self):
"""Return the name of the device."""
return self.device.name()
return self._device.name()
def update(self):
"""Update state of the device."""
self.device.update_state()
self._device.update_state()
@property
def _manufacturer_device_id(self):
"""Return the manufacturer device id."""
return self.device.id()
return self._device.id()
@property
def _token(self):
"""Return the device API token."""
return self.device.token()
return self._device.token()
@property
def unique_id(self):
"""Return a unique ID."""
return "{}-{}".format(self.device.id(), self.type)
return "{}-{}".format(self._device.id(), self.type)