I have the below script to turn on a set of switches then turn them off after 4 hours and 15 minutes linked to an automation that switches them on at 16:45 every day.
The problem is, they turn on but don’t turn off.
Can anyone please point out where it’s going wrong?
Script:
freshen_up:
alias: Freshen Up
sequence:
- service: switch.turn_on
entity_id:
- switch.air_freshener_kitchen
- switch.air_freshener_landing
- switch.air_freshener_master_bedroom
- switch.air_freshener_living_room
- delay:
hours: 4
minutes: 15
- service: switch.turn_off
entity_id:
- switch.air_freshener_kitchen
- switch.air_freshener_landing
- switch.air_freshener_master_bedroom
- switch.air_freshener_living_room
automation:
- alias: Freshen Up
trigger:
platform: time
at: '16:45:00'
action:
service: script.freshen_up