Skip to content

Commit bed87b3

Browse files
committed
Always create tasks for asyncio.wait()
Python 3.11 will not wait for coroutines but requires explicit tasks.
1 parent 75cf7c1 commit bed87b3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

aiolifx_effects/aiolifx_effects.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ async def start(self, effect, participants):
100100
response = await AwaitAioLIFX().wait(device.get_version)
101101
device.product = response.product
102102
if not self.running.get(device.mac_addr):
103-
tasks.append(AwaitAioLIFX().wait(device.get_color))
103+
tasks.append(asyncio.create_task(AwaitAioLIFX().wait(device.get_color)))
104104
if device.color_zones:
105105
if has_extended_multizone(device):
106-
tasks.append(AwaitAioLIFX().wait(device.get_extended_color_zones))
106+
tasks.append(asyncio.create_task(AwaitAioLIFX().wait(device.get_extended_color_zones)))
107107
else:
108108
for zone in range(0, len(device.color_zones), 8):
109-
tasks.append(AwaitAioLIFX().wait(partial(device.get_color_zones, start_index=zone)))
109+
tasks.append(asyncio.create_task(AwaitAioLIFX().wait(partial(device.get_color_zones, start_index=zone))))
110110
if tasks:
111111
await asyncio.wait(tasks)
112112

@@ -177,7 +177,7 @@ async def _fixup_multizone(self, participants):
177177
async def powertoggle(state):
178178
tasks = []
179179
for device in fixup:
180-
tasks.append(AwaitAioLIFX().wait(partial(device.set_power, state)))
180+
tasks.append(asyncio.create_task(AwaitAioLIFX().wait(partial(device.set_power, state))))
181181
await asyncio.wait(tasks)
182182
await asyncio.sleep(0.3)
183183

@@ -188,7 +188,7 @@ async def powertoggle(state):
188188
tasks = []
189189
for device in fixup:
190190
for zone in range(0, len(device.color_zones), 8):
191-
tasks.append(AwaitAioLIFX().wait(partial(device.get_color_zones, start_index=zone)))
191+
tasks.append(asyncio.create_task(AwaitAioLIFX().wait(partial(device.get_color_zones, start_index=zone))))
192192
await asyncio.wait(tasks)
193193

194194
# Update pre_state colors

0 commit comments

Comments
 (0)