Fix race condition in LCN climate and cover entites (#158894)

This commit is contained in:
Andre Lengwenus
2025-12-13 11:12:20 +01:00
committed by GitHub
parent 6826619e12
commit 15055b8e8e
2 changed files with 9 additions and 11 deletions

View File

@@ -1,6 +1,5 @@
"""Support for LCN climate control."""
import asyncio
from collections.abc import Iterable
from datetime import timedelta
from functools import partial
@@ -172,14 +171,14 @@ class LcnClimate(LcnEntity, ClimateEntity):
async def async_update(self) -> None:
"""Update the state of the entity."""
self._attr_available = any(
await asyncio.gather(
self.device_connection.request_status_variable(
[
await self.device_connection.request_status_variable(
self.variable, SCAN_INTERVAL.seconds
),
self.device_connection.request_status_variable(
await self.device_connection.request_status_variable(
self.setpoint, SCAN_INTERVAL.seconds
),
)
]
)
def input_received(self, input_obj: InputType) -> None:

View File

@@ -1,6 +1,5 @@
"""Support for LCN covers."""
import asyncio
from collections.abc import Coroutine, Iterable
from datetime import timedelta
from functools import partial
@@ -134,14 +133,14 @@ class LcnOutputsCover(LcnEntity, CoverEntity):
"""Update the state of the entity."""
if not self.device_connection.is_group:
self._attr_available = any(
await asyncio.gather(
self.device_connection.request_status_output(
[
await self.device_connection.request_status_output(
pypck.lcn_defs.OutputPort["OUTPUTUP"], SCAN_INTERVAL.seconds
),
self.device_connection.request_status_output(
await self.device_connection.request_status_output(
pypck.lcn_defs.OutputPort["OUTPUTDOWN"], SCAN_INTERVAL.seconds
),
)
]
)
def input_received(self, input_obj: InputType) -> None:
@@ -274,7 +273,7 @@ class LcnRelayCover(LcnEntity, CoverEntity):
self.motor, self.positioning_mode, SCAN_INTERVAL.seconds
)
)
self._attr_available = any(await asyncio.gather(*coros))
self._attr_available = any([await coro for coro in coros])
def input_received(self, input_obj: InputType) -> None:
"""Set cover states when LCN input object (command) is received."""