node-red-contrib-uos-nats 0.2.22 → 0.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nodes/datahub-output.js +11 -1
- package/nodes/datahub-write.js +2 -2
- package/package.json +1 -1
package/nodes/datahub-output.js
CHANGED
|
@@ -156,6 +156,15 @@ module.exports = function (RED) {
|
|
|
156
156
|
|
|
157
157
|
this.status({ fill: 'green', shape: 'dot', text: 'ready' });
|
|
158
158
|
|
|
159
|
+
// Periodically republish definition to ensure visibility (Heartbeat)
|
|
160
|
+
const outputHeartbeat = setInterval(() => {
|
|
161
|
+
if (nc && !nc.isClosed()) {
|
|
162
|
+
sendDefinitionUpdate(payloads, subjects).catch(err => {
|
|
163
|
+
this.warn(`Heartbeat error: ${err.message}`);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}, 10000); // Every 10 seconds
|
|
167
|
+
|
|
159
168
|
this.on('input', async (msg, send, done) => {
|
|
160
169
|
try {
|
|
161
170
|
// Auto-parse string payloads
|
|
@@ -204,7 +213,7 @@ module.exports = function (RED) {
|
|
|
204
213
|
if (definitionsChanged) {
|
|
205
214
|
await sendDefinitionUpdate(payloadsMod, subjectsMod);
|
|
206
215
|
// Give Data Hub a moment to process the new definition before sending values
|
|
207
|
-
await new Promise(r => setTimeout(r,
|
|
216
|
+
await new Promise(r => setTimeout(r, 500));
|
|
208
217
|
}
|
|
209
218
|
// Convert stateMap to Object for payload builder
|
|
210
219
|
const stateObj = {};
|
|
@@ -238,6 +247,7 @@ module.exports = function (RED) {
|
|
|
238
247
|
if (sub) {
|
|
239
248
|
await sub.drain();
|
|
240
249
|
}
|
|
250
|
+
if (outputHeartbeat) clearInterval(outputHeartbeat);
|
|
241
251
|
await connection.release();
|
|
242
252
|
}
|
|
243
253
|
catch (err) {
|
package/nodes/datahub-write.js
CHANGED
|
@@ -24,7 +24,7 @@ module.exports = function (RED) {
|
|
|
24
24
|
// Query provider definition
|
|
25
25
|
try {
|
|
26
26
|
const query = payloads.buildReadProviderDefinitionQuery();
|
|
27
|
-
const subject = `v1.loc.${providerId}.def.
|
|
27
|
+
const subject = `v1.loc.registry.providers.${providerId}.def.qry.read`;
|
|
28
28
|
|
|
29
29
|
const response = await nc.request(subject, query, { timeout: 3000 });
|
|
30
30
|
const definition = payloads.decodeProviderDefinition(response.data);
|
|
@@ -211,7 +211,7 @@ module.exports = function (RED) {
|
|
|
211
211
|
const payloads = await import(payloadModuleUrl);
|
|
212
212
|
|
|
213
213
|
const query = payloads.buildReadProviderDefinitionQuery();
|
|
214
|
-
const subject = `v1.loc.${providerId}.def.qry.read`;
|
|
214
|
+
const subject = `v1.loc.registry.providers.${providerId}.def.qry.read`;
|
|
215
215
|
|
|
216
216
|
// Request with timeout
|
|
217
217
|
const response = await nc.request(subject, query, { timeout: 3000 });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-uos-nats",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.24",
|
|
4
4
|
"description": "Node-RED nodes for Weidmüller u-OS Data Hub. Read, write, and provide variables via NATS protocol with OAuth2 authentication. Features: Variable Key resolution, custom icons, example flows, and provider definition caching.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "IoTUeli",
|