Hi can someone share an example of automation with two time frames?
I would like to set the filtering of my pool at 09:00hs for 2 hours and at 16:00hs for other more 2 hours.
automation:
alias: Filter pool
trigger:
platform: time
at:
- "09:00:00"
- "16:00:00"
action:
- service: switch.turn_on
entity_id: switch.pool_filter
- delay:
hours: 2
- service: switch.turn_off
entity_id: switch.pool_filter
Or, to ensure you’re not affected by restarting homeassistant during the 2 hour delay…
automation:
alias: Filter pool
trigger:
platform: time
at:
- "09:00:00"
- "11:00:00"
- "16:00:00"
- "18:00:00"
action:
service: "switch.turn_{{ 'on' if now().hour in [9,16] else 'off' }}"
entity_id: switch.pool_filter
2 Likes