From 15055b8e8e858762f4e5225c19c335eddebfc67b Mon Sep 17 00:00:00 2001 From: Andre Lengwenus Date: Sat, 13 Dec 2025 11:12:20 +0100 Subject: [PATCH] Fix race condition in LCN climate and cover entites (#158894) --- homeassistant/components/lcn/climate.py | 9 ++++----- homeassistant/components/lcn/cover.py | 11 +++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/lcn/climate.py b/homeassistant/components/lcn/climate.py index 0874d916684..a2b867d057a 100644 --- a/homeassistant/components/lcn/climate.py +++ b/homeassistant/components/lcn/climate.py @@ -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: diff --git a/homeassistant/components/lcn/cover.py b/homeassistant/components/lcn/cover.py index 7df79ef02b1..eabda852d1a 100644 --- a/homeassistant/components/lcn/cover.py +++ b/homeassistant/components/lcn/cover.py @@ -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."""