I am trying to figure outa way to calculate the end time for my dryer and washer.
Late last night i found this code that was working at the time i tested it, but now my template sensor is just showing the current time and not the machine end time.
What i want to do is add the timetoend sensors value in minutes to the current time.
{% set t = strptime(states ('sensor.electrolux_my_dryer_td1_timetoend'), '%H:%M', today_at()).time() %}
{{ as_timestamp(now() + timedelta(hours=t.hour, minutes=t.minute, seconds=t.second)) | timestamp_custom('%H:%M') }}
if the state of ‘sensor.electrolux_my_dryer_td1_timetoend’ is HH:MM…
{% set t = states('sensor.electrolux_my_dryer_td1_timetoend').split(':') | list | map('int') | list %}
{% set t = now() + timedelta(hours=t[0], minutes=t[1]) if t | length == 2 else now() %}
{{ t.strftime("%H:%M") }}
keep in mind that it will always return the current time if sensor.electrolux_my_dryer_td1_timetoend does not have the format HH:MM
{% set t = states('sensor.electrolux_my_dryer_td1_timetoend') %}
{% set t = now() + timedelta(minutes=t | int) if t | is_number else now() %}
{{ t.strftime("%H:%M") }}
or
{% set minutes = states('sensor.electrolux_my_dryer_td1_timetoend') | int(0) %}
{% set t = now() + timedelta(minutes=minutes) %}
{{ t.strftime("%H:%M") }}