I’m trying to write a template that compares the time to achieve a setpoint based on the current time and current temperature and a known achievable deltaT
This is what i have but i think it has trouble with the format of the time. I have tested the theory in a spreadsheet and need help writing the template correctly
This part is probably not valid. If you are using the basic sensor.time, it’s state will be a time string like “10:00” which will produce an error when the float() filter is applied.
Is the input datetime time-only?
Keep in mind that all states are strings, so you need to apply an int() or float() filter to the state of the input number as well; or you will get a type error.
Ultimately what i’m trying to get out is a boolean on whether the time to achieve the target temperature is less than the time available, so i can delay running a chiller until it needs to turn on.
I guess it’s reading as (difference in temperature) > (achievable temperature in available time)
But you will need to divide cooling_time by the appropriate value to convert the seconds into whatever unit is used in your delta_t.
Also, be aware that this basic version of time math will not work across midnight because of the use of the today_at() function. If you need it to work across midnight you’ll need to make some changes to the target time.
The deltaT is in degrees with a resolution of 0.1 (it’s currently set at 1.8 degrees/hour)
I don’t need it to run over midnight for the next 6 months at least, but i suspect as outdoor temperatures start to rise next spring and definitely summer, it will.
What changes do i need to make to cross the midnight threshold? I realise if i want this to be active all the time i will need it to work over midnight. Otherwise i’ve got to only enable my automation after 00:00