node-red-contrib-uos-nats 0.1.63 → 0.1.64
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/README.md +43 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -161,7 +161,25 @@ Click **"Add Variable"** for each entry.
|
|
|
161
161
|
## 3. DataHub - OUT Node (Write Variables)
|
|
162
162
|
|
|
163
163
|
### Purpose
|
|
164
|
-
|
|
164
|
+
**Creates a real Data Hub provider** that publishes variables to the u-OS Data Hub. Other applications, devices, or even other Node-RED instances can **subscribe to your data in real-time**.
|
|
165
|
+
|
|
166
|
+
### How It Works
|
|
167
|
+
|
|
168
|
+
The OUT node:
|
|
169
|
+
1. **Registers as a Provider** on the Data Hub (e.g., provider ID: `nodered`)
|
|
170
|
+
2. **Publishes variable definitions** automatically when new variables are sent
|
|
171
|
+
3. **Sends value updates** via NATS when you send JSON messages
|
|
172
|
+
4. **Answers read requests** from other consumers (apps can query your latest values)
|
|
173
|
+
5. **Supports event-driven subscriptions** - other apps get updates **instantly** when values change
|
|
174
|
+
|
|
175
|
+
**Important:** This provider only exists **while Node-RED is running**. When you restart Node-RED, the provider re-registers automatically.
|
|
176
|
+
|
|
177
|
+
### Real-World Use Cases
|
|
178
|
+
|
|
179
|
+
✅ **IoT Data Collection:** Node-RED reads sensor data (Modbus, MQTT, etc.) and publishes it to the Data Hub
|
|
180
|
+
✅ **Edge Processing:** Process data locally in Node-RED, then share results with other apps
|
|
181
|
+
✅ **System Integration:** Bridge between different protocols (e.g., OPC UA → Data Hub)
|
|
182
|
+
✅ **Custom Dashboards:** Other apps can subscribe to Node-RED's variables for visualization
|
|
165
183
|
|
|
166
184
|
### Setup Steps
|
|
167
185
|
|
|
@@ -172,6 +190,8 @@ Publish variables to the Data Hub (creates your own provider that other apps can
|
|
|
172
190
|
- **Leave EMPTY** to use the `Client Name` from your Config (recommended)
|
|
173
191
|
- Or enter a custom provider ID (e.g., `my-machine-data`)
|
|
174
192
|
|
|
193
|
+
**Example:** If your Config's Client Name is `nodered`, the provider will be `nodered`
|
|
194
|
+
|
|
175
195
|
#### Step 3: Send JSON Messages
|
|
176
196
|
Send a JSON object with your data:
|
|
177
197
|
|
|
@@ -190,6 +210,28 @@ This creates variables:
|
|
|
190
210
|
- `machine.status` → ID 1
|
|
191
211
|
- `machine.speed` → ID 2
|
|
192
212
|
|
|
213
|
+
**The variables are INSTANTLY available to other apps via:**
|
|
214
|
+
- **Event subscriptions** (other apps get updates when values change)
|
|
215
|
+
- **Read queries** (other apps can request current values)
|
|
216
|
+
- **u-Control Web UI** (visible in Data Hub → Providers → `nodered`)
|
|
217
|
+
|
|
218
|
+
### Event-Driven Communication
|
|
219
|
+
|
|
220
|
+
When you send a message to the OUT node:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
[Function: {"temp": 22.5}] → [DataHub - OUT]
|
|
224
|
+
↓
|
|
225
|
+
┌───────────────────────────────┐
|
|
226
|
+
│ u-OS Data Hub (NATS) │
|
|
227
|
+
└───────────────────────────────┘
|
|
228
|
+
↓ ↓ ↓
|
|
229
|
+
[Python App] [Dashboard] [Other Node-RED]
|
|
230
|
+
(subscribes) (subscribes) (subscribes)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**All subscribers receive the update IMMEDIATELY** - no polling needed!
|
|
234
|
+
|
|
193
235
|
#### Step 4: Deploy & Test
|
|
194
236
|
1. Connect a **Function** or **Inject** node
|
|
195
237
|
2. Click **Deploy**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-uos-nats",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.64",
|
|
4
4
|
"description": "Node-RED nodes for Weidmüller u-OS Data Hub. Read and write variables via NATS protocol with OAuth2 authentication. Supports event-based subscriptions and manual variable mapping.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "IoTUeli",
|