I have an automation that stopped working, so I created a new one, guess what, that automation doesn’t work either.
It is a simple turn on light when door opens and the other way around.
I’ve checked the door sensor, works fine.
I’ve checked the lamp, works fine.
I’ve checked the switch, works fine.
But it won’t work:
alias: "Laundry: 🧺 Toggle Light II"
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.sensor_door_laundry_room_contact
to:
- "on"
id: Open Laundry
- trigger: state
entity_id:
- binary_sensor.sensor_door_laundry_room_contact
to:
- "off"
id: Close Laundry
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- Open Laundry
sequence:
- action: switch.turn_on
metadata: {}
target:
entity_id: switch.laundry_light_power
data: {}
- conditions:
- condition: trigger
id:
- Close Laundry
sequence:
- action: switch.turn_off
metadata: {}
target:
entity_id: switch.laundry_light_power
data: {}
mode: single
I just finished testing an automation that uses spaces in its Trigger ID and it worked (so it isn’t necessary to slugify it). In fact, the automation’s structure was nearly identical to Starf0x’s example.
Test Automation
alias: Test trigger id
description: ""
triggers:
- trigger: state
entity_id:
- input_boolean.test
to:
- "on"
id: Open It
- trigger: state
entity_id:
- input_boolean.test
to:
- "off"
id: Close It
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- Open It
sequence:
- action: notify.persistent_notification
data:
message: Open It
- conditions:
- condition: trigger
id:
- Close It
sequence:
- action: notify.persistent_notification
data:
message: Close It
mode: single
Given that it works, we need to know what Starf0x’s automation trace shows in order to understand why it "won’t work ".
Gotcha. In that case even your streamlined version won’t work until the problem has been identified, and traces are great for that. wistfully wishes traces were avaiable for trigger based template entities
If a wall switch, I’ve not worked with a smart switch, but I’d imagine you’d need to determine if indeed the switch passes power to the light when toggled by HA.
If the switch is a smart bulb, could it be it switches on but with the bulb at 1% brightness?
It is a zigbee wall switch and also a zigbee door sensor. both show a reaction when enforced, so the connectivity is there, the lamp is also working.
But I’m not hearing the familiar click from the switch behind the wallpanel.
But zigbee shows it is alive and kicking.
I have a quite 50+ zigbee environment, so communications errors are not the case.
It worked for years. It happened after the last update of HA.