Automation trigger "15 min before specified time"

good to see the whole automation.

  1. you should not be using device id guids. in the ui, choose “entity” (green on the right) and pick the right entity.
    here’s more info why:
    Why and how to avoid device_ids in automations and scripts

  2. when you say “change the whole thing to seconds” what do you mean? do you mean 'input_number.worx_garagentore_vorher_offnen" is seconds? or do you mean something else? if you mean that’s in seconds, just change the minutes= to seconds=

alias: Template Worx Test Lampe Wohnzimmer
description: ""
trigger:
  - platform: template
    value_template: >-
      {{ now() >= (states("sensor.m700_next_scheduled_start") | as_datetime -
      timedelta(seconds=states("input_number.worx_garagentore_vorher_offnen") |
      int))| as_local }}
condition: []
action:
  - type: turn_on
    device_id:  nuke this..
    entity_id:  use the entity_id friendly name

finally… why the “for:” 1 second? that seems odd.

btw… the “as_local” is unnecessary in the trigger because both “now()” and your full expression are fully qualified… ie, both include the timezone info that they are set in. so the comparisons will do the right thing even if the two are in different timezones.

1 Like

Thank you very much for your explanations. From now on I will only use the entities. Good to know :slight_smile:

Yes, I meant the value of the helper. Just like you wrote.

And I only added the 1 second because it didn’t work before. so it was just a test :smiley: