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
- platform: time_pattern
- condition: and
- condition: sun
- condition: state
It’s programmed to know.
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
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