Im working in my home lights project and i want to achive the following.
Im using sonoff with mqtt and homeassitant. All works fine!.
With node-red im checking the actual state of my sonoff if it is ON or OFF. All works fine.
The thing is i want to get the value or string of the ON state and how much is it ON. For example, the light is ON for about 1 hour. Then make something with that.
Im using the state node of home assistant and the information describes this.
I'm working on this feature and i find it a little bit complicated, maybe i'm complicating it too.
The thing is that i want to get the last time that the state was changed to ON. When that happens i have to compare that time and date with the actual time and date so i can get how many hours the light is ON because i could forget to turn it off o anything...
So, the debug tells me this.
How can i transform that to normal time and date?. I've read about the Change Node but i don't know.
where you paste your copied path in the first field of the move rule and use a jsonata expression to convert to minutes and round the result.
You would than have with one change node a nice msg.payload with the minutes since the last change.