crassmok
(monard)
March 16, 2024, 2:37pm
1
I’m using the YAML code below for my first automation. I copied and pasted this code from the Home Assistant documentation and adapted it to my context (entity…) but it doesn’t work. Any ideas?"
automation:
alias: Front Light Schedule
trigger:
platform: calendar
event: start
entity_id: calendar.calendar_home
platform: calendar
event: end
entity_id: calendar.calendar_home
condition:
condition: template
value_template: “{{ ‘Front Lights’ in trigger.calendar_event.summary }}”
action:
if:
“{{ trigger.event == ‘start’ }}”
then:
service: switch.turn_on
entity_id: switch.lave_linge_switch
else:
service: switch.turn_off
entity_id: switch.lave_linge_switch
francisp
(Francis)
March 16, 2024, 2:41pm
2
Nobody can tell what is wrong.
Spaces at the beginning of the line are critical in yaml, and people trying to help you may want to copy your code so that they can try it out themselves, so please format it correctly when you are posting.
Use the preformatted text tool (</> in the edit post toolbar). If it is not immediately visible, it will be in the cogwheel menu.
[Code_format]
Alternatively you can use three backticks (the key is on the far left, 2nd row on en keyboards) on their own line above and below the code. That i…
1 Like
It’s trigger.id. Not trigger.event
but please check what @francisp posted. if it was any complex or if it was an indent issue it’s neigh impossible to find unless you post code properly
Oh… also I think you need:
service: switch.turn_off
target:
entity_id: switch.lave_linga_switch
This makes me wonder… Are you using the UI to do these scripts? You should either be using the UI to build them or at least to check them. It would have helped you on both of these issues