UNPKG

node-red-contrib-zwave-js

Version:

The most powerful, high performing and highly polished Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, you have found it.

20 lines (15 loc) 531 B
const { invokeMethod } = require('./Invoker'); const process = async function (DriverInstance, Method, NodeID, VID, Value, ValueOptions) { let Node; if (Array.isArray(NodeID)) { Node = DriverInstance.controller.getMulticastGroup(NodeID); } else { Node = DriverInstance.controller.nodes.get(NodeID); } if (!Node) { throw new Error(`Node ${NodeID} does not exist`); } const Args = Method === 'setValue' ? [VID, Value, ValueOptions] : [VID]; return invokeMethod(Node, Method, Args); }; module.exports = { process };