Wrong TimeStamp in Sensor

I have a little problem with the remaining time of my washing machine.
The remaining time sensor, shows an end time, but it is wrong. Thus, I can not use it to display the remaining time (in minutes).

Here briefly for explanation in a template:

  1. status: sensor from the washing machine end time 13:00 clock
    2nd status: current time in Homeassistant
  2. status: sensor time machine finished
  3. status: remaining time in minutes (1h ago it showed me also already 34 minutes, because the machine should be finished at 13:00 o’clock, it should have shown 104 minutes).

This is the sensor as state:

Here is my Code:

  1. sensor remaining time in minutes
  2. sensor time machine finished
  - sensor:
        name: "Waschmaschine_verbleibende_Zeit"
        unique_id: "Waschmaschine_verbleibende_Zeit"
        unit_of_measurement: "min"
        state: '{{ (as_timestamp(states("sensor.waschmaschine_remaining_program_time")) - as_timestamp(now())) | timestamp_custom("%M") }}'

  - sensor:
        name: "Waschmaschine_Uhrzeit_fertig"
        unique_id: "Waschmaschine_Uhrzeit_fertig"
        unit_of_measurement: "Uhr"
        state: '{{ (as_timestamp(states("sensor.waschmaschine_remaining_program_time"))| timestamp_custom("%H:%M")) }}'

How can i change that? Thanks for all hints.

the sensor time is in UTC, you can tell by the +0000 at the end. That means your timezone isn’t attached to the sensors time. So when you do a calculation, you need to use a utc time to get the difference or attach your local timezone to the sensor’s timestamp. This means 1 of 2 things, you think it should be 13, when it’s actually not 13 because your timezone is not applied on the timestamp. Or your timezone is set incorrectly in your HA system. Based on your second sensor Waschmaschine_Uhrzeit_fertig, HA knows your timezone as being +1. So your end time on your washing machine is actually 14, according to your washing machine. If that’s wrong, then your washing machine is reporting the wrong time.

Ok, when i understand that correctly means the 4 zero at the end that the Sensor of the Washing Machine has no timezone.
That means HA can not calculate correctly (makes sense).
That means i must tell the sensor the correct timezone?! Or i must tell the timestamp the correct timezone?!

I still don’t think you follow. 13:00 UTC is 14:00 your local time. as_timestamp already handles this.

Is 13:00 UTC / 14:00 local time the correct time your washer ended?

What is your timezone?

Ah i got it. 13:00 UTC is my local time 14:00.
My Timezone ist UTC+1 and the washmachine handles UTC Time without +1, right?

Usually, most software deals with all time in UTC then they display it to the user in local time.

What time is it currently where you are? I can help you write the template to get the correct difference.

well either way, this calculation will give you the correct difference

{{ states("sensor.waschmaschine_remaining_program_time") | as_datetime - now() }}

Now its 14:24. Means UTC+1

That goes in the right direction, now the machine has 1hour and 1 minute to go . Your Template goes right but what are the numbers at the end?

142700 - Window

1 hour 1 minute 9.827916 seconds

if you just want the relative time, i.e. 9 minutes ago, etc.

{{ relative_time(states("sensor.waschmaschine_remaining_program_time") | as_datetime) or now() }}

Ah of course. Ok thanks than now it works with the correct time.
Thank you very very much. It cost me a little time to understand

Yes the relative time was what i need, but this gives me

is there no remaining time? If there isn’t, it’s going to display the current time.

It shows me the UTC Time again (without +1) and not the relative time - remaining minutes. (I try the template-editor).
Its confusing me at the moment.

I’m not sure, working for me over here. it should be showing the relative time.

Ok i test it tomorrow again. I’m out for today.
Thank you very very much for your patience.

So this is not working, i can’t find the answer.

This brings me not the relative time. But i can’t find the answer

You’re making some sort of simple mistake, like incorrect entity_id. The template is correct.

Oh my god, yes thats right. My big mistake. I’ve chose the wrong entity_id.
Your answer above was right. Thank you