Hi, I’m trying to automate switching between an AT HOME and an AWAY schedule.
This is the code I have made, but it won’t let me save, so I’m doing something wrong.
alias: Verwarming Sophie
description: Change heating schedule of Sophie room based on her presence
trigger:
- platform: zone
entity_id: person.sophie
zone: zone.home
event: enter
- platform: zone
entity_id: person.sophie
zone: zone.home
event: leave
action:
- service: "{{ switch.turn_off if trigger.event == 'enter' else switch.turn_on }}"
entity_id: switch.schedule_sophie_away
- service: "{{ switch.turn_on if trigger.event == 'leave' else switch.turn_off }}"
entity_id: switch.schedule_sophie_thuis
mode: single
What do I do wrong? Is it not possible to use the trigger.event in this way? Should I use a variable first and then try to switch based on that?