@machhub-dev/node-red-nodes 1.0.8 → 1.0.10-test
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.
|
@@ -22,7 +22,6 @@ class MQTTService {
|
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
// If we already have an instance, return it
|
|
24
24
|
if (this.instance && this.instance.client && this.instance.client.connected) {
|
|
25
|
-
console.log("Returning existing MQTT instance");
|
|
26
25
|
if (statusCallback) {
|
|
27
26
|
statusCallback({ fill: "green", shape: "dot", text: "MQTT Connected" });
|
|
28
27
|
}
|
|
@@ -42,6 +41,7 @@ class MQTTService {
|
|
|
42
41
|
this.instancePromise = this.createInstance(settings, statusCallback);
|
|
43
42
|
try {
|
|
44
43
|
this.instance = yield this.instancePromise;
|
|
44
|
+
this.instancePromise = null; // Clear so future calls re-evaluate fresh state
|
|
45
45
|
return this.instance;
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
@@ -94,16 +94,9 @@ function default_1(RED) {
|
|
|
94
94
|
isInitializing = true;
|
|
95
95
|
node.status({ fill: "yellow", shape: "dot", text: "Connecting..." });
|
|
96
96
|
// Use MACHHUB config to get MQTT service with status callback
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
node.status(status);
|
|
101
|
-
});
|
|
102
|
-
// console.log("MQTT Service obtained client:", mqttService.client);
|
|
103
|
-
if (mqttService.client) {
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
97
|
+
mqttService = yield mqtt_service_1.MQTTService.getInstance(machhubConfig, (status) => {
|
|
98
|
+
node.status(status);
|
|
99
|
+
});
|
|
107
100
|
node.status({ fill: "green", shape: "dot", text: "Ready to publish" });
|
|
108
101
|
}
|
|
109
102
|
catch (error) {
|
package/dist/nodes/tag-read.js
CHANGED
|
@@ -68,17 +68,9 @@ function default_1(RED) {
|
|
|
68
68
|
try {
|
|
69
69
|
node.status({ fill: "yellow", shape: "dot", text: "Connecting..." });
|
|
70
70
|
// Use MACHHUB config from machhub.env.json to get MQTT service with status callback
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
mqttService = yield mqtt_service_1.MQTTService.getInstance(machhubConfig, (status) => {
|
|
75
|
-
node.status(status);
|
|
76
|
-
});
|
|
77
|
-
// console.log("MQTT Service obtained client:", mqttService.client);
|
|
78
|
-
if (mqttService.client) {
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
71
|
+
const mqttService = yield mqtt_service_1.MQTTService.getInstance(machhubConfig, (status) => {
|
|
72
|
+
node.status(status);
|
|
73
|
+
});
|
|
82
74
|
mqttService.addTopicHandler(node.selectedTag, (message, isRetained) => {
|
|
83
75
|
msg.payload = message;
|
|
84
76
|
msg.isRetained = isRetained;
|
package/dist/nodes/tag-write.js
CHANGED
|
@@ -86,16 +86,9 @@ function default_1(RED) {
|
|
|
86
86
|
try {
|
|
87
87
|
isInitializing = true;
|
|
88
88
|
node.status({ fill: "yellow", shape: "dot", text: "Connecting..." });
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
node.status(status);
|
|
93
|
-
});
|
|
94
|
-
// console.log("MQTT Service obtained client:", mqttService.client);
|
|
95
|
-
if (mqttService.client) {
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
89
|
+
mqttService = yield mqtt_service_1.MQTTService.getInstance(machhubConfig, (status) => {
|
|
90
|
+
node.status(status);
|
|
91
|
+
});
|
|
99
92
|
node.status({ fill: "green", shape: "dot", text: "Ready to publish" });
|
|
100
93
|
}
|
|
101
94
|
catch (error) {
|