DEBUG led somtimes don't update

This commit is contained in:
2026-08-06 15:19:30 +02:00
parent e2beef511c
commit 11357b9a0e
+7
View File
@@ -80,20 +80,27 @@ def on_cooking_state_change(state):
"""Callback executed whenever local cooking state transitions."""
BLINK_INTERVAL_MS = 500
log(f"[CookingState] State changed to: {state.state}")
if status_led and cookingState:
if state.state == cookingState.CookingStates.IDLE:
log(f"[CookingState] State changed to IDLE. Turning LED off and stopping blink.")
status_led.color = status_led.OFF
status_led.blink_off()
elif state.state == cookingState.CookingStates.COOKING:
log(f"[CookingState] State changed to COOKING. Turning LED yellow and stopping blink.")
status_led.color = status_led.YELLOW
status_led.blink_off()
elif state.state == cookingState.CookingStates.STIRRING_REQUIRED:
log(f"[CookingState] State changed to STIRRING_REQUIRED. Turning LED orange and starting blink.")
status_led.color = status_led.ORANGE
status_led.blink_on(BLINK_INTERVAL_MS)
elif state.state == cookingState.CookingStates.ALERT:
log(f"[CookingState] State changed to ALERT. Turning LED red and starting blink.")
status_led.color = status_led.RED
status_led.blink_on(BLINK_INTERVAL_MS)
elif state.state == cookingState.CookingStates.DONE:
log(f"[CookingState] State changed to DONE. Turning LED green and stopping blink.")
status_led.color = status_led.GREEN
status_led.blink_off()