Change the output of a template sensor

I have a sensor with an attribute ‘departure_time: 14:00’ but the departure time is in the wrong timezone, it should be 12:00 instead of 14:00. So I created a template sensor and I would like to change the output to 12:00 but I can’t figure it out how to…

{{ state_attr('switch.volkswagen_tiguan_departure_schedule_3', 'departure_time') }}

Output of the sensor at the moment: 14:00 and I want it to be 12:00

Can anyone help me with this template sensor? Thanks in advance.

{{ (as_timestamp(strptime(state_attr('switch.volkswagen_tiguan_departure_schedule_3', 'departure_time'), '%H:%M')) - 7200 ) | timestamp_custom('%H:%M') }}

Thank you so much! Spend some hours to figure it out but it was beyond my ability

1 Like

Is it always a two hour difference or will it change depending on whether Daylight Saving Time is in effect or not?

I think it will always be a two hour difference, the app of Volkswagen shows the correct time, the sensor is just two hours off.

Does the two hour difference correspond to the offset of your local timezone?