Skip to content

node red

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

node-red

To test VSCP with node-red you can use the VSCP demo server located at demo.vscp.org. This server has a MQTT broker active for public use at port 1883 which can be accessed with user="vscp" and password="secret". Also this server have websocket support on port 9001. The demo server is fully described here.

Simple example flow

This is a simple flow that display the temperature in our kitchen. The temperature is displayed in a gauge as well as in a diagram and looks like this

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