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

@@ -140,15 +140,15 @@ class NestBasicSensor(NestSensorDevice):
self._unit = SENSOR_UNITS.get(self.variable)
if self.variable in VARIABLE_NAME_MAPPING:
self._state = getattr(self.device,
self._state = getattr(self._device,
VARIABLE_NAME_MAPPING[self.variable])
elif self.variable in PROTECT_SENSOR_TYPES \
and self.variable != 'color_status':
# keep backward compatibility
state = getattr(self.device, self.variable)
state = getattr(self._device, self.variable)
self._state = state.capitalize() if state is not None else None
else:
self._state = getattr(self.device, self.variable)
self._state = getattr(self._device, self.variable)
class NestTempSensor(NestSensorDevice):
@@ -166,12 +166,12 @@ class NestTempSensor(NestSensorDevice):
def update(self):
"""Retrieve latest state."""
if self.device.temperature_scale == 'C':
if self._device.temperature_scale == 'C':
self._unit = TEMP_CELSIUS
else:
self._unit = TEMP_FAHRENHEIT
temp = getattr(self.device, self.variable)
temp = getattr(self._device, self.variable)
if temp is None:
self._state = None