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