Template help... input helper to local time

'{{ ((states("input_number.varme_pause_timer") | float * 60.0) | int) | timestamp_custom("%H:%M:%S", False) }}'

this output is 00:90:00

how do i add 90 minutes (template) to local time fx. 21:30:00 + 90 minutes = 23:00:00

?

"{{ now() + timedelta(hours = states('input_number.varme_pause_timer')|float(0)) }}"

Thanks , but it returns with

TypeError: unsupported type for timedelta hours component: str

Fixed in post above… I accidentally left off the float filter.

1 Like

Thanks ! I change HOURS to MINUTES - and it almost perfect

I get this output : “2021-10-20 20:06:00.015044+02:00”

how do I get only “20:06:00”

?

You can control the format of the output by using strftime(format)…

"{{ ( now() + timedelta(hours = states('input_number.varme_pause_timer')|float(0) )).strftime("%H:%M:%S") }}"

thanks, but i get this

UndefinedError: ‘datetime.timedelta object’ has no attribute ‘strftime’

Double check to make sure you got the parentheses correct. You need one before “now()” and two after “|float(0)”

I have added spaces after and before the parentheses in the post above to make it more visible.

1 Like

now it works !!! THANKS - you’re cool :slight_smile:

“2021-10-21 00:26:38.266037+02:00”

“00:26:38”

1 Like