Node-RED/CheatSheet

From Wiki
< Node-RED
Revision as of 11:42, 18 May 2024 by Marcluer (talk | contribs) (Created page with "== Global variables == <pre> var labelmode = global.get("labelmode") </pre> == Node Status == <pre> node.status({fill:"gray",shape:"dot",text:msg.serialnumber + " = " + msg.pclass + "W"}); </pre> == Stop messages == <pre> if ( ...)) { return null; } else { return msg; } </pre> == InfluxDB == * write data with custom timestamp <pre> var timestamp = new Date(date + 'Z').getTime() * 1e6 msg = { payload : { value: value, time: timestamp },...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Global variables

var labelmode = global.get("labelmode")

Node Status

node.status({fill:"gray",shape:"dot",text:msg.serialnumber + " = " + msg.pclass + "W"});


Stop messages

if ( ...)) { 
return null; 
} else {
return msg;
}

InfluxDB

  • write data with custom timestamp
var timestamp = new Date(date + 'Z').getTime() * 1e6

msg = { payload : { value: value,
                    time: timestamp },
        measurement: topic }