deCONZ - support for power plugs (#15752)
* Initial commit for deCONZ switch support * Fix hound comment * Fix martins comment; platforms shouldn't depend on another platform * Fix existing tests * New tests * Clean up unnecessary methods * Bump requirement to v43 * Added device state attributes to light
This commit is contained in:
1 parent
623f6c841b
commit
f8a478946e
9 files changed
+212
-10
No files matched your search
@@ -4,9 +4,9 @@ Support for deCONZ light.
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.deconz/
|
||||
"""
|
||||
from homeassistant.components.deconz import (
|
||||
DOMAIN as DATA_DECONZ, DATA_DECONZ_ID, DATA_DECONZ_UNSUB)
|
||||
from homeassistant.components.deconz.const import CONF_ALLOW_DECONZ_GROUPS
|
||||
from homeassistant.components.deconz.const import (
|
||||
CONF_ALLOW_DECONZ_GROUPS, DOMAIN as DATA_DECONZ,
|
||||
DATA_DECONZ_ID, DATA_DECONZ_UNSUB, SWITCH_TYPES)
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH, ATTR_HS_COLOR,
|
||||
ATTR_TRANSITION, EFFECT_COLORLOOP, FLASH_LONG, FLASH_SHORT,
|
||||
@@ -32,7 +32,8 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
|
||||
"""Add light from deCONZ."""
|
||||
entities = []
|
||||
for light in lights:
|
||||
entities.append(DeconzLight(light))
|
||||
if light.type not in SWITCH_TYPES:
|
||||
entities.append(DeconzLight(light))
|
||||
async_add_devices(entities, True)
|
||||
|
||||
hass.data[DATA_DECONZ_UNSUB].append(
|
||||
@@ -186,3 +187,12 @@ class DeconzLight(Light):
|
||||
del data['on']
|
||||
|
||||
await self._light.async_set_state(data)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the device state attributes."""
|
||||
attributes = {}
|
||||
attributes['is_deconz_group'] = self._light.type == 'LightGroup'
|
||||
if self._light.type == 'LightGroup':
|
||||
attributes['all_on'] = self._light.all_on
|
||||
return attributes
|
||||
Reference in new issue
Block a user