node-red-contrib-mobius-flow-base 2.5.86-beta.4 → 2.5.86-beta.44

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.
@@ -28,10 +28,10 @@
28
28
  'use strict';
29
29
 
30
30
  module.exports = function (RED) {
31
- function MobiusSetMultiResourceNode (n) {
31
+ function MobiusSetMultiResourceNode(n) {
32
32
  RED.nodes.createNode(this, n);
33
33
  this.detailedOutput = n.detailedOutput;
34
- this.mobject = n.mobject;
34
+ this.instance = n.instance;
35
35
  this.serviceConn = RED.nodes.getNode(n.connection);
36
36
  var node = this;
37
37
 
@@ -39,11 +39,11 @@ module.exports = function (RED) {
39
39
  node.status({
40
40
  fill: 'red',
41
41
  shape: 'ring',
42
- text: 'Disconnected'
42
+ text: 'Disconnected',
43
43
  });
44
44
 
45
45
  node.on('input', function (msg) {
46
- let uri = node.mobject;
46
+ let uri = node.instance;
47
47
  let value = null;
48
48
  if (msg.hasOwnProperty('topic') && require('./validateURI')(msg.topic, 4)) {
49
49
  uri = msg.topic;
@@ -55,7 +55,7 @@ module.exports = function (RED) {
55
55
  node.status({
56
56
  fill: 'green',
57
57
  shape: 'ring',
58
- text: 'Busy'
58
+ text: 'Busy',
59
59
  });
60
60
 
61
61
  node.serviceConn.multiWriteResourceValue(uri, value, (err, response) => {
@@ -63,27 +63,25 @@ module.exports = function (RED) {
63
63
  node.status({
64
64
  fill: 'yellow',
65
65
  shape: 'dot',
66
- text: 'Error: ' + JSON.stringify(err.code)
66
+ text: 'Error: ' + JSON.stringify(err.code),
67
67
  });
68
68
  node.error('Mobius error writing multiple resources ' + JSON.stringify(err));
69
69
  if (node.detailedOutput === true) {
70
- node.send([null, {topic: uri, payload: { error: true, response: err }}]);
70
+ node.send([null, { topic: uri, payload: { error: true, response: err } }]);
71
71
  }
72
72
  } else {
73
73
  node.status({
74
74
  fill: 'green',
75
75
  shape: 'dot',
76
- text: 'OK'
76
+ text: 'OK',
77
77
  });
78
78
  if (node.detailedOutput === true) {
79
79
  node.send([
80
80
  { topic: uri, payload: response.value },
81
- { topic: uri, payload: { error: false, response: response } }
81
+ { topic: uri, payload: { error: false, response: response } },
82
82
  ]);
83
83
  } else {
84
- node.send([
85
- { topic: uri, payload: response.value }
86
- ]);
84
+ node.send([{ topic: uri, payload: response.value }]);
87
85
  }
88
86
  }
89
87
  });
@@ -29,10 +29,41 @@ POSSIBILITY OF SUCH DAMAGE.
29
29
  <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
30
30
  <input type="text" id="node-input-connection">
31
31
  </div>
32
- <div class="form-row">
33
- <label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
34
- <input type="text" id="node-input-resource" placeholder="Resource URI (hid/sid/pid/ins/rid)">
32
+
33
+ <hr>
34
+ <div id="instance-message-row" class="form-row hidden" style="color:#ff0000" align="center">
35
+ <p>To select a configured object from a drop-down list, <br/>
36
+ please create a MOBiUS connection, deploy the flow, and <br />
37
+ ensure that the node-red-connector service is running. <br />
38
+ Click the Confirm Deploy button if asked.</p>
39
+ </div>
40
+
41
+ <div id="instance-row">
42
+ <div class="form-row">
43
+ <label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
44
+ <input type="text" id="node-input-resource" style="width:61%;" placeholder="HID/SID/PID/INS/RID">
45
+ <a id="node-lookup-instance" class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>
46
+ </div>
47
+ </div>
48
+ <div id="instance-search-row">
49
+ <div class="form-row">
50
+ <label for="instance-search-sid"><i class="fa fa-tasks"></i> URI</label>
51
+ <input type="text" id="instance-search-hid" style="width:13%;" placeholder="HID">
52
+ <input type="text" id="instance-search-sid" style="width:8%;" placeholder="SID">
53
+ <input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
54
+ <input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
55
+ <input type="text" id="instance-search-rid" style="width:8%;" placeholder="RID">
56
+ <a id="node-search-return" class="searchbutton" style="vertical-align: middle"><i id="node-search-return-icon" class="fa fa-arrow-left"></i></a>
57
+ <a id="node-search-accept" class="searchbutton" style="vertical-align: middle; color: #CCCCCC"><i id="node-search-accept-icon" class="fa fa-check"></i></a>
58
+ </div>
35
59
  </div>
60
+ <div id="wildcard-alert-row" class="form-row hidden" style="color:#555555" align="center">
61
+ <p>Please note: The selection of wildcard '+'
62
+ means a search for a specific instance or resource
63
+ cannot be performed. As such, enter the
64
+ INS and/or RID manually.</p>
65
+ </div>
66
+
36
67
  <div class="form-row">
37
68
  <label for="node-input-priority"><i class="fa fa-exclamation-triangle"></i> Priority</label>
38
69
  <input type="text" id="node-input-priority" placeholder="Priotity to write or clear">
@@ -90,6 +121,279 @@ POSSIBILITY OF SUCH DAMAGE.
90
121
  labelStyle: function() {
91
122
  return this.name ? "node_label_italic":"";
92
123
  },
124
+ oneditprepare: function () {
125
+ var node = this;
126
+ let mobiusSrvc = $("#node-input-connection").val();
127
+
128
+ function doesMobiusServiceExist() {
129
+ let srvc = $("#node-input-mobius").val();
130
+ if (srvc === '_ADD_') {
131
+ $("#node-lookup-instance").hide();
132
+ $("#instance-message-row").show();
133
+ } else {
134
+ $("#instance-message-row").hide();
135
+ $("#node-lookup-instance").show();
136
+ }
137
+ }
138
+ doesMobiusServiceExist();
139
+
140
+
141
+ // *** MOBSEARCH *** //
142
+
143
+ //Inital setup
144
+ $("#instance-search-row").hide();
145
+ $("#wildcard-alert-row").hide();
146
+ $("#node-search-return").addClass('disabled');
147
+ $.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
148
+ $("#instance-search-hid").val(response);
149
+ })
150
+ let readyToAccept = false;
151
+ let searchObject = {
152
+ hid: $("#instance-search-hid").val(),
153
+ sid: $("#instance-search-sid").val(),
154
+ pid: $("#instance-search-pid").val(),
155
+ ins: $("#instance-search-ins").val(),
156
+ rid: $("#instance-search-rid").val(),
157
+ objects: []
158
+ }
159
+
160
+ //Function to search for RIDs
161
+ function ridSearch (objects, ins) {
162
+ $.getJSON(`mdiscover?mobius=${mobiusSrvc}&uri=${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}`, (response) => {
163
+ resList = response.value[0].resources
164
+ ress = ['#'];
165
+ for (let j = 0; j < resList.length; j++) {
166
+ ress.push(`${resList[j].rid} - ${resList[j].name}`)
167
+ }
168
+ $("#instance-search-rid").autocomplete({
169
+ source: ress,
170
+ minLength: 0,
171
+ close: function (event, ui) {
172
+ acceptCheck();
173
+ $("#instance-search-rid").autocomplete('destroy');
174
+ $("#instance-search-rid").val($("#instance-search-rid").val().substring(0, 2));
175
+ searchObject.rid = $("#instance-search-rid").val();
176
+ }
177
+ }).autocomplete('search', '');
178
+ })
179
+ }
180
+
181
+ //Function to search for INSs
182
+ function insSearch (objects, pid) {
183
+ let inss = ['#', '+'];
184
+ for (let i = 0; i < objects.length; i++) {
185
+ if (objects[i].pid === pid) {
186
+ const name = objects[i].resources[1].pv;
187
+ if (name === '') {
188
+ inss.push(objects[i].ins);
189
+ } else {
190
+ inss.push(`${objects[i].ins} - ${name}`);
191
+ }
192
+ }
193
+ }
194
+ $("#instance-search-ins").autocomplete({
195
+ source: inss,
196
+ minLength: 0,
197
+ close: function (event, ui) {
198
+ acceptCheck();
199
+ $("#instance-search-ins").autocomplete('destroy');
200
+ if ($("#instance-search-ins").val().length > 4) {
201
+ $("#instance-search-ins").val($("#instance-search-ins").val().substring(0, 4))
202
+ }
203
+ searchObject.ins = $("#instance-search-ins").val();
204
+ }
205
+ }).autocomplete('search', '');
206
+ }
207
+
208
+ //Function to search for PIDs
209
+ function pidsSearch(objects) {
210
+ searchObject.objects = objects;
211
+ let pids = ['#', '+'];
212
+ for (let i = 0; i < objects.length; i++) {
213
+ pids.push(`${objects[i].pid} - ${objects[i].profileName}`);
214
+ }
215
+ pids = [...new Set(pids)];
216
+ $("#instance-search-pid").autocomplete({
217
+ source: pids,
218
+ minLength: 0,
219
+ close: function (event, ui) {
220
+ acceptCheck();
221
+ $("#instance-search-pid").autocomplete('destroy');
222
+ if ($("#instance-search-pid").val().length > 4) {
223
+ $("#instance-search-pid").val($("#instance-search-pid").val().substring(0, 4))
224
+ }
225
+ searchObject.pid = $("#instance-search-pid").val();
226
+ }
227
+ }).autocomplete('search', '');
228
+ }
229
+
230
+ //Function to search for SIDs, and then fetch child objects based on selection
231
+ function serviceSearch(response) {
232
+ let services = ['#', '+'];
233
+ for (let i = 0; i < response.length; i++) {
234
+ if (response[i].sid !== '009') {
235
+ services.push(`${response[i].sid} - ${response[i].name}`);
236
+ }
237
+ }
238
+ $("#instance-search-sid").autocomplete({
239
+ source: services,
240
+ minLength: 0,
241
+ close: function (event, ui) {
242
+ acceptCheck();
243
+ $("#instance-search-sid").autocomplete('destroy');
244
+ if ($("#instance-search-sid").val().length > 3) {
245
+ $("#instance-search-sid").val($("#instance-search-sid").val().substring(0, 3))
246
+ }
247
+ searchObject.sid = $("#instance-search-sid").val();
248
+ if (searchObject.sid === '+') {
249
+ for (let i = 2; i < services.length; i++) {
250
+ $.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${services[i].substring(0, 3)}`, (objects) => {
251
+ searchObject.objects = searchObject.objects.concat(objects);
252
+ })
253
+ }
254
+ } else {
255
+ $.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${searchObject.sid}`, (objects) => {
256
+ searchObject.objects = objects;
257
+ })
258
+ }
259
+ }
260
+ }).autocomplete('search', '');
261
+ }
262
+
263
+ //Start a new search
264
+ function startSearch() {
265
+ $("#wildcard-alert-row").hide();
266
+ $("#instance-search-sid").val('');
267
+ $("#instance-search-pid").val('');
268
+ $("#instance-search-ins").val('');
269
+ searchObject.hid = $("#instance-search-hid").val()
270
+ searchObject.sid = '';
271
+ searchObject.pid = '';
272
+ searchObject.ins = '';
273
+ if (/((^([0-9A-F]){6}$)|^$)/.test(searchObject.hid)) {
274
+ $.getJSON(`mgetservices?mobius=${mobiusSrvc}&hid=${searchObject.hid}`, serviceSearch)
275
+ .fail((err) => {
276
+ console.log('Some kind of html failure message on service discovery');
277
+ });
278
+ }
279
+ }
280
+
281
+ //Finish a search
282
+ function finishSearch() {
283
+ $("#wildcard-alert-row").hide();
284
+ let uri = `${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}/${searchObject.rid}`
285
+ if (uri.includes('#')) {
286
+ uri = uri.substring(0,uri.indexOf('#') + 1)
287
+ }
288
+ $("#node-input-resource").val(uri);
289
+ $("#node-search-accept").css('color', '#CCCCCC');
290
+ readyToAccept = false;
291
+ $("#node-search-return").addClass('disabled');
292
+ $("#node-search-accept").addClass('disabled');
293
+ $("#node-lookup-instance").removeClass('disabled');
294
+ $("#instance-search-row").hide();
295
+ $("#instance-row").show();
296
+ }
297
+
298
+ //Function to update if accept button is grade out and functions based on conditions of fields
299
+ function acceptCheck() {
300
+ if (($("#instance-search-hid").val() !== '' && $("#instance-search-sid").val() !== '' && $("#instance-search-pid").val() !== '' && $("#instance-search-ins").val() !== '' && $("#instance-search-rid").val() !== '') ||
301
+ $("#instance-search-sid").val() === '#' || $("#instance-search-pid").val() === '#' || $("#instance-search-ins").val() === '#' || $("#instance-search-rid").val() === '#') {
302
+ $("#node-search-accept").css('color', '#555555');
303
+ readyToAccept = true;
304
+ } else {
305
+ $("#node-search-accept").css('color', '#CCCCCC');
306
+ readyToAccept = false;
307
+ }
308
+ if ($("#instance-search-sid").val() !== '+' && $("#instance-search-pid").val() !== '+' && $("#instance-search-ins").val() !== '+') {
309
+ $("#wildcard-alert-row").hide();
310
+ } else {
311
+ $("#wildcard-alert-row").show();
312
+ }
313
+ }
314
+
315
+ // Respond to clicks
316
+ $("#node-lookup-instance").click(function () { //When search button is clicked
317
+ $("#instance-search-sid").val('');
318
+ $("#instance-search-pid").val('');
319
+ $("#instance-search-ins").val('');
320
+ $("#instance-search-rid").val('');
321
+ $("#node-lookup-instance").addClass('disabled');
322
+ $("#node-search-return").removeClass('disabled');
323
+ $("#node-search-accept").removeClass('disabled');
324
+ $("#instance-row").hide();
325
+ $("#instance-search-row").show();
326
+ });
327
+ $("#instance-search-sid").click(function () { //SID field clicked
328
+ $("#instance-search-pid").val('')
329
+ $("#instance-search-ins").val('')
330
+ searchObject.pid = '';
331
+ searchObject.ins = '';
332
+ searchObject.rid = '';
333
+ searchObject.objects = [];
334
+ startSearch();
335
+ })
336
+ $("#instance-search-pid").click(function () { //PID field clicked
337
+ $("#instance-search-ins").val('')
338
+ $("#instance-search-rid").val('')
339
+ searchObject.ins = '';
340
+ searchObject.rid = '';
341
+ if (searchObject.sid !== '') {
342
+ pidsSearch(searchObject.objects);
343
+ }
344
+ })
345
+ $("#instance-search-ins").click(function () { //INS field clicked
346
+ $("#instance-search-rid").val('')
347
+ searchObject.rid = '';
348
+ if (searchObject.pid !== '' && searchObject.pid !== '+' && searchObject.sid !== '+') {
349
+ insSearch(searchObject.objects, searchObject.pid);
350
+ }
351
+ })
352
+ $("#instance-search-rid").click(function () { //RID clicked
353
+ if (searchObject.ins !== '' && searchObject.ins !== '+' && searchObject.pid !== '+' && searchObject.sid !== '+') {
354
+ ridSearch(searchObject.objects, searchObject.ins);
355
+ }
356
+ });
357
+ $("#node-search-return").click(function () { //Return/Back button clicked
358
+ $("#node-search-return").addClass('disabled');
359
+ $("#node-search-accept").addClass('disabled');
360
+ $("#node-lookup-instance").removeClass('disabled');
361
+ $("#instance-search-row").hide();
362
+ $("#instance-row").show();
363
+ });
364
+ $("#node-search-accept").click(function () { //Accept button clicked
365
+ if (readyToAccept) {
366
+ finishSearch();
367
+ }
368
+ });
369
+
370
+ // Respond to search field changes
371
+ $("#instance-search-hid").change(function () {
372
+ acceptCheck();
373
+ $("#instance-search-sid").val('');
374
+ $("#instance-search-pid").val('');
375
+ $("#instance-search-ins").val('');
376
+ $("#instance-search-rid").val('');
377
+ });
378
+ $("#instance-search-sid").change(function () {
379
+ searchObject.sid = $("#instance-search-sid").val()
380
+ acceptCheck();
381
+ });
382
+ $("#instance-search-pid").change(function () {
383
+ searchObject.pid = $("#instance-search-pid").val()
384
+ acceptCheck();
385
+ });
386
+ $("#instance-search-ins").change(function () {
387
+ searchObject.ins = $("#instance-search-ins").val()
388
+ acceptCheck();
389
+ });
390
+ $("#instance-search-rid").change(function () {
391
+ searchObject.rid = $("#instance-search-rid").val()
392
+ acceptCheck();
393
+ });
394
+
395
+ // *** MOBSEARCH *** //
396
+ },
93
397
  oneditsave: function() {
94
398
  if($("#node-input-detailedOutput").prop('checked')) {
95
399
  this.outputs = 4;
@@ -29,7 +29,7 @@
29
29
  const _ = require('lodash');
30
30
 
31
31
  module.exports = {
32
- async discover (connection, uri) {
32
+ async discover(connection, uri) {
33
33
  return new Promise((resolve, reject) => {
34
34
  connection.discover(uri, (err, response) => {
35
35
  if (err) {
@@ -41,7 +41,7 @@ module.exports = {
41
41
  });
42
42
  },
43
43
 
44
- async discoverDevicesByPID (RED, connection, hid, spids, pid) {
44
+ async discoverDevicesByPID(RED, connection, hid, spids, pid) {
45
45
  let devices = [];
46
46
  if (!hid || hid === '') {
47
47
  hid = connection.service.srvcAPI.status.hubId;
@@ -54,12 +54,17 @@ module.exports = {
54
54
  throw new Error(`Discover devices failed (${hid}) - ${err.message}`);
55
55
  }
56
56
  for (let srvcLoop = 0; srvcLoop < services.value.length; srvcLoop++) {
57
- if (services.value[srvcLoop].status === 'online' && (spids.length === 0 || spids.includes(services.value[srvcLoop].spid))) {
57
+ if (
58
+ services.value[srvcLoop].status === 'online' &&
59
+ (spids.length === 0 || spids.includes(services.value[srvcLoop].spid))
60
+ ) {
58
61
  let insURI = `${hid}/${services.value[srvcLoop].id.split('/')[1]}/${pid}`;
59
62
  try {
60
63
  let instances = await this.discover(connection, insURI);
61
64
  for (let insLoop = 0; insLoop < instances.value.length; insLoop++) {
62
- let deviceURI = `${hid}/${services.value[srvcLoop].id.split('/')[1]}/${pid}/${instances.value[insLoop]}`;
65
+ let deviceURI = `${hid}/${services.value[srvcLoop].id.split('/')[1]}/${pid}/${
66
+ instances.value[insLoop]
67
+ }`;
63
68
  let device = await this.discover(connection, deviceURI);
64
69
  let resourcesByName = _.keyBy(device.value[0].resources, 'name');
65
70
  let deviceName = resourcesByName['name'].pv;
@@ -79,7 +84,7 @@ module.exports = {
79
84
  });
80
85
  },
81
86
 
82
- async discoverServicesBySPID (RED, connection, hid, spid) {
87
+ async discoverServicesBySPID(RED, connection, hid, spid) {
83
88
  if (!hid || hid === '') {
84
89
  hid = connection.service.srvcAPI.status.hubId;
85
90
  }
@@ -99,5 +104,130 @@ module.exports = {
99
104
  return new Promise((resolve) => {
100
105
  resolve(srvcs);
101
106
  });
102
- }
107
+ },
108
+
109
+ getServiceList(connection, hid) {
110
+ // getNodeConfig -> id, spid, uri, name, enabled, runAtStart
111
+ // For every: getServiceConfig -> mobiusSettings, customSettings
112
+ // discover -> registered, last connected, status + any remaining if new service
113
+ // For every: discover object -/0001/0001 -> status, statusText
114
+ return new Promise(async (resolve, reject) => {
115
+ try {
116
+ // Fetch information from node config
117
+ const nodeConfig = await connection.getNodeConfig(hid);
118
+ const servicesFromConfig = nodeConfig.value.services;
119
+ let services = [];
120
+ for (let i = 0; i < servicesFromConfig.length; i++) {
121
+ services.push({
122
+ id: servicesFromConfig[i].id,
123
+ spid: servicesFromConfig[i].id.split('/')[0],
124
+ sid: servicesFromConfig[i].id.split('/')[1],
125
+ uri: `${nodeConfig.uri}/${servicesFromConfig[i].id.split('/')[1]}`,
126
+ name: servicesFromConfig[i].name,
127
+ enabled: servicesFromConfig[i].enabled,
128
+ runAtStart: servicesFromConfig[i].runAtStart,
129
+ registered: null,
130
+ lastConnected: null,
131
+ status: null,
132
+ statusText: null,
133
+ mobiusSettings: null,
134
+ customSettings: null,
135
+ pids: [],
136
+ });
137
+ }
138
+
139
+ // Fetch information from each service config
140
+ for (let i = 0; i < services.length; i++) {
141
+ const fullServiceConfig = await connection.getServiceConfigProm(hid, services[i].sid);
142
+ if (fullServiceConfig.value.serviceConfig !== undefined) {
143
+ services[i].mobiusSettings = fullServiceConfig.value.serviceConfig.settings;
144
+ services[i].customSettings = fullServiceConfig.value.serviceConfig.custom;
145
+ } else {
146
+ services[i].mobiusSettings = fullServiceConfig.value.settings;
147
+ services[i].customSettings = fullServiceConfig.value.custom;
148
+ }
149
+ }
150
+
151
+ // Fetch information from discovered services
152
+ const discoveryResponse = await this.discover(connection, hid);
153
+ const servicesFromDiscovery = discoveryResponse.value;
154
+ for (let i = 0; i < servicesFromDiscovery.length; i++) {
155
+ let serviceFound = false;
156
+ for (let j = 0; j < services.length; j++) {
157
+ if (servicesFromDiscovery[i].id === services[j].id) {
158
+ serviceFound = true;
159
+ services[j].registered = servicesFromDiscovery[i].registered;
160
+ services[j].lastConnected = servicesFromDiscovery[i].lastconnected;
161
+ j = services.length;
162
+ }
163
+ }
164
+ if (!serviceFound) {
165
+ services.push({
166
+ id: servicesFromDiscovery[i].id,
167
+ spid: servicesFromDiscovery[i].id.split('/')[0],
168
+ sid: servicesFromDiscovery[i].id.split('/')[1],
169
+ uri: `${nodeConfig.uri}/${servicesFromDiscovery[i].id.split('/')[1]}`,
170
+ name: null,
171
+ enabled: null,
172
+ runAtStart: null,
173
+ registered: servicesFromDiscovery[i].registered,
174
+ lastConnected: servicesFromDiscovery[i].lastconnected,
175
+ status: null,
176
+ statusText: null,
177
+ mobiusSettings: null,
178
+ customSettings: null,
179
+ pids: [],
180
+ });
181
+ }
182
+ }
183
+
184
+ // Fetch pids and status object from all services
185
+ for (let i = 0; i < services.length; i++) {
186
+ if (services[i].sid !== '009') {
187
+ const serviceResponse = await this.discover(connection, `${hid}/${services[i].sid}`);
188
+ services[i].pids = [...new Set(serviceResponse.value)];
189
+ const statusObjectResponse = await this.discover(
190
+ connection,
191
+ `${hid}/${services[i].sid}/0001/0001`
192
+ );
193
+ const statusObject = statusObjectResponse.value[0];
194
+ services[i].status = statusObject.resources[1].pv;
195
+ services[i].statusText = `${statusObject.resources[2].pv}`;
196
+ } else {
197
+ services[i].pids = [];
198
+ services[i].status = 'Unknown';
199
+ services[i].statusText = 'Unknown';
200
+ }
201
+ }
202
+
203
+ resolve(services);
204
+ } catch (err) {
205
+ reject(JSON.stringify(err));
206
+ }
207
+ });
208
+ },
209
+
210
+ getObjectList(connection, hid, sid) {
211
+ return new Promise(async (resolve, reject) => {
212
+ try {
213
+ let objectList = [];
214
+ const serviceResponse = await this.discover(connection, `${hid}/${sid}`);
215
+ const pids = [...new Set(serviceResponse.value)];
216
+ for (let i = 0; i < pids.length; i++) {
217
+ const inssResponse = await this.discover(connection, `${hid}/${sid}/${pids[i]}`);
218
+ const inss = inssResponse.value;
219
+ for (let j = 0; j < inss.length; j++) {
220
+ const objResponse = await this.discover(
221
+ connection,
222
+ `${hid}/${sid}/${pids[i]}/${inss[j]}`
223
+ );
224
+ objectList.push(objResponse.value[0]);
225
+ }
226
+ }
227
+ resolve(objectList);
228
+ } catch (err) {
229
+ reject(JSON.stringify(err));
230
+ }
231
+ });
232
+ },
103
233
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-mobius-flow-base",
3
- "version": "2.5.86-beta.4",
3
+ "version": "2.5.86-beta.44",
4
4
  "description": "Node-RED base nodes for Mobius Flow",
5
5
  "main": "index.js",
6
6
  "types": "dist/index.d.ts",