Converting to local time

Hello!

Would be nice if anyone could help me out with below issue:
I am trying to get the remaining time of my stove, but “sensor.backofen_remaining_program_time” is in UTC while as_timestamp(now()) is in local time. So I somehow need to convert “sensor.backofen_remaining_program_time” to local time. Found already tons of threads about that topic, but couldn’t get it run.

Many thanks for your help!

  - platform: template
    sensors:      
      backofen_remaining:
        value_template: '{{ (as_timestamp(states("sensor.backofen_remaining_program_time")) - as_timestamp(now())) | timestamp_custom("%H:%M") }}'

try using the local timestamp filter:

'{{ (as_timestamp(states("sensor.backofen_remaining_program_time")|timestamp_local) - as_timestamp(now())) | timestamp_custom("%H:%M") }}'
2 Likes