Advertisement
JLindvig

1 hour before trigger

Mar 5th, 2021
1,060
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.42 KB | None | 0 0
  1. trigger:
  2.   - platform: template
  3.     # CHANGE THE FOLLOWING:
  4.     # "input_datetime.dim_time" to your own datetime input
  5.     # "hours = 1" TO YOUR LIKING (https://www.home-assistant.io/docs/configuration/templating#time)
  6.     value_template: "{{ ((strptime(now().year~'-'~now().month~'-'~now().day~' '~states('input_datetime.dim_time'), '%Y-%m-%d %H:%M:%S') - timedelta( hours = 1 )) | as_timestamp) == now() | as_timestamp }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement