Fix global
Build, push image, and notify Watchtower / build-image (push) Successful in 42s
Build, push image, and notify Watchtower / notify (push) Successful in 14s

This commit is contained in:
2026-08-23 20:04:26 +02:00
parent 5c60de3f03
commit 204f271fc2
+6 -3
View File
@@ -205,7 +205,7 @@ def cooking_state_temperature_provider():
return (0.0, 0.0)
def cooking_state_on_state_change(state):
global cooking_start_time
global cooking_start_time, uart_device
print(f"[CookingState] State changed to: {state.state}")
if state.paused or state.state in (cookingState.CookingStates.DONE, cookingState.CookingStates.IDLE, cookingState.CookingStates.ALERT):
@@ -214,7 +214,7 @@ def cooking_state_on_state_change(state):
magnetron_led.on()
# Send state updates to WiFi board and Orchestrator
if uart_device:
if uart_device != None:
uart_device.send_as_command(UARTCommand(UARTCommandType.COOKING_STATE_UPDATE, {"state": state.state}))
# Send LoRa update with start time and remaining time if beginning cooking process
@@ -347,6 +347,8 @@ async def lora_process_task():
alert.timestamp = data.get("timestamp", time.time())
alert_manager.add_alert(alert)
microwave_state = MicrowaveState.ALERT
if cooking_state is not None:
cooking_state.set_state(cookingState.CookingStates.ALERT)
elif action == LoraCommands.MICROVAVE_STATE_UPDATE:
new_state = data.get("new_microwave_state")
@@ -356,7 +358,8 @@ async def lora_process_task():
if new_state not in (MicrowaveState.ALERT): # Not alert so we can show the error
update_screen()
if new_state == MicrowaveState.IDLE:
cooking_state = None
if cooking_state is not None:
cooking_state.set_state(cookingState.CookingStates.IDLE)
await asyncio.sleep_ms(20)
await asyncio.sleep_ms(100)