node-red-contrib-uos-nats 0.2.60 → 0.2.62

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 CHANGED
@@ -48,8 +48,9 @@ Restart Node-RED. The nodes will appear in the **"Weidmüller DataHub"** categor
48
48
  2. Click the pencil ✏️ next to **Connection**.
49
49
  3. Enter:
50
50
  - **Host:** IP of your u-OS device (e.g. `192.168.10.100`)
51
+ - **Client Name:** Important! Give it a name (e.g. `nodered`).
51
52
  - **Client ID / Secret:** Paste from Step 1.
52
- 4. Click **Connect**.
53
+ 4. Click **Test connection**.
53
54
 
54
55
  ### 3. Example Flow
55
56
 
@@ -66,7 +67,7 @@ Import this flow to test reading and writing immediately:
66
67
  ### 📥 DataHub - Read
67
68
  Reads values from existing providers (like `u_os_adm`).
68
69
  - **Provider ID:** Name of the source provider.
69
- - **Variables:** Enter `Key:ID` manually (e.g. `temperature:0`).
70
+ - **Variables:** Enter `Key:ID` manually.
70
71
  - **Trigger:** "Event" (instant update) or "Poll" (interval).
71
72
 
72
73
  ### 📤 DataHub - Write
@@ -76,6 +77,7 @@ Changes values in other providers.
76
77
 
77
78
  ### 📡 DataHub - Provider
78
79
  Publishes your own data to the Data Hub.
80
+ - **Provider ID:** Leave empty to use your Client ID (Recommended).
79
81
  - **Input:** Send a JSON object: `{ "machine": { "status": "active" } }`.
80
82
  - **Auto-Discovery:** Automatically creates variable definitions based on your JSON structure.
81
83
 
@@ -83,6 +85,7 @@ Publishes your own data to the Data Hub.
83
85
 
84
86
  ## 🆘 Troubleshooting
85
87
 
88
+ - **Provider not visible?** Ensure **Provider ID** matches your **Client ID**. Easiest way: Leave Provider ID empty in the node.
86
89
  - **Connection Failed?** Check Host/IP and ensure Client ID/Secret are correct.
87
90
  - **Variable not found?** IDs in Node-RED must match the IDs in the u-OS Data Hub Web UI.
88
91
  - **Write not working?** Ensure your OAuth client has `hub.variables.readwrite` scope.
@@ -10,7 +10,31 @@
10
10
  inputs: 1,
11
11
  outputs: 1,
12
12
  icon: "datahub-provider.svg",
13
- oneditprepare: function () { },
13
+ oneditprepare: function () {
14
+ const updateProviderIdInfo = () => {
15
+ const configId = $('#node-input-connection').val();
16
+ const configNode = RED.nodes.node(configId);
17
+ const $provId = $('#node-input-providerId');
18
+
19
+ if (configNode && configNode.clientName) {
20
+ // User wants to see it "greyed out" -> Placeholder is best, or disabled?
21
+ // "desweiteren in der Hilfe erwähnen, das Provider ID vom Client Name übernommen wird"
22
+ // "du kannst ja das fenster ausgegraut lassen"
23
+
24
+ // If the field is empty, show the clientName as placeholder/visual
25
+ $provId.attr('placeholder', `Default: ${configNode.clientName}`);
26
+
27
+ // Show a helper message
28
+ $('#provider-id-helper').text(`Using Client ID from '${configNode.clientName}' (default)`);
29
+ } else {
30
+ $provId.attr('placeholder', 'Leave empty to use Client ID');
31
+ $('#provider-id-helper').text('');
32
+ }
33
+ };
34
+
35
+ $('#node-input-connection').on('change', updateProviderIdInfo);
36
+ updateProviderIdInfo();
37
+ },
14
38
  label: function () {
15
39
  return this.name || `DataHub - Provider ${this.providerId || ''}`;
16
40
  },
@@ -34,6 +58,7 @@
34
58
  <label for="node-input-providerId"><i class="fa fa-tag"></i> Provider ID</label>
35
59
  <input type="text" id="node-input-providerId" placeholder="Leave empty to use Client ID">
36
60
  </div>
61
+ <div class="form-tips" id="provider-id-helper" style="margin-bottom:10px; color:#888;"></div>
37
62
  </script>
38
63
 
39
64
  <script type="text/html" data-help-name="datahub-output">
@@ -42,8 +67,8 @@
42
67
  <dt>u-OS Config</dt>
43
68
  <dd>Connection node with host/port and OAuth credentials.</dd>
44
69
  <dt>Provider ID</dt>
45
- <dd>The unique ID for this provider. If left **empty**, it uses the <strong>Client Name</strong> from the u-OS Config.</dd>
46
- <dd><em>Recommendation:</em> Leave empty or use your Client ID to avoid permission errors.</dd>
70
+ <dd>The unique ID for this provider. If left <b>empty</b>, it uses the <strong>Client ID</strong> (associated with the configured <em>Client Name</em>).</dd>
71
+ <dd><em>UI Note:</em> The input placeholder shows the Client Name as a reference.</dd>
47
72
  </dl>
48
73
  <p>Send a JSON object as <code>msg.payload</code>. Nested objects are flattened using dot-notation to create <strong>subcategories</strong> automatically:</p>
49
74
  <pre>{
@@ -187,8 +187,8 @@
187
187
 
188
188
  <dt>Client Name</dt>
189
189
  <dd>
190
- A friendly identifier for this Node-RED instance. Used for connection logs.
191
- <br><b>Example:</b> <code>nodered</code>
190
+ Name of this connection (e.g. <code>nodered</code>).<br>
191
+ This is <b>mandatory</b> and helps identify logs.
192
192
  </dd>
193
193
 
194
194
  <dt>Client ID</dt>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-uos-nats",
3
- "version": "0.2.60",
3
+ "version": "0.2.62",
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",