DEBUG led somtimes don't update
This commit is contained in:
@@ -80,20 +80,27 @@ def on_cooking_state_change(state):
|
|||||||
"""Callback executed whenever local cooking state transitions."""
|
"""Callback executed whenever local cooking state transitions."""
|
||||||
BLINK_INTERVAL_MS = 500
|
BLINK_INTERVAL_MS = 500
|
||||||
|
|
||||||
|
log(f"[CookingState] State changed to: {state.state}")
|
||||||
|
|
||||||
if status_led and cookingState:
|
if status_led and cookingState:
|
||||||
if state.state == cookingState.CookingStates.IDLE:
|
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.color = status_led.OFF
|
||||||
status_led.blink_off()
|
status_led.blink_off()
|
||||||
elif state.state == cookingState.CookingStates.COOKING:
|
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.color = status_led.YELLOW
|
||||||
status_led.blink_off()
|
status_led.blink_off()
|
||||||
elif state.state == cookingState.CookingStates.STIRRING_REQUIRED:
|
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.color = status_led.ORANGE
|
||||||
status_led.blink_on(BLINK_INTERVAL_MS)
|
status_led.blink_on(BLINK_INTERVAL_MS)
|
||||||
elif state.state == cookingState.CookingStates.ALERT:
|
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.color = status_led.RED
|
||||||
status_led.blink_on(BLINK_INTERVAL_MS)
|
status_led.blink_on(BLINK_INTERVAL_MS)
|
||||||
elif state.state == cookingState.CookingStates.DONE:
|
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.color = status_led.GREEN
|
||||||
status_led.blink_off()
|
status_led.blink_off()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user