Fix imports for micropython

This commit is contained in:
2026-08-23 12:50:50 +02:00
parent c860afc609
commit 178457e199
+7 -3
View File
@@ -1,6 +1,10 @@
import time
import asyncio
import inspect
try:
import asyncio
import inspect
ASYNCIO = True
except ImportError:
ASYNCIO = False
class AlertManager:
def __init__(self):
@@ -12,7 +16,7 @@ class AlertManager:
def call_on_alert_callback(self, alert):
if self.on_alert_callback:
if inspect.iscoroutinefunction(self.on_alert_callback):
if ASYNCIO and inspect.iscoroutinefunction(self.on_alert_callback):
# Schedule coroutine on the running loop without blocking
try:
loop = asyncio.get_running_loop()