UNPKG

@frangoteam/fuxa-min

Version:

Web-based Process Visualization (SCADA/HMI/Dashboard) software

23 lines (22 loc) 786 B
module.exports = function(RED) { function FuxaGetTagIdNode(config) { RED.nodes.createNode(this, config); var node = this; var fuxa = RED.settings.functionGlobalContext.fuxa; this.on('input', async function(msg) { try { var tagName = config.tagName || msg.tagName; if (tagName) { var tagId = fuxa.getTagId(tagName, null); msg.payload = tagId; node.send(msg); } else { node.error('Tag name not specified', msg); } } catch (err) { node.error(err, msg); } }); } RED.nodes.registerType("get-tag-id", FuxaGetTagIdNode); }