iobroker.zigbee 1.8.1 → 1.8.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/.eslintignore +2 -0
- package/.eslintrc.json +37 -0
- package/.github/FUNDING.yml +3 -0
- package/.github/auto-merge.yml +17 -0
- package/.github/dependabot.yml +24 -0
- package/.github/stale.yml +13 -0
- package/.github/workflows/codeql.yml +41 -0
- package/.github/workflows/dependabot-automerge.yml +22 -0
- package/.github/workflows/test-and-release.yml +149 -0
- package/.releaseconfig.json +3 -0
- package/.travis/wiki.sh +28 -0
- package/.travis.yml +41 -0
- package/README.md +31 -8
- package/admin/admin.js +466 -482
- package/admin/i18n/de/translations.json +2 -2
- package/admin/index_m.html +1 -1
- package/admin/tab_m.html +3 -44
- package/admin/words.js +2 -2
- package/gulpfile.js +464 -0
- package/io-package.json +18 -25
- package/lib/backup.js +2 -2
- package/lib/binding.js +37 -32
- package/lib/colors.js +158 -163
- package/lib/commands.js +90 -99
- package/lib/developer.js +12 -9
- package/lib/devices.js +179 -169
- package/lib/exclude.js +36 -30
- package/lib/exposes.js +139 -163
- package/lib/groups.js +83 -81
- package/lib/json.js +6 -5
- package/lib/networkmap.js +3 -2
- package/lib/ota.js +18 -34
- package/lib/rgb.js +72 -114
- package/lib/seriallist.js +20 -25
- package/lib/states.js +526 -511
- package/lib/statescontroller.js +183 -206
- package/lib/utils.js +23 -24
- package/lib/zbBaseExtension.js +4 -4
- package/lib/zbDelayedAction.js +13 -5
- package/lib/zbDeviceAvailability.js +65 -69
- package/lib/zbDeviceConfigure.js +21 -9
- package/lib/zbDeviceEvent.js +4 -3
- package/lib/zigbeecontroller.js +103 -109
- package/main.js +147 -163
- package/package.json +15 -29
- package/test/integration.js +5 -0
- package/test/mocha.custom.opts +2 -0
- package/test/mocha.setup.js +14 -0
- package/test/package.js +5 -0
- package/test/unit.js +5 -0
- package/docs/de/img/CC2531.png +0 -0
- package/docs/de/img/CC2538_CC2592_PA.PNG +0 -0
- package/docs/de/img/CC2591.png +0 -0
- package/docs/de/img/boards.jpg +0 -0
- package/docs/de/img/cc26x2r.PNG +0 -0
- package/docs/de/img/results.jpg +0 -0
- package/docs/de/img/sku_429478_2.png +0 -0
- package/docs/de/img/sku_429601_2.png +0 -0
- package/docs/de/readme.md +0 -27
- package/docs/en/img/CC2531.png +0 -0
- package/docs/en/img/CC2591.png +0 -0
- package/docs/en/img/deconz.png +0 -0
- package/docs/en/img/sku_429478_2.png +0 -0
- package/docs/en/img/sku_429601_2.png +0 -0
- package/docs/en/readme.md +0 -30
- package/docs/flashing_via_arduino_(en).md +0 -110
- package/docs/ru/img/CC2531.png +0 -0
- package/docs/ru/img/CC2591.png +0 -0
- package/docs/ru/img/sku_429478_2.png +0 -0
- package/docs/ru/img/sku_429601_2.png +0 -0
- package/docs/ru/readme.md +0 -28
- package/docs/tutorial/CC2530_20190425.zip +0 -0
- package/docs/tutorial/CC2530_CC2591_20190515.zip +0 -0
- package/docs/tutorial/CC2530_CC2592_20190515.zip +0 -0
- package/docs/tutorial/CC2531_20190425.zip +0 -0
- package/docs/tutorial/adm5_1.PNG +0 -0
- package/docs/tutorial/adm5_2.PNG +0 -0
- package/docs/tutorial/cat.PNG +0 -0
- package/docs/tutorial/groups-1.png +0 -0
- package/docs/tutorial/groups-2.png +0 -0
- package/docs/tutorial/inst.PNG +0 -0
- package/docs/tutorial/reflash-finish.PNG +0 -0
- package/docs/tutorial/reflash-step0.png +0 -0
- package/docs/tutorial/reflash-step1.PNG +0 -0
- package/docs/tutorial/reflash-step2.PNG +0 -0
- package/docs/tutorial/settings.png +0 -0
- package/docs/tutorial/tab-dev-1.png +0 -0
- package/docs/tutorial/zigbee.png +0 -0
- package/docs/tutorial/zigbee15.png +0 -0
package/lib/devices.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const states = require('
|
|
4
|
-
const utils = require('
|
|
5
|
-
const rgb = require('
|
|
6
|
-
const applyExposes = require('
|
|
3
|
+
const states = require(__dirname + '/states.js').states;
|
|
4
|
+
const utils = require(__dirname + '/utils.js');
|
|
5
|
+
const rgb = require(__dirname + '/rgb.js');
|
|
6
|
+
const applyExposes = require(__dirname + '/exposes.js').applyExposes;
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// return list of changing states when incoming state is changed
|
|
@@ -23,7 +23,7 @@ const comb = {
|
|
|
23
23
|
// index: -1, // before main change
|
|
24
24
|
// timeout: 0,
|
|
25
25
|
index: 1, // after main change
|
|
26
|
-
timeout,
|
|
26
|
+
timeout: timeout,
|
|
27
27
|
}];
|
|
28
28
|
}
|
|
29
29
|
} else if (disableQueue || options.state) {
|
|
@@ -32,7 +32,7 @@ const comb = {
|
|
|
32
32
|
stateDesc: states.state,
|
|
33
33
|
value: false,
|
|
34
34
|
index: 1, // after main change
|
|
35
|
-
timeout,
|
|
35
|
+
timeout: timeout,
|
|
36
36
|
}];
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -42,21 +42,20 @@ const comb = {
|
|
|
42
42
|
if (state.id === states.effect_json.id) {
|
|
43
43
|
const effectjson = {};
|
|
44
44
|
try {
|
|
45
|
-
if (options.hasOwnProperty('effect_speed'))
|
|
45
|
+
if (options.hasOwnProperty('effect_speed'))
|
|
46
46
|
effectjson.speed = options.effect_speed;
|
|
47
|
-
|
|
48
|
-
if (options.hasOwnProperty('effect_type')) {
|
|
47
|
+
if (options.hasOwnProperty('effect_type'))
|
|
49
48
|
effectjson.effect = options.effect_type;
|
|
50
|
-
|
|
51
|
-
if (options.hasOwnProperty('effect_colors'))
|
|
49
|
+
|
|
50
|
+
if (options.hasOwnProperty('effect_colors'))
|
|
52
51
|
effectjson.colors = rgb.colorsArrayFromString(options.effect_colors);
|
|
53
|
-
}
|
|
54
52
|
// effectjson = JSON.parse(value);
|
|
55
|
-
}
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
56
55
|
const effectjson = {
|
|
57
|
-
colors:
|
|
58
|
-
speed:
|
|
59
|
-
effect:
|
|
56
|
+
colors:[{r: 255,g: 0,b: 0},{r: 0,g: 255,b: 0},{r: 0,g: 0,b: 255}],
|
|
57
|
+
speed:10,
|
|
58
|
+
effect:'glow',
|
|
60
59
|
};
|
|
61
60
|
if (options.hasOwnProperty('effect_speed'))
|
|
62
61
|
effectjson.speed = options.effect_speed;
|
|
@@ -119,11 +118,11 @@ const sync = {
|
|
|
119
118
|
},
|
|
120
119
|
};
|
|
121
120
|
|
|
122
|
-
const lightStatesWithColortemp = [states.state, states.brightness, states.colortemp,
|
|
123
|
-
const lightStatesWithColor = [states.state, states.brightness, states.colortemp, states.color,
|
|
124
|
-
const lightStatesWithColor_hue = [states.state, states.brightness, states.colortemp, states.color,
|
|
121
|
+
const lightStatesWithColortemp = [states.state, states.brightness, states.colortemp,states.brightness_move, states.colortemp_move, states.transition_time];
|
|
122
|
+
const lightStatesWithColor = [states.state, states.brightness, states.colortemp, states.color,states.brightness_move, states.colortemp_move, states.transition_time];
|
|
123
|
+
const lightStatesWithColor_hue = [states.state, states.brightness, states.colortemp, states.color,states.brightness_move, states.colortemp_move, states.hue_move, states.transition_time, states.effect_type_hue];
|
|
125
124
|
const lightStatesWithColorNoTemp = [states.state, states.brightness, states.color, states.brightness_move, states.transition_time];
|
|
126
|
-
const lightStates = [states.state, states.brightness, states.brightness_move,
|
|
125
|
+
const lightStates = [states.state, states.brightness, states.brightness_move, states.transition_time];
|
|
127
126
|
|
|
128
127
|
const gl_lightStatesWithColor = [states.gl_state, states.gl_brightness, states.gl_colortemp, states.gl_color, states.transition_time];
|
|
129
128
|
const gl_white_channel = [states.white_brightness, states.white_state, states.white_colortemp];
|
|
@@ -132,30 +131,29 @@ const freepad_states = [states.battery];
|
|
|
132
131
|
|
|
133
132
|
function getKey(object, value) {
|
|
134
133
|
for (const key in object) {
|
|
135
|
-
if (object[key]
|
|
136
|
-
return key;
|
|
137
|
-
}
|
|
134
|
+
if (object[key]==value) return key;
|
|
138
135
|
}
|
|
139
136
|
}
|
|
140
137
|
|
|
141
138
|
const unitLookup = {
|
|
142
139
|
'temperature': 'C',
|
|
143
|
-
'humidity':
|
|
144
|
-
'altitude':
|
|
145
|
-
'pressure':
|
|
146
|
-
'quality':
|
|
147
|
-
'particle_size':
|
|
148
|
-
'voltage':
|
|
149
|
-
'current':
|
|
150
|
-
'energy':
|
|
151
|
-
'power':
|
|
152
|
-
'frequency':
|
|
153
|
-
'power_factor':
|
|
154
|
-
'illuminance_lux':
|
|
140
|
+
'humidity':'%',
|
|
141
|
+
'altitude':'m',
|
|
142
|
+
'pressure':'Pa',
|
|
143
|
+
'quality':'ppm',
|
|
144
|
+
'particle_size':'psize',
|
|
145
|
+
'voltage':'V',
|
|
146
|
+
'current':'A',
|
|
147
|
+
'energy':'Wh',
|
|
148
|
+
'power':'W',
|
|
149
|
+
'frequency':'Hz',
|
|
150
|
+
'power_factor':'pf',
|
|
151
|
+
'illuminance_lux':'lx',
|
|
152
|
+
|
|
155
153
|
};
|
|
156
154
|
|
|
157
155
|
const generator = {
|
|
158
|
-
gledopto: entity => {
|
|
156
|
+
gledopto: (entity) => {
|
|
159
157
|
if (entity.mapped.model === 'GL-C-008-2ID') {
|
|
160
158
|
return gl_lightStatesWithColor.concat(gl8_white_channel);
|
|
161
159
|
} else if (entity.mapped.model === 'GL-C-007-2ID') {
|
|
@@ -164,76 +162,87 @@ const generator = {
|
|
|
164
162
|
return lightStatesWithColor;
|
|
165
163
|
}
|
|
166
164
|
},
|
|
167
|
-
freepad: entity => {
|
|
165
|
+
freepad: (entity) => {
|
|
168
166
|
const freepad_st = [];
|
|
169
167
|
const ecount = entity.device.endpoints.length;
|
|
170
168
|
for (let i = 1; i <= ecount; i++) {
|
|
171
|
-
freepad_st.push(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
169
|
+
freepad_st.push(
|
|
170
|
+
{
|
|
171
|
+
id: `btn${i}_single`,
|
|
172
|
+
prop: 'action',
|
|
173
|
+
name: `Button ${i} click event`,
|
|
174
|
+
icon: undefined,
|
|
175
|
+
role: 'button',
|
|
176
|
+
write: false,
|
|
177
|
+
read: true,
|
|
178
|
+
type: 'boolean',
|
|
179
|
+
isEvent: true,
|
|
180
|
+
getter: payload => (payload.action === `button_${i}_single`) ? true : undefined,
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
freepad_st.push(
|
|
184
|
+
{
|
|
185
|
+
id: `btn${i}_double`,
|
|
186
|
+
prop: 'action',
|
|
187
|
+
name: `Button ${i} double click event`,
|
|
188
|
+
icon: undefined,
|
|
189
|
+
role: 'button',
|
|
190
|
+
write: false,
|
|
191
|
+
read: true,
|
|
192
|
+
type: 'boolean',
|
|
193
|
+
isEvent: true,
|
|
194
|
+
getter: payload => (payload.action === `button_${i}_double`) ? true : undefined,
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
freepad_st.push(
|
|
198
|
+
{
|
|
199
|
+
id: `btn${i}_hold`,
|
|
200
|
+
prop: 'action',
|
|
201
|
+
name: `Button ${i} hold`,
|
|
202
|
+
icon: undefined,
|
|
203
|
+
role: 'button',
|
|
204
|
+
write: false,
|
|
205
|
+
read: true,
|
|
206
|
+
type: 'boolean',
|
|
207
|
+
getter: payload => (payload.action === `button_${i}_hold`) ? true : (payload.action === `button_${i}_release`) ? false : undefined,
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
freepad_st.push(
|
|
211
|
+
{
|
|
212
|
+
id: `btn${i}_triple`,
|
|
213
|
+
prop: 'action',
|
|
214
|
+
name: `Button ${i} triple click event`,
|
|
215
|
+
icon: undefined,
|
|
216
|
+
role: 'button',
|
|
217
|
+
write: false,
|
|
218
|
+
read: true,
|
|
219
|
+
type: 'boolean',
|
|
220
|
+
isEvent: true,
|
|
221
|
+
getter: payload => (payload.action === `button_${i}_triple`) ? true : undefined,
|
|
222
|
+
lazy: true,
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
freepad_st.push(
|
|
226
|
+
{
|
|
227
|
+
id: `btn${i}_quadruple`,
|
|
228
|
+
prop: 'action',
|
|
229
|
+
name: `Button ${i} quadruple click event`,
|
|
230
|
+
icon: undefined,
|
|
231
|
+
role: 'button',
|
|
232
|
+
write: false,
|
|
233
|
+
read: true,
|
|
234
|
+
type: 'boolean',
|
|
235
|
+
isEvent: true,
|
|
236
|
+
getter: payload => (payload.action === `button_${i}_quadruple`) ? true : undefined,
|
|
237
|
+
lazy: true,
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
|
|
232
241
|
}
|
|
233
242
|
return freepad_states.concat(freepad_st);
|
|
234
243
|
},
|
|
235
|
-
ptvo_switch_channels: entity =>
|
|
236
|
-
const devstates = [states.ptvo_trigger,
|
|
244
|
+
ptvo_switch_channels: (entity) =>{
|
|
245
|
+
const devstates = [states.ptvo_trigger,states.ptvo_interval];
|
|
237
246
|
for (const endpoint of entity.device.endpoints) {
|
|
238
247
|
const epID = endpoint.ID;
|
|
239
248
|
const epName = getKey(entity.mapped.endpoint(entity.device), epID);
|
|
@@ -259,10 +268,8 @@ const generator = {
|
|
|
259
268
|
// l7:l7=143voltage_l7=143
|
|
260
269
|
|
|
261
270
|
if (payload.hasOwnProperty(`device_${epName}`)) {
|
|
262
|
-
id = (typeof
|
|
263
|
-
} else if (payload.hasOwnProperty(`voltage_${epName}`))
|
|
264
|
-
id = 'voltage';
|
|
265
|
-
}
|
|
271
|
+
id = (typeof(payload[`device_${epName}`]) == 'string' ? payload[`device_${epName}`].replace(/[-. ]/g, ''):'unset');
|
|
272
|
+
} else if (payload.hasOwnProperty(`voltage_${epName}`)) id = 'voltage';
|
|
266
273
|
let unit = undefined;
|
|
267
274
|
let measurement = undefined;
|
|
268
275
|
for (const item in payload) {
|
|
@@ -276,13 +283,12 @@ const generator = {
|
|
|
276
283
|
}
|
|
277
284
|
}
|
|
278
285
|
}
|
|
279
|
-
if (measurement && id
|
|
280
|
-
rv.stateid =
|
|
281
|
-
|
|
286
|
+
if (measurement && id != 'voltage')
|
|
287
|
+
rv.stateid = id + '_'+measurement;
|
|
288
|
+
else
|
|
282
289
|
rv.stateid = id;
|
|
283
|
-
}
|
|
284
290
|
rv.value = payload[epName];
|
|
285
|
-
rv.name = measurement
|
|
291
|
+
rv.name = (measurement? measurement + ' 0x'+ id: '0x'+id);
|
|
286
292
|
rv.unit = unit;
|
|
287
293
|
rv.role = measurement;
|
|
288
294
|
|
|
@@ -300,8 +306,8 @@ const generator = {
|
|
|
300
306
|
write: true,
|
|
301
307
|
read: true,
|
|
302
308
|
type: 'boolean',
|
|
303
|
-
getter: payload => payload[`state_${epName}`] === 'ON',
|
|
304
|
-
setter: value => value ? 'ON' : 'OFF',
|
|
309
|
+
getter: payload => (payload[`state_${epName}`] === 'ON'),
|
|
310
|
+
setter: (value) => (value) ? 'ON' : 'OFF',
|
|
305
311
|
epname: epName,
|
|
306
312
|
setattr: 'state',
|
|
307
313
|
});
|
|
@@ -317,7 +323,7 @@ const generator = {
|
|
|
317
323
|
read: true,
|
|
318
324
|
type: 'boolean',
|
|
319
325
|
isEvent: true,
|
|
320
|
-
getter: payload => payload.action === `single_${epName}` ? true : undefined,
|
|
326
|
+
getter: payload => (payload.action === `single_${epName}`) ? true : undefined,
|
|
321
327
|
});
|
|
322
328
|
devstates.push({
|
|
323
329
|
id: `channel_${epID}.double`,
|
|
@@ -329,7 +335,7 @@ const generator = {
|
|
|
329
335
|
read: true,
|
|
330
336
|
type: 'boolean',
|
|
331
337
|
isEvent: true,
|
|
332
|
-
getter: payload => payload.action === `double_${epName}` ? true : undefined,
|
|
338
|
+
getter: payload => (payload.action === `double_${epName}`) ? true : undefined,
|
|
333
339
|
});
|
|
334
340
|
devstates.push({
|
|
335
341
|
id: `channel_${epID}.tripple`,
|
|
@@ -341,7 +347,7 @@ const generator = {
|
|
|
341
347
|
read: true,
|
|
342
348
|
type: 'boolean',
|
|
343
349
|
isEvent: true,
|
|
344
|
-
getter: payload => payload.action === `tripple_${epName}` ? true : undefined,
|
|
350
|
+
getter: payload => (payload.action === `tripple_${epName}`) ? true : undefined,
|
|
345
351
|
});
|
|
346
352
|
}
|
|
347
353
|
if (endpoint.supportsOutputCluster('genLevelCtrl')) {
|
|
@@ -356,8 +362,12 @@ const generator = {
|
|
|
356
362
|
unit: '',
|
|
357
363
|
min: 0,
|
|
358
364
|
max: 100,
|
|
359
|
-
getter: payload =>
|
|
360
|
-
|
|
365
|
+
getter: payload => {
|
|
366
|
+
return utils.bulbLevelToAdapterLevel(payload[`brightness_${epName}`]);
|
|
367
|
+
},
|
|
368
|
+
setter: (value) => {
|
|
369
|
+
return utils.adapterLevelToBulbLevel(value);
|
|
370
|
+
},
|
|
361
371
|
epname: epName,
|
|
362
372
|
setattr: 'brightness',
|
|
363
373
|
});
|
|
@@ -376,7 +386,9 @@ const generator = {
|
|
|
376
386
|
getter: payload => { //l3=0 brightness_l3=0
|
|
377
387
|
return payload[`${epName}`]; //return payload[`brightness_${epName}`];
|
|
378
388
|
},
|
|
379
|
-
setter: value =>
|
|
389
|
+
setter: (value) => {
|
|
390
|
+
return value;
|
|
391
|
+
},
|
|
380
392
|
epname: epName
|
|
381
393
|
});
|
|
382
394
|
}
|
|
@@ -426,15 +438,9 @@ const generator = {
|
|
|
426
438
|
read: true,
|
|
427
439
|
type: 'boolean',
|
|
428
440
|
getter: payload => {
|
|
429
|
-
if ((payload.action_group % ecount) != (epidx % ecount))
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (payload.action === 'brightness_move_up') {
|
|
433
|
-
return true;
|
|
434
|
-
}
|
|
435
|
-
if (payload.action === 'brightness_stop') {
|
|
436
|
-
return false;
|
|
437
|
-
}
|
|
441
|
+
if ((payload.action_group % ecount) != (epidx % ecount)) return undefined;
|
|
442
|
+
if (payload.action == 'brightness_move_up') return true;
|
|
443
|
+
if (payload.action == 'brightness_stop') return false;
|
|
438
444
|
return undefined;
|
|
439
445
|
},
|
|
440
446
|
});
|
|
@@ -448,15 +454,9 @@ const generator = {
|
|
|
448
454
|
read: true,
|
|
449
455
|
type: 'boolean',
|
|
450
456
|
getter: payload => {
|
|
451
|
-
if ((payload.action_group % ecount) != (epidx % ecount))
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
if (payload.action === 'brightness_move_down') {
|
|
455
|
-
return true;
|
|
456
|
-
}
|
|
457
|
-
if (payload.action === 'brightness_stop') {
|
|
458
|
-
return false;
|
|
459
|
-
}
|
|
457
|
+
if ((payload.action_group % ecount) != (epidx % ecount)) return undefined;
|
|
458
|
+
if (payload.action == 'brightness_move_down') return true;
|
|
459
|
+
if (payload.action == 'brightness_stop') return false;
|
|
460
460
|
return undefined;
|
|
461
461
|
},
|
|
462
462
|
});
|
|
@@ -502,8 +502,8 @@ const generator = {
|
|
|
502
502
|
write: true,
|
|
503
503
|
read: true,
|
|
504
504
|
type: 'boolean',
|
|
505
|
-
getter: payload => payload[`state_${epName}`] === 'ON',
|
|
506
|
-
setter: value => value ? 'ON' : 'OFF',
|
|
505
|
+
getter: payload => (payload[`state_${epName}`] === 'ON'),
|
|
506
|
+
setter: (value) => (value) ? 'ON' : 'OFF',
|
|
507
507
|
epname: epName,
|
|
508
508
|
setattr: 'state',
|
|
509
509
|
});
|
|
@@ -519,7 +519,7 @@ const generator = {
|
|
|
519
519
|
read: true,
|
|
520
520
|
type: 'boolean',
|
|
521
521
|
isEvent: true,
|
|
522
|
-
getter: payload => payload.action === `single_${epName}` ? true : undefined,
|
|
522
|
+
getter: payload => (payload.action === `single_${epName}`) ? true : undefined,
|
|
523
523
|
});
|
|
524
524
|
devstates.push({
|
|
525
525
|
id: `btn_${epID}_double`,
|
|
@@ -531,7 +531,7 @@ const generator = {
|
|
|
531
531
|
read: true,
|
|
532
532
|
type: 'boolean',
|
|
533
533
|
isEvent: true,
|
|
534
|
-
getter: payload => payload.action === `double_${epName}` ? true : undefined,
|
|
534
|
+
getter: payload => (payload.action === `double_${epName}`) ? true : undefined,
|
|
535
535
|
});
|
|
536
536
|
devstates.push({
|
|
537
537
|
id: `btn_${epID}_tripple`,
|
|
@@ -543,7 +543,7 @@ const generator = {
|
|
|
543
543
|
read: true,
|
|
544
544
|
type: 'boolean',
|
|
545
545
|
isEvent: true,
|
|
546
|
-
getter: payload => payload.action === `tripple_${epName}` ? true : undefined,
|
|
546
|
+
getter: payload => (payload.action === `tripple_${epName}`) ? true : undefined,
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
if (endpoint.supportsOutputCluster('genLevelCtrl')) {
|
|
@@ -558,8 +558,12 @@ const generator = {
|
|
|
558
558
|
unit: '',
|
|
559
559
|
min: 0,
|
|
560
560
|
max: 100,
|
|
561
|
-
getter: payload =>
|
|
562
|
-
|
|
561
|
+
getter: payload => {
|
|
562
|
+
return utils.bulbLevelToAdapterLevel(payload[`brightness_${epName}`]);
|
|
563
|
+
},
|
|
564
|
+
setter: (value) => {
|
|
565
|
+
return utils.adapterLevelToBulbLevel(value);
|
|
566
|
+
},
|
|
563
567
|
epname: epName,
|
|
564
568
|
setattr: 'brightness',
|
|
565
569
|
});
|
|
@@ -569,13 +573,13 @@ const generator = {
|
|
|
569
573
|
},
|
|
570
574
|
};
|
|
571
575
|
|
|
572
|
-
function states_with_epname(entity, states) {
|
|
576
|
+
function states_with_epname (entity, states) {
|
|
573
577
|
const devstates = [];
|
|
574
578
|
for (const endpoint of entity.device.endpoints) {
|
|
575
579
|
const epID = endpoint.ID;
|
|
576
580
|
const epName = getKey(entity.mapped.endpoint(entity.device), epID);
|
|
577
581
|
for (const state of states) {
|
|
578
|
-
const newState = {...state};
|
|
582
|
+
const newState = { ...state };
|
|
579
583
|
newState.id = `${newState.id}_${epName}`;
|
|
580
584
|
if (newState.name) newState.name = `${newState.name} (${epName})`;
|
|
581
585
|
if (newState.prop) newState.prop = `${newState.prop}_${epName}`;
|
|
@@ -622,7 +626,7 @@ const devices = [
|
|
|
622
626
|
],
|
|
623
627
|
},
|
|
624
628
|
{
|
|
625
|
-
models: ['WXKG03LM',
|
|
629
|
+
models: ['WXKG03LM','WXKG03LM_rev2'],
|
|
626
630
|
icon: 'img/86sw1.png',
|
|
627
631
|
states: [
|
|
628
632
|
states.click, states.double_click, states.voltage, states.battery,
|
|
@@ -638,7 +642,7 @@ const devices = [
|
|
|
638
642
|
],
|
|
639
643
|
},
|
|
640
644
|
{
|
|
641
|
-
models: ['WXKG02LM',
|
|
645
|
+
models: ['WXKG02LM','WXKG02LM_rev2'],
|
|
642
646
|
icon: 'img/86sw2.png',
|
|
643
647
|
states: [
|
|
644
648
|
states.left_click, states.right_click, states.both_click,
|
|
@@ -820,7 +824,7 @@ const devices = [
|
|
|
820
824
|
models: ['ZNCLDJ11LM'],
|
|
821
825
|
icon: 'img/aqara_curtain.png',
|
|
822
826
|
states: [states.curtain_position, states.curtain_running, states.curtain_stop, states.curtain_xiaomi_reverse_direction,
|
|
823
|
-
|
|
827
|
+
states.curtain_xiaomi_reset_limits, states.curtain_xiaomi_hand_open],
|
|
824
828
|
},
|
|
825
829
|
{
|
|
826
830
|
models: ['WXCJKG11LM'],
|
|
@@ -995,7 +999,7 @@ const devices = [
|
|
|
995
999
|
states: [states.occupancy, states.temperature, states.temp_calibration],
|
|
996
1000
|
},
|
|
997
1001
|
{
|
|
998
|
-
models: ['595UGR22',
|
|
1002
|
+
models: ['595UGR22','4058075181472'],
|
|
999
1003
|
icon: 'img/FLOALT.panel.WS.png',
|
|
1000
1004
|
states: lightStatesWithColortemp,
|
|
1001
1005
|
syncStates: [sync.brightness],
|
|
@@ -1168,7 +1172,7 @@ const devices = [
|
|
|
1168
1172
|
syncStates: [sync.brightness],
|
|
1169
1173
|
},
|
|
1170
1174
|
{
|
|
1171
|
-
models: ['5055131P7',
|
|
1175
|
+
models: ['5055131P7','5055148P7'],
|
|
1172
1176
|
icon: 'img/philips_hue_centura_square.png',
|
|
1173
1177
|
states: lightStatesWithColor_hue,
|
|
1174
1178
|
syncStates: [sync.brightness],
|
|
@@ -1490,7 +1494,7 @@ const devices = [
|
|
|
1490
1494
|
{
|
|
1491
1495
|
models: ['E1757', 'E1926'],
|
|
1492
1496
|
states: [states.battery, states.blind_position, states.blind_open, states.blind_close, states.blind_stop],
|
|
1493
|
-
icon:
|
|
1497
|
+
icon: 'img/Ikea_fyrtur.png',
|
|
1494
1498
|
},
|
|
1495
1499
|
{
|
|
1496
1500
|
models: ['ICPSHC24-10EU-IL-1', 'ICPSHC24-30EU-IL-1'],
|
|
@@ -1512,7 +1516,7 @@ const devices = [
|
|
|
1512
1516
|
{
|
|
1513
1517
|
models: ['E1744'],
|
|
1514
1518
|
icon: 'img/ikea_SYMFONISK_Sound_Controller.png',
|
|
1515
|
-
states: [states.button_action_skip_back, states.button_action_skip_forward,
|
|
1519
|
+
states: [states.button_action_skip_back, states.button_action_skip_forward, states.action_play_pause,
|
|
1516
1520
|
states.rotate_left, states.rotate_right, states.rotate_stop, states.battery],
|
|
1517
1521
|
},
|
|
1518
1522
|
// Hive
|
|
@@ -1611,7 +1615,7 @@ const devices = [
|
|
|
1611
1615
|
{
|
|
1612
1616
|
models: ['SP 120', 'SP 220', 'SP 222', 'SP 224'],
|
|
1613
1617
|
icon: 'img/innr_plug.png',
|
|
1614
|
-
states: [states.state,
|
|
1618
|
+
states: [states.state,states.load_power],
|
|
1615
1619
|
},
|
|
1616
1620
|
{
|
|
1617
1621
|
models: ['FL 130 C'],
|
|
@@ -1918,7 +1922,7 @@ const devices = [
|
|
|
1918
1922
|
syncStates: [sync.brightness],
|
|
1919
1923
|
},
|
|
1920
1924
|
{
|
|
1921
|
-
models: ['798.09',
|
|
1925
|
+
models: ['798.09','371000002'],
|
|
1922
1926
|
icon: 'img/Paulmann_79809.png',
|
|
1923
1927
|
states: lightStatesWithColor,
|
|
1924
1928
|
syncStates: [sync.brightness],
|
|
@@ -1938,7 +1942,7 @@ const devices = [
|
|
|
1938
1942
|
states.brightness_move_down, states.brightness_move_down_size,
|
|
1939
1943
|
states.enhanced_move_to_hue_and_saturation, states.enhanced_move_enhanced_hue,
|
|
1940
1944
|
states.enhanced_move_hue, states.enhanced_move_saturation,
|
|
1941
|
-
states.scene,
|
|
1945
|
+
states.scene,states.action_group
|
|
1942
1946
|
],
|
|
1943
1947
|
},
|
|
1944
1948
|
|
|
@@ -2091,7 +2095,7 @@ const devices = [
|
|
|
2091
2095
|
linkedStates: [comb.brightnessAndState],
|
|
2092
2096
|
},
|
|
2093
2097
|
{
|
|
2094
|
-
models: ['MLI-404011',
|
|
2098
|
+
models: ['MLI-404011','MLI-404049','MLI-404011/MLI-404049'],
|
|
2095
2099
|
icon: 'img/MLI-404011-MLI-404049.png',
|
|
2096
2100
|
states: [
|
|
2097
2101
|
states.tint404011_scene_sunset, states.tint404011_scene_party,
|
|
@@ -2228,7 +2232,7 @@ const devices = [
|
|
|
2228
2232
|
{
|
|
2229
2233
|
models: ['07048L'],
|
|
2230
2234
|
icon: 'img/innr_plug.png',
|
|
2231
|
-
states: [states.state,
|
|
2235
|
+
states: [states.state,states.load_power],
|
|
2232
2236
|
},
|
|
2233
2237
|
{
|
|
2234
2238
|
models: ['AV2010/32'],
|
|
@@ -2404,12 +2408,12 @@ const devices = [
|
|
|
2404
2408
|
states: [states.state],
|
|
2405
2409
|
},
|
|
2406
2410
|
{
|
|
2407
|
-
models: ['X712A'],
|
|
2411
|
+
models: [ 'X712A'],
|
|
2408
2412
|
icon: 'img/tuya_switch_2.png',
|
|
2409
2413
|
states: [states.l1, states.l2],
|
|
2410
2414
|
},
|
|
2411
2415
|
{
|
|
2412
|
-
models: ['X713A'],
|
|
2416
|
+
models: [ 'X713A'],
|
|
2413
2417
|
icon: 'img/tuya_switch_3.png',
|
|
2414
2418
|
states: [states.l1, states.l2, states.l3],
|
|
2415
2419
|
},
|
|
@@ -2553,7 +2557,7 @@ const devices = [
|
|
|
2553
2557
|
],
|
|
2554
2558
|
},
|
|
2555
2559
|
{
|
|
2556
|
-
models: ['SEA802-Zigbee',
|
|
2560
|
+
models: ['SEA802-Zigbee','SEA801-Zigbee/SEA802-Zigbee'],
|
|
2557
2561
|
icon: 'img/tuya_TS0601.png',
|
|
2558
2562
|
states: [
|
|
2559
2563
|
states.child_lock,
|
|
@@ -3040,7 +3044,7 @@ const devices = [
|
|
|
3040
3044
|
states: generator.icasa_remote,
|
|
3041
3045
|
},
|
|
3042
3046
|
|
|
3043
|
-
|
|
3047
|
+
/* images only for admin */
|
|
3044
3048
|
{
|
|
3045
3049
|
models: ['E1812'],
|
|
3046
3050
|
icon: 'img/ikea_E1812.png',
|
|
@@ -3071,12 +3075,13 @@ const devices = [
|
|
|
3071
3075
|
},
|
|
3072
3076
|
{
|
|
3073
3077
|
models: ['TI0001-cover'],
|
|
3074
|
-
|
|
3078
|
+
icon: 'img/TI0001-cover.png',
|
|
3075
3079
|
},
|
|
3076
3080
|
{
|
|
3077
3081
|
models: ['E1603/E1702/E1708'],
|
|
3078
3082
|
icon: 'img/ikea_control_outlet.png',
|
|
3079
3083
|
},
|
|
3084
|
+
|
|
3080
3085
|
];
|
|
3081
3086
|
|
|
3082
3087
|
const commonStates = [
|
|
@@ -3089,11 +3094,12 @@ const commonStates = [
|
|
|
3089
3094
|
|
|
3090
3095
|
const groupStates = [states.brightness_step].concat(lightStatesWithColor);
|
|
3091
3096
|
|
|
3097
|
+
|
|
3092
3098
|
function getByModel() {
|
|
3093
3099
|
const byModel = new Map();
|
|
3094
3100
|
for (const device of devices) {
|
|
3095
3101
|
for (const model of device.models) {
|
|
3096
|
-
const stripModel = model.replace(
|
|
3102
|
+
const stripModel = model.replace(/\0.*$/g, '').trim();
|
|
3097
3103
|
byModel.set(stripModel, device);
|
|
3098
3104
|
}
|
|
3099
3105
|
}
|
|
@@ -3108,28 +3114,32 @@ function fillStatesWithExposes(allExcludesObj) {
|
|
|
3108
3114
|
applyExposes(devices, byModel, allExcludesObj);
|
|
3109
3115
|
|
|
3110
3116
|
removeEmptyStates(devices);
|
|
3117
|
+
|
|
3111
3118
|
}
|
|
3112
3119
|
|
|
3113
3120
|
// remove empty states
|
|
3114
3121
|
function removeEmptyStates(devices) {
|
|
3115
3122
|
for (const device of devices) {
|
|
3116
3123
|
if (Array.isArray(device.states)) {
|
|
3117
|
-
device.states = device.states.filter(el => el !== undefined);
|
|
3124
|
+
device.states = device.states.filter((el) => el !== undefined);
|
|
3118
3125
|
}
|
|
3119
3126
|
}
|
|
3120
3127
|
}
|
|
3121
3128
|
|
|
3129
|
+
|
|
3122
3130
|
function findModel(model) {
|
|
3123
3131
|
const byModel = getByModel();
|
|
3124
|
-
const stripModel = model ? model.replace(
|
|
3132
|
+
const stripModel = (model) ? model.replace(/\0.*$/g, '').trim() : '';
|
|
3125
3133
|
return byModel.get(stripModel);
|
|
3126
3134
|
}
|
|
3127
3135
|
|
|
3136
|
+
|
|
3137
|
+
|
|
3128
3138
|
module.exports = {
|
|
3129
|
-
devices,
|
|
3130
|
-
commonStates,
|
|
3131
|
-
groupStates,
|
|
3139
|
+
devices: devices,
|
|
3140
|
+
commonStates: commonStates,
|
|
3141
|
+
groupStates: groupStates,
|
|
3132
3142
|
groupsState: states.groups,
|
|
3133
|
-
fillStatesWithExposes,
|
|
3134
|
-
findModel
|
|
3143
|
+
fillStatesWithExposes: fillStatesWithExposes,
|
|
3144
|
+
findModel: findModel
|
|
3135
3145
|
};
|