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
|
@ -49,14 +49,14 @@ class JuicenetSensorDevice(JuicenetDevice, Entity):
|
|||
@property
|
||||
def name(self):
|
||||
"""Return the name of the device."""
|
||||
return '{} {}'.format(self.device.name(), self._name)
|
||||
return '{} {}'.format(self._device.name(), self._name)
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon of the sensor."""
|
||||
icon = None
|
||||
if self.type == 'status':
|
||||
status = self.device.getStatus()
|
||||
status = self._device.getStatus()
|
||||
if status == 'standby':
|
||||
icon = 'mdi:power-plug-off'
|
||||
elif status == 'plugged':
|
||||
|
@ -87,19 +87,19 @@ class JuicenetSensorDevice(JuicenetDevice, Entity):
|
|||
"""Return the state."""
|
||||
state = None
|
||||
if self.type == 'status':
|
||||
state = self.device.getStatus()
|
||||
state = self._device.getStatus()
|
||||
elif self.type == 'temperature':
|
||||
state = self.device.getTemperature()
|
||||
state = self._device.getTemperature()
|
||||
elif self.type == 'voltage':
|
||||
state = self.device.getVoltage()
|
||||
state = self._device.getVoltage()
|
||||
elif self.type == 'amps':
|
||||
state = self.device.getAmps()
|
||||
state = self._device.getAmps()
|
||||
elif self.type == 'watts':
|
||||
state = self.device.getWatts()
|
||||
state = self._device.getWatts()
|
||||
elif self.type == 'charge_time':
|
||||
state = self.device.getChargeTime()
|
||||
state = self._device.getChargeTime()
|
||||
elif self.type == 'energy_added':
|
||||
state = self.device.getEnergyAdded()
|
||||
state = self._device.getEnergyAdded()
|
||||
else:
|
||||
state = 'Unknown'
|
||||
return state
|
||||
|
@ -109,7 +109,7 @@ class JuicenetSensorDevice(JuicenetDevice, Entity):
|
|||
"""Return the state attributes."""
|
||||
attributes = {}
|
||||
if self.type == 'status':
|
||||
man_dev_id = self.device.id()
|
||||
man_dev_id = self._device.id()
|
||||
if man_dev_id:
|
||||
attributes["manufacturer_device_id"] = man_dev_id
|
||||
return attributes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue