I have build multiple Node-RED in Home Assistant, which switches on and off several devices automatically. I would like to display the date and time in Home Assistant when the state of a device changes.
In the example below, the device “Pomp” was switched off on 8 April at 09:31h via a Call Service node. Is it possible to display this date and time in the UI of Home Assistant?
Thanks for your reaction and help. I have created a sensor called ‘datum_tijd_laatste_beregening’ which should report the date and time when the entity ‘switch.fibaro_fgs222_beregeningspomp’ is enabled. However, the result is an error in the log. I expect that something is not correct in the value_template section, however, I am not able to find the right information on the internet. Do you know what needs to be changed?
In the meantime, I have adapted the value_template. The sensor reports now the status of the Entity ‘switch.fibaro_fgs222_beregeningspomp’ on and off. Now I need to know how to replace On and Off by the date & time of the last change.
I have tried ‘states.switch.fibaro_fgs222_beregeningspomp.last_changed’ and it worked! However I had some issues with formatting the date and time. At the end I ended with: