#Time Triggers

1 messages · Page 1 of 1 (latest)

river portal
#

Are the following all equivalent? Back in 2020 there was - platform: time, but now I think that has been simplified as shown, and the docs have a little of all of them. What is the current preferred?

automation:
  triggers:
  - trigger: time
    at: "08:00"
automation:
  trigger: time
  at: "08:00"
automation:
  trigger:
    - platform: time
      at: "08:00"

I'm trying to create a simple automation to turn of a light between 800 and 1600 and turn it off between 1601 and 0759, every day, one that will survive restarts, reloads, etc, and not get confused. Maybe I'm over thinking it and the following should suffice for turn on, but it doesn't seem to be working.

  mode: restart
  trigger: time
  at: "08:00"
  action:
  - service: switch.turn_on
    entity_id: switch.zooz_zen15_power_cord_110_switch

Any advice would be appreciated.

devout quail
#

first one looks good, 2nd example looks like illegal syntax, 3rd example I think is the (still-working) legacy syntax

river portal
#

Thanks! I thought the 2nd was OK, based upon other examples of YAML, where a list is not required, i.e., only a single entry. But I may be wrong. I'm a bit rusty and lots has changed since I wrote all my existing automations.

devout quail
#

even if not a list, I think you're still missing a key

#

like at can't be a key of automation, it has to be grouped to the trigger

#
automation:
  trigger:
    trigger: time
    at: "08:00"

This may be valid and what you're thinking of

river portal
#

Yeah, you're right! I was just realizing that going through the docs again. It also looks like the Key trigger: has been changed to triggers:, because ALL of my automation use trigger: even when there are multiple triggers in a list, such as:

- platform: event
  event:...
- platform: time
  at:...
devout quail
#

yes, trigger: and triggers: are interchangeable for the top level trigger key

#

triggers: is the modern format.