I have an automation that handles the on/off state of my lights. A motion sensor triggers the automation. Both when it detects motion, and when it stops detecting. Both triggers have a trigger ID.
There is nothing in the conditions section.
In the Actions section, there is a single action: Choose.
There are 2 options.
First is if the trigger ID is ‘turnOff’ with another condition.
The second is if the trigger ID is ‘turnOn’ with a bunch of conditions.
The turnOn “choose” option contains the conditions:
The trigger ID is ‘turnOn’
The lights are already off, and have been for 5 minutes
The light level in the room is below a threshold OR the light outside (via weather app templates) is dark enough.
And a few others.
Recently, the lights did not turn on, and I was confused as to why. I checked the trace. All it said was the turnOn trigger was activated, and the Default action was executed. Which means one of the conditions under turnOn failed to match. But the trace and logging and changed variables don’t tell me WHY. I need to see which condition failed, causing it to fail over to the Default, empty option.
This seems like it should be listed/in the trace/debug. Am I missing something? Is there a way to see the true/false checks of the conditions in the Choose action?
This is the entire automation:
alias: "Basement Lights: Auto On/Off"
description: ""
trigger:
- platform: state
entity_id: sensor.basement_occupied
to: Empty
for:
hours: 0
minutes: 5
seconds: 0
id: turnOff
- type: motion
platform: device
device_id: 126c49561f13282e7305a20d2f8ed147
entity_id: 22f1f3c3c696bf2eafd9aa82080b023c
domain: binary_sensor
id: turnOn
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: turnOn
- condition: device
type: is_off
device_id: d6affe5e17a37237f12b0446e5f1f977
entity_id: light.basement_lights
domain: light
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.dark_enough_outside
state: "on"
- condition: numeric_state
entity_id: sensor.basement_media_room_vms_light_level
below: "1600"
- condition: state
entity_id: sensor.basement_occupied
state: Empty
for:
hours: 0
minutes: 0
seconds: 0
- condition: state
entity_id: binary_sensor.eds_office_door_was_opened_recentlyy
state: "off"
sequence:
- type: turn_on
device_id: d6affe5e17a37237f12b0446e5f1f977
entity_id: light.basement_lights
domain: light
brightness_pct: 100
- delay:
hours: 0
minutes: 1
seconds: 30
milliseconds: 0
- condition: state
entity_id: sensor.basement_occupied
state: Empty
- type: turn_off
device_id: d6affe5e17a37237f12b0446e5f1f977
entity_id: light.basement_lights
domain: light
- conditions:
- condition: trigger
id: turnOff
- condition: device
type: is_on
device_id: d6affe5e17a37237f12b0446e5f1f977
entity_id: light.basement_lights
domain: light
sequence:
- type: turn_off
device_id: d6affe5e17a37237f12b0446e5f1f977
entity_id: light.basement_lights
domain: light
- service: notify.mobile_app_networkdevice
data:
message: Basement Lights Off (not occupied >= 5 min)
- conditions: []
sequence: []
default: []
mode: single