@flowfuse/nr-project-nodes
Advanced tools
Comparing version 0.6.1-15c450f-202311221657.0 to 0.6.1-cc76159-202311231105.0
@@ -684,5 +684,13 @@ module.exports = function (RED) { | ||
node.topic = buildLinkTopic(node, node.project, node.subTopic, node.broadcast) | ||
mqtt.connect() | ||
mqtt.registerStatus(node) | ||
let configOk = true | ||
if (node.broadcast !== true && OWNER_TYPE === 'application') { | ||
configOk = false | ||
node.status({ fill: 'red', shape: 'dot', text: 'unsupported source option' }) | ||
node.warn('Receiving direct messages is not supported for application assigned devices. Please update the nodes source option to use "Listen for broadcast messages".') | ||
} else { | ||
mqtt.connect() | ||
mqtt.registerStatus(node) | ||
} | ||
/** @type {MQTT.OnMessageCallback} */ | ||
@@ -714,13 +722,15 @@ const onSub = function (err, topic, msg, _packet) { | ||
// console.log(`🔗 LINK-IN SUB ${subscribedTopic}`) | ||
mqtt.subscribe(node, subscribedTopic, { qos: 2 }, onSub) | ||
.then(_result => {}) | ||
.catch(err => { | ||
node.status({ fill: 'red', shape: 'dot', text: 'subscribe error' }) | ||
node.error(err) | ||
if (configOk) { | ||
mqtt.subscribe(node, subscribedTopic, { qos: 2 }, onSub) | ||
.then(_result => {}) | ||
.catch(err => { | ||
node.status({ fill: 'red', shape: 'dot', text: 'subscribe error' }) | ||
node.error(err) | ||
}) | ||
this.on('input', function (msg, send, done) { | ||
send(msg) | ||
done() | ||
}) | ||
this.on('input', function (msg, send, done) { | ||
send(msg) | ||
done() | ||
}) | ||
} | ||
node.on('close', function (done) { | ||
@@ -740,3 +750,10 @@ mqtt.unsubscribe(node, subscribedTopic, onSub) | ||
} | ||
RED.nodes.registerType('project link in', ProjectLinkInNode) | ||
RED.nodes.registerType('project link in', ProjectLinkInNode, { | ||
settings: { | ||
projectLinkInNode_ownerType: { | ||
value: OWNER_TYPE, | ||
exportable: true | ||
} | ||
} | ||
}) | ||
@@ -743,0 +760,0 @@ // Project Link Out Node |
{ | ||
"name": "@flowfuse/nr-project-nodes", | ||
"version": "0.6.1-15c450f-202311221657.0", | ||
"version": "0.6.1-cc76159-202311231105.0", | ||
"description": "A collection of Node-RED nodes for easy communication between Node-RED instances running in the FlowFuse platform", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86309
948