node-red-contrib-mobius-flow-base 2.5.86-beta.7 → 2.5.86-beta.73
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/dist/nodes/common/mobsearch.js +577 -0
- package/dist/nodes/mobius-clear-resource.html +23 -3
- package/dist/nodes/mobius-clear-resource.js +21 -8
- package/dist/nodes/mobius-connection.js +29 -0
- package/dist/nodes/mobius-discover-object-list.html +36 -3
- package/dist/nodes/mobius-discover-object-list.js +71 -53
- package/dist/nodes/mobius-flow-inject.html +34 -2
- package/dist/nodes/mobius-flow-inject.js +23 -9
- package/dist/nodes/mobius-get-multi-object.html +40 -7
- package/dist/nodes/mobius-get-multi-object.js +17 -9
- package/dist/nodes/mobius-get-multi-resource.html +38 -7
- package/dist/nodes/mobius-get-multi-resource.js +19 -11
- package/dist/nodes/mobius-get-object.html +26 -5
- package/dist/nodes/mobius-get-object.js +21 -10
- package/dist/nodes/mobius-get-resource.html +25 -3
- package/dist/nodes/mobius-get-resource.js +21 -8
- package/dist/nodes/mobius-object-cov.html +26 -5
- package/dist/nodes/mobius-object-cov.js +18 -7
- package/dist/nodes/mobius-resource-cov.html +25 -4
- package/dist/nodes/mobius-resource-cov.js +13 -5
- package/dist/nodes/mobius-set-multi-resource.html +25 -4
- package/dist/nodes/mobius-set-multi-resource.js +18 -12
- package/dist/nodes/mobius-set-resource.html +24 -3
- package/dist/nodes/mobius-set-resource.js +31 -13
- package/dist/nodes/node-red-ui-discover-devices.js +61 -34
- package/package.json +2 -2
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusResourceCovNode
|
|
31
|
+
function MobiusResourceCovNode(n) {
|
|
32
32
|
RED.nodes.createNode(this, n);
|
|
33
33
|
this.detailedOutput = n.detailedOutput;
|
|
34
34
|
this.resource = n.resource;
|
|
@@ -39,26 +39,26 @@ 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.serviceConn.subscribeToCOV(node.resource, this.id, (response) => {
|
|
46
46
|
node.status({
|
|
47
47
|
fill: 'green',
|
|
48
48
|
shape: 'dot',
|
|
49
|
-
text: JSON.stringify(response.value.pv)
|
|
49
|
+
text: JSON.stringify(response.value.pv),
|
|
50
50
|
});
|
|
51
51
|
if (node.detailedOutput === true) {
|
|
52
52
|
node.send([
|
|
53
53
|
{ topic: response.uri, payload: response.value.pv },
|
|
54
54
|
{ topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
55
55
|
{ topic: response.uri, payload: response.value },
|
|
56
|
-
{ topic: response.uri, payload: { response: response } }
|
|
56
|
+
{ topic: response.uri, payload: { response: response } },
|
|
57
57
|
]);
|
|
58
58
|
} else {
|
|
59
59
|
node.send([
|
|
60
60
|
{ topic: response.uri, payload: response.value.pv },
|
|
61
|
-
{ topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
61
|
+
{ topic: response.uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
62
62
|
]);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
@@ -74,4 +74,12 @@ module.exports = function (RED) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
RED.nodes.registerType('mobius resource cov', MobiusResourceCovNode);
|
|
77
|
+
|
|
78
|
+
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
79
|
+
var options = {
|
|
80
|
+
root: __dirname + '/common/',
|
|
81
|
+
dotfiles: 'deny',
|
|
82
|
+
};
|
|
83
|
+
res.sendFile(req.params[0], options);
|
|
84
|
+
});
|
|
77
85
|
};
|
|
@@ -29,10 +29,18 @@ 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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
<hr>
|
|
34
|
+
|
|
35
|
+
<div id="instance-row">
|
|
36
|
+
<div class="form-row" id="input-row">
|
|
37
|
+
<label for="node-input-instance"><i class="fa fa-tasks"></i> URI</label>
|
|
38
|
+
<input type="text" id="node-input-instance" style="width:61%;" placeholder="HID/SID/PID/INS (optional name)">
|
|
39
|
+
<a id="node-lookup-instance" class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>
|
|
40
|
+
</div>
|
|
35
41
|
</div>
|
|
42
|
+
<div id="mobsearch"></div>
|
|
43
|
+
|
|
36
44
|
<div class="form-row">
|
|
37
45
|
<label> </label>
|
|
38
46
|
<input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
|
|
@@ -45,13 +53,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
45
53
|
</div>
|
|
46
54
|
</script>
|
|
47
55
|
|
|
56
|
+
<script src="common/mobsearch.js"></script>
|
|
57
|
+
|
|
48
58
|
<script type="text/javascript">
|
|
49
59
|
RED.nodes.registerType('mobius set multi-resource',{
|
|
50
60
|
category: 'mobius',
|
|
51
61
|
defaults: {
|
|
52
62
|
name: {value:""},
|
|
53
63
|
detailedOutput: {value:false},
|
|
54
|
-
|
|
64
|
+
instance: {value: "", validate:function(v) {
|
|
55
65
|
if(v === '') { return true; }
|
|
56
66
|
let parts = v.split('/');
|
|
57
67
|
for(let lp = 0; lp < parts.length; lp++) {
|
|
@@ -82,6 +92,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
82
92
|
labelStyle: function() {
|
|
83
93
|
return this.name ? "node_label_italic":"";
|
|
84
94
|
},
|
|
95
|
+
oneditprepare: function () {
|
|
96
|
+
var node = this;
|
|
97
|
+
let mobiusSrvc = $("#node-input-connection").val();
|
|
98
|
+
|
|
99
|
+
opts = {
|
|
100
|
+
htmlElementId: 'mobsearch',
|
|
101
|
+
uriFieldName: 'node-input-instance',
|
|
102
|
+
inputRowId: 'input-row',
|
|
103
|
+
};
|
|
104
|
+
initMobsearch.toIns(mobiusSrvc, opts);
|
|
105
|
+
},
|
|
85
106
|
oneditsave: function() {
|
|
86
107
|
if($("#node-input-detailedOutput").prop('checked')) {
|
|
87
108
|
this.outputs = 2;
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusSetMultiResourceNode
|
|
31
|
+
function MobiusSetMultiResourceNode(n) {
|
|
32
32
|
RED.nodes.createNode(this, n);
|
|
33
33
|
this.detailedOutput = n.detailedOutput;
|
|
34
|
-
this.
|
|
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.
|
|
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
|
});
|
|
@@ -101,4 +99,12 @@ module.exports = function (RED) {
|
|
|
101
99
|
}
|
|
102
100
|
|
|
103
101
|
RED.nodes.registerType('mobius set multi-resource', MobiusSetMultiResourceNode);
|
|
102
|
+
|
|
103
|
+
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
104
|
+
var options = {
|
|
105
|
+
root: __dirname + '/common/',
|
|
106
|
+
dotfiles: 'deny',
|
|
107
|
+
};
|
|
108
|
+
res.sendFile(req.params[0], options);
|
|
109
|
+
});
|
|
104
110
|
};
|
|
@@ -29,10 +29,18 @@ 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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
|
|
33
|
+
<hr>
|
|
34
|
+
|
|
35
|
+
<div id="instance-row">
|
|
36
|
+
<div class="form-row" id="input-row">
|
|
37
|
+
<label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
|
|
38
|
+
<input type="text" id="node-input-resource" style="width:61%;" placeholder="HID/SID/PID/INS/RID">
|
|
39
|
+
</div>
|
|
35
40
|
</div>
|
|
41
|
+
|
|
42
|
+
<div id="mobsearch"></div>
|
|
43
|
+
|
|
36
44
|
<div class="form-row">
|
|
37
45
|
<label for="node-input-priority"><i class="fa fa-exclamation-triangle"></i> Priority</label>
|
|
38
46
|
<input type="text" id="node-input-priority" placeholder="Priotity to write or clear">
|
|
@@ -49,6 +57,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
49
57
|
</div>
|
|
50
58
|
</script>
|
|
51
59
|
|
|
60
|
+
<script src="common/mobsearch.js"></script>
|
|
61
|
+
|
|
52
62
|
<script type="text/javascript">
|
|
53
63
|
RED.nodes.registerType('mobius set resource',{
|
|
54
64
|
category: 'mobius',
|
|
@@ -90,6 +100,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
90
100
|
labelStyle: function() {
|
|
91
101
|
return this.name ? "node_label_italic":"";
|
|
92
102
|
},
|
|
103
|
+
oneditprepare: function () {
|
|
104
|
+
var node = this;
|
|
105
|
+
let mobiusSrvc = $("#node-input-connection").val();
|
|
106
|
+
|
|
107
|
+
opts = {
|
|
108
|
+
htmlElementId: 'mobsearch',
|
|
109
|
+
uriFieldName: 'node-input-resource',
|
|
110
|
+
inputRowId: 'input-row',
|
|
111
|
+
};
|
|
112
|
+
initMobsearch.toRid(mobiusSrvc, opts);
|
|
113
|
+
},
|
|
93
114
|
oneditsave: function() {
|
|
94
115
|
if($("#node-input-detailedOutput").prop('checked')) {
|
|
95
116
|
this.outputs = 4;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusSetResourceNode
|
|
31
|
+
function MobiusSetResourceNode(n) {
|
|
32
32
|
RED.nodes.createNode(this, n);
|
|
33
33
|
this.detailedOutput = n.detailedOutput;
|
|
34
34
|
this.resource = n.resource;
|
|
@@ -40,7 +40,7 @@ module.exports = function (RED) {
|
|
|
40
40
|
node.status({
|
|
41
41
|
fill: 'red',
|
|
42
42
|
shape: 'ring',
|
|
43
|
-
text: 'Disconnected'
|
|
43
|
+
text: 'Disconnected',
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
node.on('input', function (msg) {
|
|
@@ -60,7 +60,7 @@ module.exports = function (RED) {
|
|
|
60
60
|
node.status({
|
|
61
61
|
fill: 'green',
|
|
62
62
|
shape: 'ring',
|
|
63
|
-
text: 'Busy'
|
|
63
|
+
text: 'Busy',
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
if (value === null) {
|
|
@@ -69,29 +69,34 @@ module.exports = function (RED) {
|
|
|
69
69
|
node.status({
|
|
70
70
|
fill: 'yellow',
|
|
71
71
|
shape: 'dot',
|
|
72
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
72
|
+
text: 'Error: ' + JSON.stringify(err.code),
|
|
73
73
|
});
|
|
74
74
|
node.error('Mobius error clearing resource priority ' + JSON.stringify(err));
|
|
75
75
|
if (node.detailedOutput === true) {
|
|
76
|
-
node.send([
|
|
76
|
+
node.send([
|
|
77
|
+
null,
|
|
78
|
+
null,
|
|
79
|
+
null,
|
|
80
|
+
{ topic: uri, payload: { error: true, response: err } },
|
|
81
|
+
]);
|
|
77
82
|
}
|
|
78
83
|
} else {
|
|
79
84
|
node.status({
|
|
80
85
|
fill: 'green',
|
|
81
86
|
shape: 'dot',
|
|
82
|
-
text: JSON.stringify(response.value.pv)
|
|
87
|
+
text: JSON.stringify(response.value.pv),
|
|
83
88
|
});
|
|
84
89
|
if (node.detailedOutput === true) {
|
|
85
90
|
node.send([
|
|
86
91
|
{ topic: uri, payload: response.value.pv },
|
|
87
92
|
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
88
93
|
{ topic: uri, payload: response.value },
|
|
89
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
94
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
90
95
|
]);
|
|
91
96
|
} else {
|
|
92
97
|
node.send([
|
|
93
98
|
{ topic: uri, payload: response.value.pv },
|
|
94
|
-
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
99
|
+
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
95
100
|
]);
|
|
96
101
|
}
|
|
97
102
|
}
|
|
@@ -102,27 +107,32 @@ module.exports = function (RED) {
|
|
|
102
107
|
node.status({
|
|
103
108
|
fill: 'yellow',
|
|
104
109
|
shape: 'dot',
|
|
105
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
110
|
+
text: 'Error: ' + JSON.stringify(err.code),
|
|
106
111
|
});
|
|
107
112
|
node.error('Mobius error writing resource ' + JSON.stringify(err));
|
|
108
|
-
node.send([
|
|
113
|
+
node.send([
|
|
114
|
+
null,
|
|
115
|
+
null,
|
|
116
|
+
null,
|
|
117
|
+
{ topic: uri, payload: { error: true, response: err } },
|
|
118
|
+
]);
|
|
109
119
|
} else {
|
|
110
120
|
node.status({
|
|
111
121
|
fill: 'green',
|
|
112
122
|
shape: 'dot',
|
|
113
|
-
text: JSON.stringify(response.value.pv)
|
|
123
|
+
text: JSON.stringify(response.value.pv),
|
|
114
124
|
});
|
|
115
125
|
if (node.detailedOutput === true) {
|
|
116
126
|
node.send([
|
|
117
127
|
{ topic: uri, payload: response.value.pv },
|
|
118
128
|
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
119
129
|
{ topic: uri, payload: response.value },
|
|
120
|
-
{ topic: uri, payload: { error: false, response: response } }
|
|
130
|
+
{ topic: uri, payload: { error: false, response: response } },
|
|
121
131
|
]);
|
|
122
132
|
} else {
|
|
123
133
|
node.send([
|
|
124
134
|
{ topic: uri, payload: response.value.pv },
|
|
125
|
-
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
|
|
135
|
+
{ topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
|
|
126
136
|
]);
|
|
127
137
|
}
|
|
128
138
|
}
|
|
@@ -142,4 +152,12 @@ module.exports = function (RED) {
|
|
|
142
152
|
}
|
|
143
153
|
|
|
144
154
|
RED.nodes.registerType('mobius set resource', MobiusSetResourceNode);
|
|
155
|
+
|
|
156
|
+
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
157
|
+
var options = {
|
|
158
|
+
root: __dirname + '/common/',
|
|
159
|
+
dotfiles: 'deny',
|
|
160
|
+
};
|
|
161
|
+
res.sendFile(req.params[0], options);
|
|
162
|
+
});
|
|
145
163
|
};
|
|
@@ -119,41 +119,41 @@ module.exports = {
|
|
|
119
119
|
let services = [];
|
|
120
120
|
for (let i = 0; i < servicesFromConfig.length; i++) {
|
|
121
121
|
services.push({
|
|
122
|
-
id: servicesFromConfig.id,
|
|
123
|
-
spid: servicesFromConfig.id.split('/')[0],
|
|
124
|
-
sid: servicesFromConfig.id.split('/')[1],
|
|
125
|
-
uri: `${nodeConfig.uri}/${servicesFromConfig.id.split('/')[1]}`,
|
|
126
|
-
name: servicesFromConfig.name,
|
|
127
|
-
enabled: servicesFromConfig.enabled,
|
|
128
|
-
runAtStart: servicesFromConfig.runAtStart,
|
|
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
129
|
registered: null,
|
|
130
130
|
lastConnected: null,
|
|
131
131
|
status: null,
|
|
132
132
|
statusText: null,
|
|
133
133
|
mobiusSettings: null,
|
|
134
134
|
customSettings: null,
|
|
135
|
+
pids: [],
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
|
|
138
|
-
console.log('Following get node config');
|
|
139
|
-
console.log(services);
|
|
140
|
-
|
|
141
139
|
// Fetch information from each service config
|
|
142
|
-
for (i = 0; i < services.length; i++) {
|
|
140
|
+
for (let i = 0; i < services.length; i++) {
|
|
143
141
|
const fullServiceConfig = await connection.getServiceConfigProm(hid, services[i].sid);
|
|
144
|
-
|
|
145
|
-
|
|
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
|
+
}
|
|
146
149
|
}
|
|
147
150
|
|
|
148
|
-
console.log('Following service node configs');
|
|
149
|
-
console.log(services);
|
|
150
|
-
|
|
151
151
|
// Fetch information from discovered services
|
|
152
152
|
const discoveryResponse = await this.discover(connection, hid);
|
|
153
153
|
const servicesFromDiscovery = discoveryResponse.value;
|
|
154
|
-
for (i = 0; i < servicesFromDiscovery.length; i++) {
|
|
154
|
+
for (let i = 0; i < servicesFromDiscovery.length; i++) {
|
|
155
155
|
let serviceFound = false;
|
|
156
|
-
for (j = 0; j < services.length; j++) {
|
|
156
|
+
for (let j = 0; j < services.length; j++) {
|
|
157
157
|
if (servicesFromDiscovery[i].id === services[j].id) {
|
|
158
158
|
serviceFound = true;
|
|
159
159
|
services[j].registered = servicesFromDiscovery[i].registered;
|
|
@@ -176,30 +176,57 @@ module.exports = {
|
|
|
176
176
|
statusText: null,
|
|
177
177
|
mobiusSettings: null,
|
|
178
178
|
customSettings: null,
|
|
179
|
+
pids: [],
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
+
}
|
|
195
201
|
}
|
|
196
202
|
|
|
197
|
-
console.log('Complete');
|
|
198
|
-
console.log(services);
|
|
199
|
-
|
|
200
203
|
resolve(services);
|
|
201
204
|
} catch (err) {
|
|
202
|
-
reject(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));
|
|
203
230
|
}
|
|
204
231
|
});
|
|
205
232
|
},
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-mobius-flow-base",
|
|
3
|
-
"version": "2.5.86-beta.
|
|
3
|
+
"version": "2.5.86-beta.73",
|
|
4
4
|
"description": "Node-RED base nodes for Mobius Flow",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"build": "mkdir -p dist/nodes && cp src/nodes/*.js dist/nodes/ && cp src/nodes/*.html dist/nodes/ && cp -r src/nodes/icons dist/nodes/"
|
|
9
|
+
"build": "mkdir -p dist/nodes && cp src/nodes/*.js dist/nodes/ && cp src/nodes/*.html dist/nodes/ && cp -r src/nodes/icons dist/nodes/ && mkdir -p dist/nodes/common && cp src/nodes/common/*.js dist/nodes/common/"
|
|
10
10
|
},
|
|
11
11
|
"repository": "bitbucket:interiorautomation/node-red-contrib-mobius-flow-base",
|
|
12
12
|
"node-red": {
|