I have a siemens washing machine which I have connected to home assistant through the Home Connect integration. (I run home-assistant (OS) on an RPi3B+)
So far so good. I get the following information in my dashboard:
(it is in dutch, but you get the idea.)
I wanted to do some automation in node-red using the remaining_program_time information in the above picture. Unfortunately the information that is shown is some sort of calculation on the actual value of the remaining_program_time. The actual value is something like this:
(node red debug node screenshot)
The first part is clear, it is the date, however then it looks like there is a time and some more numbers followed by 00:00. The time is neither the time the washing machine started, nor the time it should be finished. The numers after the time will sometimes get lower and then later on they could be higher again. The 00:00 never changes. See image below for changes time and numbers)
I have no idea how to convert this to a the time until the programm will be finished. But apparently it can be done, because the information in the dashboard is correct. (although always with a 2 minutes offset)
Trying to find out how the dashboard convert the numbers to a time remaining, I experimented with the different cards in the dashboard and saw the following: when using an entity card I get the date-time-numbers, but when I use an entities card (with only one entity) it gives me the time remaining. (See image below)
Does anyone have any idea how to convert the (strange) date/time/numbers sequense, to a program time remaining?
It is a datetime object. It has a date, then time (to the microsecond) in UTC then the timezone, which unless you are living in UTC+0 does not appear to be set.
The good news is that datetime objects are easy to manipulate to display how you wish. The bad news is I know nothing about node red. I have moved your post to the node red category so you will get the appropriate help.
Second question I’ve seen in two days that has an issue with ISO datetime format haha.
Shame the relative_time template helper function doesn’t work for future datestimes.