I’m trying to create an automation(s) based on the value of input_timedate.future_datetime value. I believe this can be accomplished with an automation template trigger; however, I am failing to determine the YAML syntax. (Another automation successfully sets a critical future date and time into the helper.) using now() as the consistent comparison variable… I believe my quest will be preceded by either…
but I am sure there is some sort of syntax or template error.
My goal is to have three trigger(s)
When current date/time is > input_timedate.future_datetime
Modified for one day earlier at 09:00.
When current date/time is > input_timedate.future_datetime
Modified for one day of but 1 hour earlier.
When current date/time is = or > input_timedate.future_datetime
I have been using the DeveloperTools/Template for the successful modification of input_timedate.future_datetime or now() but
nothing seems to work, other than
{{now().strftime("%Y-%m-%d %H:%M:%S")}}
which changes the result of now() precisely matches the result of
Convert the Input Datetime’s value to a datetime object and then you can use timedelta to easily offset it and compare it directly with the value of now().
Copy-paste the following examples into the Template Editor and experiment with them.
what I posted creates a sensor. It’s not a trigger for an automation. You place the snippit into your configuration.yaml file and restart. YOu’ll have 2 additional sensors on your system. Then you simply list out those time triggers pointing at those entities. Your trigger will not contain a template.
I’m in the process of using template sensors.
Can you tell me if it possible to test the results of a template,
if the result is negative, add 60 to it, if it is positive keep it.
Funny how doing math with time, direct answers may need to be modified.