iobroker.zigbee 1.8.0 → 1.8.1
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 +1 -1
- package/io-package.json +2 -2
- package/lib/binding.js +9 -13
- package/lib/colors.js +148 -145
- package/lib/commands.js +15 -13
- package/lib/developer.js +3 -5
- package/lib/devices.js +29 -30
- package/lib/exposes.js +60 -31
- package/lib/groups.js +32 -33
- package/lib/json.js +2 -2
- package/lib/networkmap.js +0 -1
- package/lib/ota.js +11 -3
- package/lib/rgb.js +72 -33
- package/lib/seriallist.js +9 -9
- package/lib/states.js +48 -49
- package/lib/statescontroller.js +44 -27
- package/lib/utils.js +3 -3
- package/lib/zbDeviceAvailability.js +26 -25
- package/lib/zbDeviceConfigure.js +2 -2
- package/lib/zigbeecontroller.js +22 -8
- package/main.js +17 -17
- package/package.json +1 -1
package/lib/json.js
CHANGED
|
@@ -19,7 +19,7 @@ function safeGetValueFromPropertyOnObject(obj, property) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function ensureProperties(obj) {
|
|
22
|
-
const seen = [
|
|
22
|
+
const seen = []; // store references to objects we have seen before
|
|
23
23
|
|
|
24
24
|
function visit(obj) {
|
|
25
25
|
if (obj === null || typeof obj !== 'object') {
|
|
@@ -34,7 +34,7 @@ function ensureProperties(obj) {
|
|
|
34
34
|
if (typeof obj.toJSON === 'function') {
|
|
35
35
|
try {
|
|
36
36
|
return visit(obj.toJSON());
|
|
37
|
-
} catch(err) {
|
|
37
|
+
} catch (err) {
|
|
38
38
|
return throwsMessage(err);
|
|
39
39
|
}
|
|
40
40
|
}
|
package/lib/networkmap.js
CHANGED
package/lib/ota.js
CHANGED
|
@@ -55,7 +55,11 @@ class Ota {
|
|
|
55
55
|
const device = await this.getDeviceForMessage(obj);
|
|
56
56
|
if (!device) {
|
|
57
57
|
this.debug(`Device ${obj.message.devId} is unavailable`);
|
|
58
|
-
this.adapter.sendTo(obj.from, obj.command, {
|
|
58
|
+
this.adapter.sendTo(obj.from, obj.command, {
|
|
59
|
+
status: 'fail',
|
|
60
|
+
device: getZbId(obj.message.devId),
|
|
61
|
+
msg: 'Device is unavailable'
|
|
62
|
+
}, obj.callback);
|
|
59
63
|
return;
|
|
60
64
|
}
|
|
61
65
|
if (this.inProgress.has(device.device.ieeeAddr)) {
|
|
@@ -111,7 +115,11 @@ class Ota {
|
|
|
111
115
|
const device = await this.getDeviceForMessage(obj);
|
|
112
116
|
if (!device) {
|
|
113
117
|
this.debug(`Device ${obj.message.devId} is unavailable`);
|
|
114
|
-
this.adapter.sendTo(obj.from, obj.command, {
|
|
118
|
+
this.adapter.sendTo(obj.from, obj.command, {
|
|
119
|
+
status: 'fail',
|
|
120
|
+
device: getZbId(obj.message.devId),
|
|
121
|
+
msg: 'Device is unavailable'
|
|
122
|
+
}, obj.callback);
|
|
115
123
|
return;
|
|
116
124
|
}
|
|
117
125
|
if (this.inProgress.has(device.device.ieeeAddr)) {
|
|
@@ -133,7 +141,7 @@ class Ota {
|
|
|
133
141
|
this.inProgress.add(device.device.ieeeAddr);
|
|
134
142
|
const result = {status: 'unknown', device: device ? device.name : null};
|
|
135
143
|
try {
|
|
136
|
-
this.info('Start firmware update for '+device.name);
|
|
144
|
+
this.info('Start firmware update for ' + device.name);
|
|
137
145
|
|
|
138
146
|
const onProgress = (progress, remaining) => {
|
|
139
147
|
let message = `Update of '${device.name}' at ${progress}%`;
|
package/lib/rgb.js
CHANGED
|
@@ -4,7 +4,7 @@ With these functions you can convert the CIE color space to the RGB color space
|
|
|
4
4
|
The developer documentation for Philips Hue provides the formulas used in the code below:
|
|
5
5
|
https://developers.meethue.com/documentation/color-conversions-rgb-xy
|
|
6
6
|
|
|
7
|
-
I've used the formulas and Objective-C example code and
|
|
7
|
+
I've used the formulas and Objective-C example code and transferred it to JavaScript.
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Examples:
|
|
@@ -60,9 +60,9 @@ function cie_to_rgb(x, y, brightness) {
|
|
|
60
60
|
const Z = (Y / y) * z;
|
|
61
61
|
|
|
62
62
|
//Convert to RGB using Wide RGB D65 conversion
|
|
63
|
-
let red
|
|
64
|
-
let green
|
|
65
|
-
let blue
|
|
63
|
+
let red = X * 1.656492 - Y * 0.354851 - Z * 0.255038;
|
|
64
|
+
let green = -X * 0.707196 + Y * 1.655397 + Z * 0.036152;
|
|
65
|
+
let blue = X * 0.051713 - Y * 0.121364 + Z * 1.011530;
|
|
66
66
|
|
|
67
67
|
//If red, green or blue is larger than 1.0 set it back to the maximum of 1.0
|
|
68
68
|
if (red > blue && red > green && red > 1.0) {
|
|
@@ -81,24 +81,24 @@ function cie_to_rgb(x, y, brightness) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
//Reverse gamma correction
|
|
84
|
-
red
|
|
85
|
-
green
|
|
86
|
-
blue
|
|
84
|
+
red = red <= 0.0031308 ? 12.92 * red : (1.0 + 0.055) * Math.pow(red, (1.0 / 2.4)) - 0.055;
|
|
85
|
+
green = green <= 0.0031308 ? 12.92 * green : (1.0 + 0.055) * Math.pow(green, (1.0 / 2.4)) - 0.055;
|
|
86
|
+
blue = blue <= 0.0031308 ? 12.92 * blue : (1.0 + 0.055) * Math.pow(blue, (1.0 / 2.4)) - 0.055;
|
|
87
87
|
|
|
88
88
|
//Convert normalized decimal to decimal
|
|
89
|
-
red
|
|
90
|
-
green
|
|
91
|
-
blue
|
|
89
|
+
red = Math.round(red * 255);
|
|
90
|
+
green = Math.round(green * 255);
|
|
91
|
+
blue = Math.round(blue * 255);
|
|
92
92
|
|
|
93
|
-
if (isNaN(red) || red < 0
|
|
93
|
+
if (isNaN(red) || red < 0) {
|
|
94
94
|
red = 0;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
if (isNaN(green) || green < 0
|
|
97
|
+
if (isNaN(green) || green < 0) {
|
|
98
98
|
green = 0;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
if (isNaN(blue) || blue < 0
|
|
101
|
+
if (isNaN(blue) || blue < 0) {
|
|
102
102
|
blue = 0;
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -145,7 +145,9 @@ function hsvToRGB(h, s, v) {
|
|
|
145
145
|
s = s / 100;
|
|
146
146
|
v = v / 100;
|
|
147
147
|
|
|
148
|
-
let r;
|
|
148
|
+
let r;
|
|
149
|
+
let g;
|
|
150
|
+
let b;
|
|
149
151
|
if (arguments.length === 1) {
|
|
150
152
|
s = h.s;
|
|
151
153
|
v = h.v;
|
|
@@ -157,12 +159,36 @@ function hsvToRGB(h, s, v) {
|
|
|
157
159
|
const q = v * (1 - f * s);
|
|
158
160
|
const t = v * (1 - (1 - f) * s);
|
|
159
161
|
switch (i % 6) {
|
|
160
|
-
case 0:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
case
|
|
162
|
+
case 0:
|
|
163
|
+
r = v;
|
|
164
|
+
g = t;
|
|
165
|
+
b = p;
|
|
166
|
+
break;
|
|
167
|
+
case 1:
|
|
168
|
+
r = q;
|
|
169
|
+
g = v;
|
|
170
|
+
b = p;
|
|
171
|
+
break;
|
|
172
|
+
case 2:
|
|
173
|
+
r = p;
|
|
174
|
+
g = v;
|
|
175
|
+
b = t;
|
|
176
|
+
break;
|
|
177
|
+
case 3:
|
|
178
|
+
r = p;
|
|
179
|
+
g = q;
|
|
180
|
+
b = v;
|
|
181
|
+
break;
|
|
182
|
+
case 4:
|
|
183
|
+
r = t;
|
|
184
|
+
g = p;
|
|
185
|
+
b = v;
|
|
186
|
+
break;
|
|
187
|
+
case 5:
|
|
188
|
+
r = v;
|
|
189
|
+
g = p;
|
|
190
|
+
b = q;
|
|
191
|
+
break;
|
|
166
192
|
}
|
|
167
193
|
return {
|
|
168
194
|
r: Math.round(r * 255),
|
|
@@ -177,23 +203,35 @@ function rgbToHSV(r, g, b, numeric) {
|
|
|
177
203
|
b = r.b;
|
|
178
204
|
r = r.r;
|
|
179
205
|
}
|
|
180
|
-
const max = Math.max(r, g, b);
|
|
206
|
+
const max = Math.max(r, g, b);
|
|
207
|
+
const min = Math.min(r, g, b);
|
|
181
208
|
const d = max - min;
|
|
182
209
|
let h;
|
|
183
210
|
const s = (max === 0 ? 0 : d / max);
|
|
184
211
|
const v = max / 255;
|
|
185
212
|
|
|
186
213
|
switch (max) {
|
|
187
|
-
case min:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
case
|
|
214
|
+
case min:
|
|
215
|
+
h = 0;
|
|
216
|
+
break;
|
|
217
|
+
case r:
|
|
218
|
+
h = (g - b) + d * (g < b ? 6 : 0);
|
|
219
|
+
h /= 6 * d;
|
|
220
|
+
break;
|
|
221
|
+
case g:
|
|
222
|
+
h = (b - r) + d * 2;
|
|
223
|
+
h /= 6 * d;
|
|
224
|
+
break;
|
|
225
|
+
case b:
|
|
226
|
+
h = (r - g) + d * 4;
|
|
227
|
+
h /= 6 * d;
|
|
228
|
+
break;
|
|
191
229
|
}
|
|
192
230
|
if (numeric) {
|
|
193
231
|
return {
|
|
194
|
-
h: Math.round(h*360),
|
|
195
|
-
s: Math.round(s*100),
|
|
196
|
-
v: Math.round(v*100),
|
|
232
|
+
h: Math.round(h * 360),
|
|
233
|
+
s: Math.round(s * 100),
|
|
234
|
+
v: Math.round(v * 100),
|
|
197
235
|
};
|
|
198
236
|
}
|
|
199
237
|
return {
|
|
@@ -202,8 +240,9 @@ function rgbToHSV(r, g, b, numeric) {
|
|
|
202
240
|
v: (v * 100).toFixed(3),
|
|
203
241
|
};
|
|
204
242
|
}
|
|
243
|
+
|
|
205
244
|
function colorArrayFromString(value) {
|
|
206
|
-
if (typeof
|
|
245
|
+
if (typeof value === 'string') {
|
|
207
246
|
const rv = [];
|
|
208
247
|
value.split(',').forEach(element =>
|
|
209
248
|
rv.push(colors.ParseColor(element)));
|
|
@@ -219,8 +258,8 @@ function colorStringFromRGBArray(payload) {
|
|
|
219
258
|
return rv.toString();
|
|
220
259
|
}
|
|
221
260
|
|
|
222
|
-
function hsv_to_cie(h,s,v){
|
|
223
|
-
const rgb = hsvToRGB(h,s,v);
|
|
261
|
+
function hsv_to_cie(h, s, v) {
|
|
262
|
+
const rgb = hsvToRGB(h, s, v);
|
|
224
263
|
return rgb_to_cie(rgb.r, rgb.g, rgb.b);
|
|
225
264
|
}
|
|
226
265
|
|
|
@@ -244,8 +283,8 @@ function rgb_to_rgbstring(element) {
|
|
|
244
283
|
return col;
|
|
245
284
|
}
|
|
246
285
|
|
|
247
|
-
function hsvToRGBString(h,s,v) {
|
|
248
|
-
return rgb_to_rgbstring(hsvToRGB(h,s,v));
|
|
286
|
+
function hsvToRGBString(h, s, v) {
|
|
287
|
+
return rgb_to_rgbstring(hsvToRGB(h, s, v));
|
|
249
288
|
}
|
|
250
289
|
|
|
251
290
|
exports.hsv_to_cie = hsv_to_cie;
|
package/lib/seriallist.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const serialPortUtils = require('zigbee-herdsman/dist/adapter/serialPortUtils').default;
|
|
4
3
|
let SerialPort = null;
|
|
5
4
|
|
|
6
5
|
class SerialList {
|
|
@@ -8,6 +7,7 @@ class SerialList {
|
|
|
8
7
|
this.adapter = adapter;
|
|
9
8
|
this.adapter.on('message', obj => this.onMessage(obj));
|
|
10
9
|
}
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* @param {ioBroker.Message} obj
|
|
13
13
|
*/
|
|
@@ -22,7 +22,10 @@ class SerialList {
|
|
|
22
22
|
SerialPort.list()
|
|
23
23
|
.then(ports => {
|
|
24
24
|
this.adapter.log.info(`List of port: ${JSON.stringify(ports)}`);
|
|
25
|
-
this.adapter.sendTo(obj.from, obj.command, ports.map(item => ({
|
|
25
|
+
this.adapter.sendTo(obj.from, obj.command, ports.map(item => ({
|
|
26
|
+
label: item.friendlyName || item.pnpId || item.manufacturer,
|
|
27
|
+
comName: item.path
|
|
28
|
+
})), obj.callback);
|
|
26
29
|
})
|
|
27
30
|
.catch(e => {
|
|
28
31
|
this.adapter.sendTo(obj.from, obj.command, [], obj.callback);
|
|
@@ -30,19 +33,16 @@ class SerialList {
|
|
|
30
33
|
});
|
|
31
34
|
} else {
|
|
32
35
|
this.adapter.log.warn('Module serialport is not available');
|
|
33
|
-
this.adapter.sendTo(obj.from, obj.command, [{
|
|
36
|
+
this.adapter.sendTo(obj.from, obj.command, [{
|
|
37
|
+
label: 'Not available',
|
|
38
|
+
comName: ''
|
|
39
|
+
}], obj.callback);
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
break;
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
|
-
|
|
41
|
-
listSerial() {
|
|
42
|
-
return serialPortUtils.find([{}])
|
|
43
|
-
.then(ports =>
|
|
44
|
-
ports.map(port => ({comName: port})));
|
|
45
|
-
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
module.exports = SerialList;
|
package/lib/states.js
CHANGED
|
@@ -60,17 +60,17 @@ const unitLookup = {
|
|
|
60
60
|
const timers = {};
|
|
61
61
|
|
|
62
62
|
const states = {
|
|
63
|
-
/* groups: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*/
|
|
63
|
+
/* groups: {
|
|
64
|
+
id: 'groups',
|
|
65
|
+
name: 'Groups',
|
|
66
|
+
icon: undefined,
|
|
67
|
+
role: 'state',
|
|
68
|
+
write: false,
|
|
69
|
+
read: true,
|
|
70
|
+
type: 'string',
|
|
71
|
+
isOption: true,
|
|
72
|
+
},
|
|
73
|
+
*/
|
|
74
74
|
link_quality: {
|
|
75
75
|
id: 'link_quality',
|
|
76
76
|
prop: 'linkquality',
|
|
@@ -1355,7 +1355,7 @@ const states = {
|
|
|
1355
1355
|
write: false,
|
|
1356
1356
|
read: true,
|
|
1357
1357
|
type: 'string',
|
|
1358
|
-
getter: payload => payload.action === 'up_hold' ? 'up' : payload.action === 'down_hold' ? 'down' : payload.action === 'circle_hold' ? 'circle':
|
|
1358
|
+
getter: payload => payload.action === 'up_hold' ? 'up' : (payload.action === 'down_hold' ? 'down' : (payload.action === 'circle_hold' ? 'circle' : undefined)),
|
|
1359
1359
|
},
|
|
1360
1360
|
switch_release: {
|
|
1361
1361
|
id: 'release',
|
|
@@ -1366,7 +1366,7 @@ const states = {
|
|
|
1366
1366
|
write: false,
|
|
1367
1367
|
read: true,
|
|
1368
1368
|
type: 'string',
|
|
1369
|
-
getter: payload => payload.action === 'up_release' ? 'up' : payload.action === 'down_release' ? 'down' : payload.action === 'circle_release' ? 'circle':
|
|
1369
|
+
getter: payload => payload.action === 'up_release' ? 'up' : (payload.action === 'down_release' ? 'down' : (payload.action === 'circle_release' ? 'circle' : undefined)),
|
|
1370
1370
|
},
|
|
1371
1371
|
// new RWL states
|
|
1372
1372
|
rwl_state: {
|
|
@@ -1897,7 +1897,7 @@ const states = {
|
|
|
1897
1897
|
read: true,
|
|
1898
1898
|
type: 'boolean',
|
|
1899
1899
|
isEvent: false,
|
|
1900
|
-
getter: payload => payload.action === 'brightness_up_hold' ? true :
|
|
1900
|
+
getter: payload => payload.action === 'brightness_up_hold' ? true : payload.action === 'brightness_up_release' ? false : undefined,
|
|
1901
1901
|
},
|
|
1902
1902
|
tint404011_brightness_down_click: {
|
|
1903
1903
|
id: 'brightness_down_click',
|
|
@@ -1921,7 +1921,7 @@ const states = {
|
|
|
1921
1921
|
read: true,
|
|
1922
1922
|
type: 'boolean',
|
|
1923
1923
|
isEvent: false,
|
|
1924
|
-
getter: payload => payload.action === 'brightness_down_hold' ? true :
|
|
1924
|
+
getter: payload => payload.action === 'brightness_down_hold' ? true : (payload.action === 'brightness_down_release' ? false : undefined),
|
|
1925
1925
|
},
|
|
1926
1926
|
tint404011_colortemp_read: {
|
|
1927
1927
|
id: 'colortemp',
|
|
@@ -1944,7 +1944,7 @@ const states = {
|
|
|
1944
1944
|
read: true,
|
|
1945
1945
|
type: 'string',
|
|
1946
1946
|
getter: payload => {
|
|
1947
|
-
if(
|
|
1947
|
+
if (payload.action === 'color_wheel') {
|
|
1948
1948
|
const colorval = rgb.cie_to_rgb(payload.action_color.x, payload.action_color.y);
|
|
1949
1949
|
return '#' + utils.decimalToHex(colorval[0]) + utils.decimalToHex(colorval[1]) + utils.decimalToHex(colorval[2]);
|
|
1950
1950
|
} else {
|
|
@@ -1965,7 +1965,7 @@ const states = {
|
|
|
1965
1965
|
isEvent: true,
|
|
1966
1966
|
getter: payload => payload.action === 'scene_3' ? true : undefined,
|
|
1967
1967
|
},
|
|
1968
|
-
tint404011_scene_sunset:
|
|
1968
|
+
tint404011_scene_sunset: {
|
|
1969
1969
|
// starting with warm-white light at 50% brightness then dims after 15 minutes.
|
|
1970
1970
|
// after another 10 minutes the light is turned off
|
|
1971
1971
|
id: 'scene_sunset',
|
|
@@ -2150,8 +2150,8 @@ const states = {
|
|
|
2150
2150
|
icon: undefined,
|
|
2151
2151
|
write: true,
|
|
2152
2152
|
read: true,
|
|
2153
|
-
min:
|
|
2154
|
-
max:
|
|
2153
|
+
min: 0,
|
|
2154
|
+
max: 7,
|
|
2155
2155
|
type: 'number',
|
|
2156
2156
|
},
|
|
2157
2157
|
hvacThermostat_control_sequence_of_operation_write: {
|
|
@@ -2516,26 +2516,26 @@ const states = {
|
|
|
2516
2516
|
type: 'number',
|
|
2517
2517
|
},
|
|
2518
2518
|
danfoss_testrun_day_of_week: {
|
|
2519
|
-
id:
|
|
2519
|
+
id: 'testrun_day_of_week',
|
|
2520
2520
|
name: 'testrun_day_of_week',
|
|
2521
2521
|
prop: 'day_of_week',
|
|
2522
|
-
icon:
|
|
2523
|
-
role:
|
|
2522
|
+
icon: undefined,
|
|
2523
|
+
role: 'state',
|
|
2524
2524
|
write: true,
|
|
2525
|
-
read:
|
|
2526
|
-
type:
|
|
2525
|
+
read: true,
|
|
2526
|
+
type: 'number',
|
|
2527
2527
|
min: 0,
|
|
2528
2528
|
max: 7,
|
|
2529
2529
|
},
|
|
2530
2530
|
danfoss_testrun_hour: {
|
|
2531
|
-
id:
|
|
2531
|
+
id: 'testrun_hour',
|
|
2532
2532
|
name: 'testrun_hour',
|
|
2533
2533
|
prop: 'trigger_time',
|
|
2534
|
-
icon:
|
|
2535
|
-
role:
|
|
2534
|
+
icon: undefined,
|
|
2535
|
+
role: 'state',
|
|
2536
2536
|
write: true,
|
|
2537
|
-
read:
|
|
2538
|
-
type:
|
|
2537
|
+
read: true,
|
|
2538
|
+
type: 'number',
|
|
2539
2539
|
},
|
|
2540
2540
|
danfoss_mounted_direction: {
|
|
2541
2541
|
id: 'thermostat_orientation',
|
|
@@ -2608,12 +2608,11 @@ const states = {
|
|
|
2608
2608
|
role: 'state',
|
|
2609
2609
|
write: true,
|
|
2610
2610
|
read: true,
|
|
2611
|
-
min:
|
|
2612
|
-
max:
|
|
2611
|
+
min: 0,
|
|
2612
|
+
max: 1,
|
|
2613
2613
|
type: 'number',
|
|
2614
2614
|
},
|
|
2615
|
-
thermostat_keypad_lockout:
|
|
2616
|
-
{
|
|
2615
|
+
thermostat_keypad_lockout: {
|
|
2617
2616
|
id: 'keypad_lockout',
|
|
2618
2617
|
name: 'Keypad Lockout',
|
|
2619
2618
|
prop: 'keypad_lockout',
|
|
@@ -4068,7 +4067,7 @@ const states = {
|
|
|
4068
4067
|
read: true,
|
|
4069
4068
|
type: 'boolean',
|
|
4070
4069
|
getter: payload => payload.child_lock === 'LOCKED',
|
|
4071
|
-
setter: value => value ? 'LOCK': 'UNLOCK',
|
|
4070
|
+
setter: value => value ? 'LOCK' : 'UNLOCK',
|
|
4072
4071
|
},
|
|
4073
4072
|
tuya_trv_window_detected: {
|
|
4074
4073
|
id: 'window_detected',
|
|
@@ -5397,7 +5396,7 @@ const states = {
|
|
|
5397
5396
|
read: true,
|
|
5398
5397
|
type: 'string',
|
|
5399
5398
|
getter: payload => {
|
|
5400
|
-
if(
|
|
5399
|
+
if (payload.action === 'color_move') {
|
|
5401
5400
|
const colorval = rgb.cie_to_rgb(payload.action_color.x, payload.action_color.y);
|
|
5402
5401
|
return `#${utils.decimalToHex(colorval[0])}${utils.decimalToHex(colorval[1])}${utils.decimalToHex(colorval[2])}`;
|
|
5403
5402
|
} else {
|
|
@@ -5608,7 +5607,7 @@ const states = {
|
|
|
5608
5607
|
write: false,
|
|
5609
5608
|
read: true,
|
|
5610
5609
|
type: 'boolean',
|
|
5611
|
-
getter: payload => payload.action === 'on_1' ? false : (payload.action === 'off_1'
|
|
5610
|
+
getter: payload => payload.action === 'on_1' ? false : (payload.action === 'off_1' ? true : undefined),
|
|
5612
5611
|
isEvent: true,
|
|
5613
5612
|
},
|
|
5614
5613
|
rob_2_click: {
|
|
@@ -5620,7 +5619,7 @@ const states = {
|
|
|
5620
5619
|
write: false,
|
|
5621
5620
|
read: true,
|
|
5622
5621
|
type: 'boolean',
|
|
5623
|
-
getter: payload => payload.action === 'on_2' ? false : (payload.action === 'off_2'
|
|
5622
|
+
getter: payload => payload.action === 'on_2' ? false : (payload.action === 'off_2' ? true : undefined),
|
|
5624
5623
|
isEvent: true,
|
|
5625
5624
|
},
|
|
5626
5625
|
rob_3_click: {
|
|
@@ -5632,7 +5631,7 @@ const states = {
|
|
|
5632
5631
|
write: false,
|
|
5633
5632
|
read: true,
|
|
5634
5633
|
type: 'boolean',
|
|
5635
|
-
getter: payload => payload.action === 'on_3' ? false : (payload.action === 'off_3'
|
|
5634
|
+
getter: payload => payload.action === 'on_3' ? false : (payload.action === 'off_3' ? true : undefined),
|
|
5636
5635
|
isEvent: true,
|
|
5637
5636
|
},
|
|
5638
5637
|
rob_4_click: {
|
|
@@ -5644,7 +5643,7 @@ const states = {
|
|
|
5644
5643
|
write: false,
|
|
5645
5644
|
read: true,
|
|
5646
5645
|
type: 'boolean',
|
|
5647
|
-
getter: payload => payload.action === 'on_4' ? false : (payload.action === 'off_4'
|
|
5646
|
+
getter: payload => payload.action === 'on_4' ? false : (payload.action === 'off_4' ? true : undefined),
|
|
5648
5647
|
isEvent: true,
|
|
5649
5648
|
},
|
|
5650
5649
|
|
|
@@ -5846,7 +5845,7 @@ const states = {
|
|
|
5846
5845
|
unit: '',
|
|
5847
5846
|
setter: (value, options) => {
|
|
5848
5847
|
const effectjson = {
|
|
5849
|
-
colors:[{r: 255, g: 0, b: 0}, {r: 0, g: 255, b: 0}, {r: 0, g: 0, b: 255}],
|
|
5848
|
+
colors: [{r: 255, g: 0, b: 0}, {r: 0, g: 255, b: 0}, {r: 0, g: 0, b: 255}],
|
|
5850
5849
|
speed: 10,
|
|
5851
5850
|
effect: 'snake',
|
|
5852
5851
|
};
|
|
@@ -5982,7 +5981,7 @@ const states = {
|
|
|
5982
5981
|
read: true,
|
|
5983
5982
|
getter: payload => {
|
|
5984
5983
|
const rv = {};
|
|
5985
|
-
const id = typeof
|
|
5984
|
+
const id = typeof payload.device_l1 === 'string' ? payload.device_l1.replace(/[-. ]/g, '') : 'unset';
|
|
5986
5985
|
let unit = undefined;
|
|
5987
5986
|
let measurement = undefined;
|
|
5988
5987
|
for (const item in payload) {
|
|
@@ -6020,7 +6019,7 @@ const states = {
|
|
|
6020
6019
|
read: true,
|
|
6021
6020
|
getter: payload => {
|
|
6022
6021
|
const rv = {};
|
|
6023
|
-
const id = typeof
|
|
6022
|
+
const id = typeof payload.device_l2 === 'string' ? payload.device_l2.replace(/[-. ]/g, '') : 'unset';
|
|
6024
6023
|
let unit = undefined;
|
|
6025
6024
|
let measurement = undefined;
|
|
6026
6025
|
for (const item in payload) {
|
|
@@ -6058,7 +6057,7 @@ const states = {
|
|
|
6058
6057
|
read: true,
|
|
6059
6058
|
getter: payload => {
|
|
6060
6059
|
const rv = {};
|
|
6061
|
-
const id = typeof
|
|
6060
|
+
const id = typeof payload.device_l3 === 'string' ? payload.device_l3.replace(/[-. ]/g, '') : 'unset';
|
|
6062
6061
|
let unit = undefined;
|
|
6063
6062
|
let measurement = undefined;
|
|
6064
6063
|
for (const item in payload) {
|
|
@@ -6078,7 +6077,7 @@ const states = {
|
|
|
6078
6077
|
rv.stateid = id;
|
|
6079
6078
|
}
|
|
6080
6079
|
rv.value = payload.l3;
|
|
6081
|
-
rv.name = measurement ? `${measurement} 0x${id}
|
|
6080
|
+
rv.name = measurement ? `${measurement} 0x${id}` : `0x${id}`;
|
|
6082
6081
|
rv.unit = unit;
|
|
6083
6082
|
rv.role = measurement;
|
|
6084
6083
|
|
|
@@ -6096,7 +6095,7 @@ const states = {
|
|
|
6096
6095
|
read: true,
|
|
6097
6096
|
getter: payload => {
|
|
6098
6097
|
const rv = {};
|
|
6099
|
-
const id = typeof
|
|
6098
|
+
const id = typeof payload.device_l4 === 'string' ? payload.device_l4.replace(/[-. ]/g, '') : 'unset';
|
|
6100
6099
|
let unit = undefined;
|
|
6101
6100
|
let measurement = undefined;
|
|
6102
6101
|
for (const item in payload) {
|
|
@@ -6134,7 +6133,7 @@ const states = {
|
|
|
6134
6133
|
read: true,
|
|
6135
6134
|
getter: payload => {
|
|
6136
6135
|
const rv = {};
|
|
6137
|
-
const id = typeof
|
|
6136
|
+
const id = typeof payload.device_l5 === 'string' ? payload.device_l5.replace(/[-. ]/g, '') : 'unset';
|
|
6138
6137
|
let unit = undefined;
|
|
6139
6138
|
let measurement = undefined;
|
|
6140
6139
|
for (const item in payload) {
|
|
@@ -6172,7 +6171,7 @@ const states = {
|
|
|
6172
6171
|
read: true,
|
|
6173
6172
|
getter: payload => {
|
|
6174
6173
|
const rv = {};
|
|
6175
|
-
const id = typeof
|
|
6174
|
+
const id = typeof payload.device_l6 === 'string' ? payload.device_l6.replace(/[-. ]/g, '') : 'unset';
|
|
6176
6175
|
let unit = undefined;
|
|
6177
6176
|
let measurement = undefined;
|
|
6178
6177
|
for (const item in payload) {
|
|
@@ -6210,7 +6209,7 @@ const states = {
|
|
|
6210
6209
|
read: true,
|
|
6211
6210
|
getter: payload => {
|
|
6212
6211
|
const rv = {};
|
|
6213
|
-
const id = typeof
|
|
6212
|
+
const id = typeof payload.device_l7 === 'string' ? payload.device_l7.replace(/[-. ]/g, '') : 'unset';
|
|
6214
6213
|
let unit = undefined;
|
|
6215
6214
|
let measurement = undefined;
|
|
6216
6215
|
for (const item in payload) {
|
|
@@ -6248,7 +6247,7 @@ const states = {
|
|
|
6248
6247
|
read: true,
|
|
6249
6248
|
getter: payload => {
|
|
6250
6249
|
const rv = {};
|
|
6251
|
-
const id = typeof
|
|
6250
|
+
const id = typeof payload.device_l8 === 'string' ? payload.device_l8.replace(/[-. ]/g, '') : 'unset';
|
|
6252
6251
|
let unit = undefined;
|
|
6253
6252
|
let measurement = undefined;
|
|
6254
6253
|
for (const item in payload) {
|