Calculate now until 17:00

Hi, I am not that good in code and templates, so I’m struggling with dates and times.
I want to have a calculation in an automation that compares the current time with 17:00 today, so I can use the time difference to set a climate timer.

Any hints or helpful articles to achieve this?
17:00 may also be a helper if that’s easier!

Thanks in advance!

{{ as_timestamp(today_at('17:00')) - as_timestamp(now()) }}

Difference between now and 17:00h local time in seconds.

{{ today_at('17:00').hour - now().hour }}

Difference in complete hours from now to 17:00h local time.

But I think you doing it wrong, what’s the overall purpose of this computation?

Thanks!

I want to use a computation to replace the ‘time’ in the yaml of this action


That way I can have a variable time there.

So, this is basically a ‘boost from now until 17:00h’ automation?

Yes that’s what I want, but I have to fill in the time in HH:MM:SS

Using your first suggestion works really well!! Strange enough, the timer is actually set to 16:59 in the Tado app, but I can live with that :slightly_smiling_face: if it does this always I’ll add a minute to the calculation!