Fix deCONZ group state regression (#73907)
This commit is contained in:
parent
edb386c736
commit
b3b4707579
5 changed files with 27 additions and 5 deletions
|
@ -287,7 +287,6 @@ async def get_deconz_session(
|
|||
config[CONF_HOST],
|
||||
config[CONF_PORT],
|
||||
config[CONF_API_KEY],
|
||||
legacy_add_device=False,
|
||||
)
|
||||
try:
|
||||
async with async_timeout.timeout(10):
|
||||
|
|
|
@ -105,7 +105,10 @@ async def async_setup_entry(
|
|||
|
||||
@callback
|
||||
def async_add_group(_: EventType, group_id: str) -> None:
|
||||
"""Add group from deCONZ."""
|
||||
"""Add group from deCONZ.
|
||||
|
||||
Update group states based on its sum of related lights.
|
||||
"""
|
||||
if (
|
||||
not gateway.option_allow_deconz_groups
|
||||
or (group := gateway.api.groups[group_id])
|
||||
|
@ -113,6 +116,16 @@ async def async_setup_entry(
|
|||
):
|
||||
return
|
||||
|
||||
first = True
|
||||
for light_id in group.lights:
|
||||
if (
|
||||
(light := gateway.api.lights.lights.get(light_id))
|
||||
and light.ZHATYPE == Light.ZHATYPE
|
||||
and light.reachable
|
||||
):
|
||||
group.update_color_state(light, update_all_attributes=first)
|
||||
first = False
|
||||
|
||||
async_add_entities([DeconzGroup(group, gateway)])
|
||||
|
||||
config_entry.async_on_unload(
|
||||
|
@ -289,6 +302,16 @@ class DeconzLight(DeconzBaseLight[Light]):
|
|||
"""Return the coldest color_temp that this light supports."""
|
||||
return self._device.min_color_temp or super().min_mireds
|
||||
|
||||
@callback
|
||||
def async_update_callback(self) -> None:
|
||||
"""Light state will also reflect in relevant groups."""
|
||||
super().async_update_callback()
|
||||
|
||||
if self._device.reachable and "attr" not in self._device.changed_keys:
|
||||
for group in self.gateway.api.groups.values():
|
||||
if self._device.resource_id in group.lights:
|
||||
group.update_color_state(self._device)
|
||||
|
||||
|
||||
class DeconzGroup(DeconzBaseLight[Group]):
|
||||
"""Representation of a deCONZ group."""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "deCONZ",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/deconz",
|
||||
"requirements": ["pydeconz==94"],
|
||||
"requirements": ["pydeconz==95"],
|
||||
"ssdp": [
|
||||
{
|
||||
"manufacturer": "Royal Philips Electronics",
|
||||
|
|
|
@ -1441,7 +1441,7 @@ pydaikin==2.7.0
|
|||
pydanfossair==0.1.0
|
||||
|
||||
# homeassistant.components.deconz
|
||||
pydeconz==94
|
||||
pydeconz==95
|
||||
|
||||
# homeassistant.components.delijn
|
||||
pydelijn==1.0.0
|
||||
|
|
|
@ -968,7 +968,7 @@ pycoolmasternet-async==0.1.2
|
|||
pydaikin==2.7.0
|
||||
|
||||
# homeassistant.components.deconz
|
||||
pydeconz==94
|
||||
pydeconz==95
|
||||
|
||||
# homeassistant.components.dexcom
|
||||
pydexcom==0.2.3
|
||||
|
|
Loading…
Add table
Reference in a new issue