Timer option for light and switch entities?

Just want to add that a timer’s duration can be templated with the start event. This isn’t clear from the official docs (I’ve come across this a number of times, I really must submit a PR for the docs). You can find more info and examples here: Data template in timer duration.

So:

  1. Script taking a parameter, passing the duration to the timer start event. You can add the script e.g. to an entity card. I’m not sure whether a modal will pop up asking for the parameters.
  2. An input datetime helper and a button your UI. A script can automatically use the helper’s value. This makes it configurable and gives you a default.
  3. An automation using a helper when turning on. Allows for a single, but configurable duration.
  4. An automation using for: with the trigger to turn off. (Can for be templated? I can never remember.)
  5. An automation/script with preconfigured durations and conditions to make the appropriate selection.
1 Like