diff --git a/orchestrateur/main.py b/orchestrateur/main.py index 99708f0..26391e7 100644 --- a/orchestrateur/main.py +++ b/orchestrateur/main.py @@ -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: @@ -430,15 +429,14 @@ async def handle_telemetry_request(endpoint: str): connected_components=get_connected_components(), 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()