Sunset trigger for my garage door open

How does it know which day’s sunset I am talking about? It’s always after yesterday’s sunset.

alias: E-Security/Announce/Alert to Lock Garage after sunset
description: “”
trigger:

  • platform: time_pattern
    minutes: /15
    condition:
  • condition: and
    conditions:
    • condition: sun
      after: sunset
    • condition: state
      entity_id: binary_sensor.garage_door
      state: open

It’s programmed to know. :upside_down_face:

The docs provide a written explanation of the “truth table” for the condition and include a graphical timeline. Midnight is the second reference point when only after or before is defined.

FWIW, Time pattern triggers can be useful, and even necessary, in some situations but they are less efficient than using the other triggers that utilize the state machine and event bus.

Also, there is no reason to use an And condition in this case, the logical behavior for a list of conditions is to act as a logical And. You only need to use an And to link conditions within an Or condition.

Also please format your pasted code for the forum, see: How to help us help you - or How to ask a good question