I am one of the worst at formatting yaml templates. I am trying to create/update an input.time_to_go with a state value of (line 1/line 2 ) * line 3 below as part of an automation action. The base automation is:
I’m actually trying to estimate "time to reach target temperature…when will we be ready to eat.
((difference between target temp and current temp) / (difference between last temperature reading and current reading) ) * (time between last temperature reading and current temperature reading).
If the thermometer always moved one degree between readings, then this would be the logic:
If my (target temperature is 140F and the current thermometer temperature is 100F). it should take roughly 40 times the (time it took to go up one degree) to reach the target temperature.
However, the thermometer isn’t that consistent and when it changes (and triggers the automation, it jumps two degrees…so it would take only 20 times the interval time…thus the slightly more complicated formula.
This does not work. I need to know the number of seconds between the last trigger and the current trigger events. I have tried many different options and just haven’t stumbled on the right incantation.
Well then that’s hard, because HA doesn’t provide access to stuff like that in Jinja. After all Jinja’s supposed to be a lightweight programming language, and Python’s supposed to do the hard work. Try a python_script.
don’t know how to do that…I am programming an automation and need to find the number of seconds between the last time the automation was triggered and the current time it was triggered. Surely there is a way to do this…