@smappee/node-red-contrib-smappee
Version:
Smappee Node-RED contains Smappee nodes and example flows
16 lines (12 loc) • 379 B
JavaScript
module.exports = function(RED) {
function RealtimeNode(config) {
RED.nodes.createNode(this, config);
const node = this;
node.device = RED.nodes.getNode(config.device);
if (node.device) {
// Setup a subscriber to the device's realtime topic
node.device.subscribe(`realtime`, node);
}
}
RED.nodes.registerType('realtime', RealtimeNode);
};