Hello,
I like to have the date and time, when a sensor has send the last update.
Is that possible and make it visible in my dashboard?
payload.LastUpdate
LastUpdate: "2024-01-31 21:44:07"
Hello,
I like to have the date and time, when a sensor has send the last update.
Is that possible and make it visible in my dashboard?
payload.LastUpdate
LastUpdate: "2024-01-31 21:44:07"
I think it is possible, what you need to do is to store the timestamp value in one of the message properties and maybe display it in a "text-ui" node, for example:
[{"id":"59bf320746c27a02","type":"tab","label":"Flow 17","disabled":false,"info":"","env":[]},{"id":"b29faeea26b2104e","type":"inject","z":"59bf320746c27a02","name":"Sensor simulation","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"43.25","payloadType":"num","x":290,"y":280,"wires":[["90bfcf4d064627b3"]]},{"id":"655664533c8ebf1a","type":"ui_text","z":"59bf320746c27a02","group":"e4b721e97dc05fb0","order":2,"width":0,"height":0,"name":"","label":"Last update:","format":"{{lastUpdate}}","layout":"row-center","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":690,"y":280,"wires":[]},{"id":"859f321548c05717","type":"debug","z":"59bf320746c27a02","name":"debug 33","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"lastUpdate","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":320,"wires":[]},{"id":"90bfcf4d064627b3","type":"function","z":"59bf320746c27a02","name":"Format Time","func":"var d = new Date();\nvar options = { timeZone: 'UTC', year: 'numeric', month: '2-digit', day: '2-digit', hour: `2-digit`, minute: `2-digit`, second: `2-digit`};\nvar _resultDate = d.toLocaleDateString('en-US', options);\nmsg.lastUpdate = _resultDate;\nreturn msg;","outputs":1,"timeout":"","noerr":1,"initialize":"","finalize":"","libs":[],"x":490,"y":280,"wires":[["655664533c8ebf1a","859f321548c05717","086c5fdc5bb69245"]]},{"id":"086c5fdc5bb69245","type":"ui_text","z":"59bf320746c27a02","group":"e4b721e97dc05fb0","order":2,"width":0,"height":0,"name":"","label":"Sensor value:","format":"{{payload}}","layout":"row-center","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":700,"y":240,"wires":[]},{"id":"e4b721e97dc05fb0","type":"ui_group","name":"Group 1","tab":"1e418ad18af41c84","order":1,"disp":true,"width":6},{"id":"1e418ad18af41c84","type":"ui_tab","name":"Tab 2","icon":"dashboard","order":2}]
hope you find the info useful.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.