Refactored some logs

This commit is contained in:
2026-08-10 14:33:24 +02:00
parent a6704c3578
commit d4cef30b8f
+2 -4
View File
@@ -351,7 +351,6 @@ async def process_messages_task():
print(f"[LoRa] Microwave {mw_id} state changed to: {n_state}")
if n_state in (CookingStates.DONE, CookingStates.STIRRING_REQUIRED, CookingStates.ALERT):
print("buzzer alert triggered!")
beats = 5 if n_state == CookingStates.ALERT else (1 if n_state == CookingStates.STIRRING_REQUIRED else 3)
buzzer.buzzer_siren(beatsNb=beats)
if n_state == CookingStates.IDLE and microwave_states.get(mw_id) == MicrowaveState.COOKING:
@@ -431,14 +430,13 @@ async def handle_telemetry_request(endpoint: str):
logs=logs_list
)
print(f"[Telemetry] Sending payload with {len(logs_list)} log entries...")
# 4. Wait for he microwave turn to send the telemetry data to the cloud endpoint
timeout = int(DEVICE_ID.split("_")[-1]) * config.TELEMETRY_SEND_INTERVAL
print(f"[Telemetry] Waiting for {timeout}s before sending telemetry to avoid collisions...")
await asyncio.sleep(timeout)
# 5. Offload blocking HTTP POST to thread pool
print(f"[Telemetry] Sending payload with {len(logs_list)} log entries...")
response = await asyncio.to_thread(
requests.post,
endpoint,
@@ -521,7 +519,7 @@ async def monitor_dish_height_task():
# --- BOOTSTRAP ---
async def main():
global async_event_queue
print("🚀 Orchestrateur Asyncio prêt. Lancement des tâches...")
print("Orchestrateur prêt. Lancement des tâches...")
# Initialize SQLite database table
init_db()