node-red-contrib-alice 2.1.2 → 2.1.3
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/nodes/alice-device.js +5 -6
- package/package.json +2 -2
package/nodes/alice-device.js
CHANGED
|
@@ -73,11 +73,8 @@ module.exports = function(RED) {
|
|
|
73
73
|
// data = JSON.stringify(states);
|
|
74
74
|
// };
|
|
75
75
|
// service.send2gate('$me/device/state/'+this.id+'/states', data ,true);
|
|
76
|
-
if (states === null){
|
|
77
|
-
return;
|
|
78
|
-
};
|
|
79
76
|
const option = {
|
|
80
|
-
timeout:
|
|
77
|
+
timeout: 5000,
|
|
81
78
|
method: 'POST',
|
|
82
79
|
url: 'https://api.nodered-home.ru/gtw/device/state',
|
|
83
80
|
headers: {
|
|
@@ -94,7 +91,7 @@ module.exports = function(RED) {
|
|
|
94
91
|
this.trace("Device state updated successfully");
|
|
95
92
|
})
|
|
96
93
|
.catch(error=>{
|
|
97
|
-
this.
|
|
94
|
+
this.debug("Error when update device state: "+error.message);
|
|
98
95
|
})
|
|
99
96
|
};
|
|
100
97
|
// отправка эвентов
|
|
@@ -221,6 +218,7 @@ module.exports = function(RED) {
|
|
|
221
218
|
if (stateindex>-1){
|
|
222
219
|
states.properties.splice(stateindex, 1);
|
|
223
220
|
};
|
|
221
|
+
this._updateDeviceState();
|
|
224
222
|
resolve(true);
|
|
225
223
|
})
|
|
226
224
|
};
|
|
@@ -257,7 +255,8 @@ module.exports = function(RED) {
|
|
|
257
255
|
this.emit('offline');
|
|
258
256
|
if (removed){
|
|
259
257
|
deviceconfig = null;
|
|
260
|
-
states =
|
|
258
|
+
states.capabilities = [];
|
|
259
|
+
states.properties = [];
|
|
261
260
|
this._updateDeviceState();
|
|
262
261
|
this._updateDeviceInfo(true);
|
|
263
262
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-alice",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "alice.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "git+https://github.com/efa2000/node-red-contrib-alice.git"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">=14.0.0"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
17
|
"node-red",
|