Skip to content

node red

Åke Hedman edited this page Aug 17, 2021 · 21 revisions

node-red

Tips

Add localtime to event in flow

VSCP event have date and time set in UTC to be universally usable. To get local time you have to convert this UTC time to a local time. But don't despair the conversion is easy.

Add a function node in the flow from the MQTT broker with the following content

var utcDate = msg.payload.vscpDateTime;
msg.payload.localtime = new Date(utcDate);
return msg;

you will now have the localtime in msg.payload.localtime and can

Clone this wiki locally