Hi All,
I’ve created an automation (and copied from a bunch of people) that I thought would be both elegant and scalable across a number of entities and states. However on restart it logs an error.
The error I get is
The automation “Auto Lights” (automation.auto_lights) has an unknown action: light.turn_unavailable.
I understand why I get the error - its because the the automation isn’t triggered yet and the “to_state.state” defaults to “unavailable”, which isn’t a valid action. I should mention the automation works perfectly well, it just clogs the log unnecessarily.
I’ve been reading a lot on the forum about an “availability”, and I think that might help to suppress the error but not sure of the syntax when it needs to refer to multiple entities.
I’d welcome any advice, my preference is to keep it as 1 automation
- id: "20260302_1815"
alias: "Auto Lights"
description: ""
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.son_xia_reed_lvl1_cupboard_opening_2
id: light.son_ikea_bulb_opal1_lvl1_cupboard_light
to: ~
- trigger: state
entity_id: binary_sensor.son_xia_reed_lvl0_cupboard_opening
id: light.son_ikea_bulb_ww_lvl0_cupboard
to: ~
condition: []
actions:
- action: light.turn_{{ trigger.to_state.state }}
target:
entity_id: "{{ trigger.id }}"