mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Fix deCONZ group state regression (#73907)
This commit is contained in:
parent
edb386c736
commit
b3b4707579
@ -287,7 +287,6 @@ async def get_deconz_session(
|
|||||||
config[CONF_HOST],
|
config[CONF_HOST],
|
||||||
config[CONF_PORT],
|
config[CONF_PORT],
|
||||||
config[CONF_API_KEY],
|
config[CONF_API_KEY],
|
||||||
legacy_add_device=False,
|
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
async with async_timeout.timeout(10):
|
async with async_timeout.timeout(10):
|
||||||
|
@ -105,7 +105,10 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_group(_: EventType, group_id: str) -> None:
|
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 (
|
if (
|
||||||
not gateway.option_allow_deconz_groups
|
not gateway.option_allow_deconz_groups
|
||||||
or (group := gateway.api.groups[group_id])
|
or (group := gateway.api.groups[group_id])
|
||||||
@ -113,6 +116,16 @@ async def async_setup_entry(
|
|||||||
):
|
):
|
||||||
return
|
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)])
|
async_add_entities([DeconzGroup(group, gateway)])
|
||||||
|
|
||||||
config_entry.async_on_unload(
|
config_entry.async_on_unload(
|
||||||
@ -289,6 +302,16 @@ class DeconzLight(DeconzBaseLight[Light]):
|
|||||||
"""Return the coldest color_temp that this light supports."""
|
"""Return the coldest color_temp that this light supports."""
|
||||||
return self._device.min_color_temp or super().min_mireds
|
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]):
|
class DeconzGroup(DeconzBaseLight[Group]):
|
||||||
"""Representation of a deCONZ group."""
|
"""Representation of a deCONZ group."""
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "deCONZ",
|
"name": "deCONZ",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/deconz",
|
"documentation": "https://www.home-assistant.io/integrations/deconz",
|
||||||
"requirements": ["pydeconz==94"],
|
"requirements": ["pydeconz==95"],
|
||||||
"ssdp": [
|
"ssdp": [
|
||||||
{
|
{
|
||||||
"manufacturer": "Royal Philips Electronics",
|
"manufacturer": "Royal Philips Electronics",
|
||||||
|
@ -1441,7 +1441,7 @@ pydaikin==2.7.0
|
|||||||
pydanfossair==0.1.0
|
pydanfossair==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.deconz
|
# homeassistant.components.deconz
|
||||||
pydeconz==94
|
pydeconz==95
|
||||||
|
|
||||||
# homeassistant.components.delijn
|
# homeassistant.components.delijn
|
||||||
pydelijn==1.0.0
|
pydelijn==1.0.0
|
||||||
|
@ -968,7 +968,7 @@ pycoolmasternet-async==0.1.2
|
|||||||
pydaikin==2.7.0
|
pydaikin==2.7.0
|
||||||
|
|
||||||
# homeassistant.components.deconz
|
# homeassistant.components.deconz
|
||||||
pydeconz==94
|
pydeconz==95
|
||||||
|
|
||||||
# homeassistant.components.dexcom
|
# homeassistant.components.dexcom
|
||||||
pydexcom==0.2.3
|
pydexcom==0.2.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user