How do I create a time trigger in the ui that will fire every 10 minutes between 10pm and midnight? Looked at documentation and didn’t give an example.
Thank you in advance
How do I create a time trigger in the ui that will fire every 10 minutes between 10pm and midnight? Looked at documentation and didn’t give an example.
Thank you in advance
But why do you need to trigger every 10 minutes. Are you sure this is a correct way to create an automation?
Hmmm this is how I set it up when I used openhab. There will also be a condition to check if the outdoor wall lights are on.
This is an automation for the summer time. I currently have my outdoor lights to come on when the sunsets and turn off at 10pm. Here in the uk in summer the sun sets at between 9.30 and 10pm so if the lights come on just after 10pm my initial turn off at 10pm won’t work. The outdoor lights will then be on all night as they won’t get told to turn off.
If you know a better way of doing this I’m open to options.
There are ways to build a single automation but I’d keep it simple with two:
alias: Turn outside light on at sunset if before 10pm
id: c4789288-5a09-41c7-91b6-53891170ab58
trigger:
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
below: 0
condition:
- condition: time
before: "21:58:00"
action:
- service: light.turn_on
entity_id: light.outside_wall_lights
alias: Turn outside light off at 10pm
id: 403d3975-b054-4c50-86db-6ed48d3536b5
trigger:
- platform: time
at: "22:00:00"
action:
- service: light.turn_off
entity_id: light.outside_wall_lights
I’ve used a sun elevation trigger, and set the before
time in the first automation so that the light won’t be on for less than two minutes.
There’s no condition to check if the light’s already on before turning it off, as it doesn’t hurt to turn it off again.
Yes that’s a much better way thank you
Single automation, to turn on/off your outside lights, demonstrating the use of the two kinds of trigger variables available for use in triggers. It uses a single templated service call to turn the light on or off.
alias: example
trigger_variables:
light: 'light.your_outside_lights'
trigger:
- platform: state
entity_id: sun.sun
from: above_horizon
to: below_horizon
variables:
is_true: "{{ now().hour < 22 and is_state(light, 'off') }}"
command: 'on'
- platform: time
at: '22:00:00'
variables:
is_true: "{{ is_state(light, 'on') }}"
command: 'off'
condition:
- condition: template
value_template: '{{ is_true }}'
action:
- service: 'light.turn_{{ command }}'
target:
entity_id: '{{ light }}'