Skip to content

Commit 15055b8

Browse files
authored
Fix race condition in LCN climate and cover entites (home-assistant#158894)
1 parent 6826619 commit 15055b8

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

homeassistant/components/lcn/climate.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Support for LCN climate control."""
22

3-
import asyncio
43
from collections.abc import Iterable
54
from datetime import timedelta
65
from functools import partial
@@ -172,14 +171,14 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
172171
async def async_update(self) -> None:
173172
"""Update the state of the entity."""
174173
self._attr_available = any(
175-
await asyncio.gather(
176-
self.device_connection.request_status_variable(
174+
[
175+
await self.device_connection.request_status_variable(
177176
self.variable, SCAN_INTERVAL.seconds
178177
),
179-
self.device_connection.request_status_variable(
178+
await self.device_connection.request_status_variable(
180179
self.setpoint, SCAN_INTERVAL.seconds
181180
),
182-
)
181+
]
183182
)
184183

185184
def input_received(self, input_obj: InputType) -> None:

homeassistant/components/lcn/cover.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Support for LCN covers."""
22

3-
import asyncio
43
from collections.abc import Coroutine, Iterable
54
from datetime import timedelta
65
from functools import partial
@@ -134,14 +133,14 @@ async def async_update(self) -> None:
134133
"""Update the state of the entity."""
135134
if not self.device_connection.is_group:
136135
self._attr_available = any(
137-
await asyncio.gather(
138-
self.device_connection.request_status_output(
136+
[
137+
await self.device_connection.request_status_output(
139138
pypck.lcn_defs.OutputPort["OUTPUTUP"], SCAN_INTERVAL.seconds
140139
),
141-
self.device_connection.request_status_output(
140+
await self.device_connection.request_status_output(
142141
pypck.lcn_defs.OutputPort["OUTPUTDOWN"], SCAN_INTERVAL.seconds
143142
),
144-
)
143+
]
145144
)
146145

147146
def input_received(self, input_obj: InputType) -> None:
@@ -274,7 +273,7 @@ async def async_update(self) -> None:
274273
self.motor, self.positioning_mode, SCAN_INTERVAL.seconds
275274
)
276275
)
277-
self._attr_available = any(await asyncio.gather(*coros))
276+
self._attr_available = any([await coro for coro in coros])
278277

279278
def input_received(self, input_obj: InputType) -> None:
280279
"""Set cover states when LCN input object (command) is received."""

0 commit comments

Comments
 (0)