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:
parent
7e7f9bc6ac
commit
0009be595c
40 changed files with 538 additions and 331 deletions
|
@ -63,7 +63,7 @@ class KNXSwitch(SwitchDevice):
|
|||
|
||||
def __init__(self, hass, device):
|
||||
"""Initialize of KNX switch."""
|
||||
self.device = device
|
||||
self._device = device
|
||||
self.hass = hass
|
||||
self.async_register_callbacks()
|
||||
|
||||
|
@ -73,12 +73,12 @@ class KNXSwitch(SwitchDevice):
|
|||
async def after_update_callback(device):
|
||||
"""Call after device was updated."""
|
||||
await self.async_update_ha_state()
|
||||
self.device.register_device_updated_cb(after_update_callback)
|
||||
self._device.register_device_updated_cb(after_update_callback)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the KNX device."""
|
||||
return self.device.name
|
||||
return self._device.name
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
|
@ -93,12 +93,12 @@ class KNXSwitch(SwitchDevice):
|
|||
@property
|
||||
def is_on(self):
|
||||
"""Return true if device is on."""
|
||||
return self.device.state
|
||||
return self._device.state
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
"""Turn the device on."""
|
||||
await self.device.set_on()
|
||||
await self._device.set_on()
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
"""Turn the device off."""
|
||||
await self.device.set_off()
|
||||
await self._device.set_off()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue