Fix presence_mode_reset blueprint variable scoping issue

Move condition check into action sequence after variables are defined.
Previously, the condition tried to use 'occupancy_sensors' before it was
defined, causing UndefinedError during automation execution.
This commit is contained in:
2025-12-21 15:35:23 -08:00
parent a5a6b9d4b6
commit 4b285770d2

View File

@@ -78,7 +78,13 @@ trigger:
for:
minutes: !input empty_delay
condition:
action:
- variables:
occupancy_sensors: !input occupancy_sensors
al_switch: !input adaptive_lighting_switch
mode_select: !input mode_input_select
default_mode: !input default_mode
# Ensure ALL sensors are off (room is truly empty)
- condition: template
value_template: >-
@@ -88,13 +94,6 @@ condition:
list | count == 0
}}
action:
- variables:
occupancy_sensors: !input occupancy_sensors
al_switch: !input adaptive_lighting_switch
mode_select: !input mode_input_select
default_mode: !input default_mode
# Reset manual control if AL switch provided
- if:
- condition: template