Deconz make groups configurable (#14704)
* Make groups configurable * Config flow and tests in place * Fix too long line
This commit is contained in:
parent
940577e105
commit
ac13a2736b
7 changed files with 46 additions and 12 deletions
|
@ -6,6 +6,7 @@ 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.light import (
|
||||
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH, ATTR_HS_COLOR,
|
||||
ATTR_TRANSITION, EFFECT_COLORLOOP, FLASH_LONG, FLASH_SHORT,
|
||||
|
@ -33,6 +34,7 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
|
|||
for light in lights:
|
||||
entities.append(DeconzLight(light))
|
||||
async_add_devices(entities, True)
|
||||
|
||||
hass.data[DATA_DECONZ_UNSUB].append(
|
||||
async_dispatcher_connect(hass, 'deconz_new_light', async_add_light))
|
||||
|
||||
|
@ -40,10 +42,12 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
|
|||
def async_add_group(groups):
|
||||
"""Add group from deCONZ."""
|
||||
entities = []
|
||||
allow_group = config_entry.data.get(CONF_ALLOW_DECONZ_GROUPS, True)
|
||||
for group in groups:
|
||||
if group.lights:
|
||||
if group.lights and allow_group:
|
||||
entities.append(DeconzLight(group))
|
||||
async_add_devices(entities, True)
|
||||
|
||||
hass.data[DATA_DECONZ_UNSUB].append(
|
||||
async_dispatcher_connect(hass, 'deconz_new_group', async_add_group))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue