iobroker.zigbee2mqtt 3.1.1 → 3.1.5
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 +14 -0
- package/io-package.json +53 -27
- package/lib/check.js +6 -4
- package/lib/colors.js +9 -9
- package/lib/deviceController.js +92 -39
- package/lib/exposes.js +19 -7
- package/lib/imageController.js +56 -26
- package/lib/messages.js +15 -13
- package/lib/mqttServerController.js +14 -8
- package/lib/nonGenericDevicesExtension.js +2 -3
- package/lib/rgb.js +52 -63
- package/lib/states.js +138 -28
- package/lib/statesController.js +102 -44
- package/lib/utils.js +36 -47
- package/lib/websocketController.js +84 -52
- package/lib/z2mController.js +28 -16
- package/main.js +103 -33
- package/package.json +1 -1
package/lib/states.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
/*eslint no-unused-vars: ['off']*/
|
|
@@ -109,8 +108,6 @@ const states = {
|
|
|
109
108
|
},
|
|
110
109
|
},
|
|
111
110
|
|
|
112
|
-
|
|
113
|
-
|
|
114
111
|
simulated_brightness: {
|
|
115
112
|
id: 'simulated_brightness',
|
|
116
113
|
prop: 'brightness',
|
|
@@ -122,13 +119,17 @@ const states = {
|
|
|
122
119
|
type: 'number',
|
|
123
120
|
def: 0,
|
|
124
121
|
unit: '%',
|
|
122
|
+
// Fix: null-Guard – bulbLevelToAdapterLevel(undefined) würde 0 liefern (Lampe scheinbar aus)
|
|
125
123
|
getter: (payload) => {
|
|
124
|
+
if (payload.brightness == null) { return undefined; }
|
|
126
125
|
return utils.bulbLevelToAdapterLevel(payload.brightness);
|
|
127
126
|
},
|
|
128
127
|
},
|
|
129
128
|
|
|
129
|
+
// Fix: prop ergänzt – statesController sucht zuerst per state.prop === payload-key
|
|
130
130
|
state: {
|
|
131
131
|
id: 'state',
|
|
132
|
+
prop: 'state',
|
|
132
133
|
name: 'Switch state',
|
|
133
134
|
icon: undefined,
|
|
134
135
|
role: 'switch',
|
|
@@ -142,6 +143,7 @@ const states = {
|
|
|
142
143
|
|
|
143
144
|
brightness: {
|
|
144
145
|
id: 'brightness',
|
|
146
|
+
prop: 'brightness',
|
|
145
147
|
name: 'Brightness',
|
|
146
148
|
options: ['transition'],
|
|
147
149
|
icon: undefined,
|
|
@@ -149,16 +151,16 @@ const states = {
|
|
|
149
151
|
write: true,
|
|
150
152
|
read: true,
|
|
151
153
|
type: 'number',
|
|
154
|
+
def: 100,
|
|
152
155
|
unit: '%',
|
|
153
156
|
min: 0,
|
|
154
157
|
max: 100,
|
|
155
|
-
|
|
158
|
+
// Fix: null-Guard – payload ohne brightness-Key liefert sonst fälschlich 0
|
|
156
159
|
getter: (payload) => {
|
|
160
|
+
if (payload.brightness == null) { return undefined; }
|
|
157
161
|
return utils.bulbLevelToAdapterLevel(payload.brightness);
|
|
158
162
|
},
|
|
159
|
-
setter: (value) =>
|
|
160
|
-
return utils.adapterLevelToBulbLevel(value);
|
|
161
|
-
},
|
|
163
|
+
setter: (value) => utils.adapterLevelToBulbLevel(value),
|
|
162
164
|
},
|
|
163
165
|
|
|
164
166
|
brightness_move: {
|
|
@@ -170,9 +172,9 @@ const states = {
|
|
|
170
172
|
write: true,
|
|
171
173
|
read: false,
|
|
172
174
|
type: 'number',
|
|
175
|
+
def: 0,
|
|
173
176
|
min: -50,
|
|
174
177
|
max: 50,
|
|
175
|
-
def: 0,
|
|
176
178
|
},
|
|
177
179
|
|
|
178
180
|
colortemp_move: {
|
|
@@ -184,9 +186,9 @@ const states = {
|
|
|
184
186
|
write: true,
|
|
185
187
|
read: false,
|
|
186
188
|
type: 'number',
|
|
189
|
+
def: 0,
|
|
187
190
|
min: -50,
|
|
188
191
|
max: 50,
|
|
189
|
-
def: 0,
|
|
190
192
|
},
|
|
191
193
|
|
|
192
194
|
transition: {
|
|
@@ -198,12 +200,13 @@ const states = {
|
|
|
198
200
|
write: true,
|
|
199
201
|
read: false,
|
|
200
202
|
type: 'number',
|
|
203
|
+
def: -1,
|
|
201
204
|
unit: 'sec',
|
|
202
205
|
min: -1,
|
|
203
206
|
max: 65535,
|
|
204
|
-
def: -1,
|
|
205
207
|
isOption: true,
|
|
206
208
|
},
|
|
209
|
+
|
|
207
210
|
send_payload: {
|
|
208
211
|
id: 'send_payload',
|
|
209
212
|
name: 'Send a raw json payload',
|
|
@@ -214,39 +217,49 @@ const states = {
|
|
|
214
217
|
type: 'string',
|
|
215
218
|
def: '{}',
|
|
216
219
|
},
|
|
220
|
+
|
|
221
|
+
// Fix: prop ergänzt – Z2M sendet payload.voltage
|
|
217
222
|
voltage: {
|
|
218
223
|
id: 'voltage',
|
|
224
|
+
prop: 'voltage',
|
|
219
225
|
name: 'Voltage',
|
|
220
226
|
icon: undefined,
|
|
221
227
|
role: 'value.voltage',
|
|
222
228
|
write: false,
|
|
223
229
|
read: true,
|
|
224
230
|
type: 'number',
|
|
225
|
-
unit: 'V',
|
|
226
231
|
def: 0,
|
|
232
|
+
unit: 'V',
|
|
227
233
|
},
|
|
234
|
+
|
|
235
|
+
// Fix: prop ergänzt – Z2M sendet payload.voltage (Battery-Variante)
|
|
228
236
|
battery_voltage: {
|
|
229
237
|
id: 'voltage',
|
|
238
|
+
prop: 'voltage',
|
|
230
239
|
name: 'Battery voltage',
|
|
231
240
|
icon: undefined,
|
|
232
241
|
role: 'battery.voltage',
|
|
233
242
|
write: false,
|
|
234
243
|
read: true,
|
|
235
244
|
type: 'number',
|
|
236
|
-
unit: 'V',
|
|
237
245
|
def: 0,
|
|
246
|
+
unit: 'V',
|
|
238
247
|
},
|
|
248
|
+
|
|
249
|
+
// Fix: prop ergänzt – Z2M sendet payload.energy
|
|
239
250
|
energy: {
|
|
240
251
|
id: 'energy',
|
|
252
|
+
prop: 'energy',
|
|
241
253
|
name: 'Sum of consumed energy',
|
|
242
254
|
icon: undefined,
|
|
243
255
|
role: 'value.power.consumption',
|
|
244
256
|
write: false,
|
|
245
257
|
read: true,
|
|
246
258
|
type: 'number',
|
|
247
|
-
unit: 'kWh',
|
|
248
259
|
def: 0,
|
|
260
|
+
unit: 'kWh',
|
|
249
261
|
},
|
|
262
|
+
|
|
250
263
|
battery: {
|
|
251
264
|
id: 'battery',
|
|
252
265
|
prop: 'battery',
|
|
@@ -256,35 +269,43 @@ const states = {
|
|
|
256
269
|
write: false,
|
|
257
270
|
read: true,
|
|
258
271
|
type: 'number',
|
|
272
|
+
def: 0,
|
|
259
273
|
unit: '%',
|
|
260
274
|
min: 0,
|
|
261
275
|
max: 100,
|
|
262
|
-
def: 0,
|
|
263
276
|
},
|
|
277
|
+
|
|
278
|
+
// Fix: prop ergänzt – Z2M sendet payload.device_temperature
|
|
264
279
|
device_temperature: {
|
|
265
280
|
id: 'device_temperature',
|
|
281
|
+
prop: 'device_temperature',
|
|
266
282
|
name: 'Temperature of the device',
|
|
267
283
|
icon: undefined,
|
|
268
284
|
role: 'value.temperature',
|
|
269
285
|
write: false,
|
|
270
286
|
read: true,
|
|
271
287
|
type: 'number',
|
|
272
|
-
unit: '°C',
|
|
273
288
|
def: 0,
|
|
289
|
+
unit: '°C',
|
|
274
290
|
},
|
|
291
|
+
|
|
292
|
+
// Fix: prop ergänzt – Z2M sendet payload.temperature
|
|
275
293
|
temperature: {
|
|
276
294
|
id: 'temperature',
|
|
295
|
+
prop: 'temperature',
|
|
277
296
|
name: 'Temperature',
|
|
278
297
|
icon: undefined,
|
|
279
298
|
role: 'value.temperature',
|
|
280
299
|
write: false,
|
|
281
300
|
read: true,
|
|
282
301
|
type: 'number',
|
|
283
|
-
unit: '°C',
|
|
284
302
|
def: 0,
|
|
303
|
+
unit: '°C',
|
|
285
304
|
},
|
|
305
|
+
|
|
286
306
|
humidity: {
|
|
287
307
|
id: 'humidity',
|
|
308
|
+
prop: 'humidity',
|
|
288
309
|
name: 'Humidity',
|
|
289
310
|
icon: undefined,
|
|
290
311
|
role: 'value.humidity',
|
|
@@ -296,8 +317,10 @@ const states = {
|
|
|
296
317
|
min: 0,
|
|
297
318
|
max: 100,
|
|
298
319
|
},
|
|
320
|
+
|
|
299
321
|
pressure: {
|
|
300
322
|
id: 'pressure',
|
|
323
|
+
prop: 'pressure',
|
|
301
324
|
name: 'Pressure',
|
|
302
325
|
icon: undefined,
|
|
303
326
|
role: 'value.pressure',
|
|
@@ -309,6 +332,7 @@ const states = {
|
|
|
309
332
|
min: 0,
|
|
310
333
|
max: 10000,
|
|
311
334
|
},
|
|
335
|
+
|
|
312
336
|
illuminance: {
|
|
313
337
|
id: 'illuminance',
|
|
314
338
|
prop: 'illuminance_lux',
|
|
@@ -321,6 +345,30 @@ const states = {
|
|
|
321
345
|
def: 0,
|
|
322
346
|
unit: 'lux',
|
|
323
347
|
},
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Illuminance berechnet aus dem Z2M-Rohwert (prop='illuminance').
|
|
351
|
+
* Formel: lux = round(10^(raw / 10000))
|
|
352
|
+
* Wird zusätzlich zu illuminance_raw angelegt wenn das Gerät keinen
|
|
353
|
+
* illuminance_lux-Expose liefert.
|
|
354
|
+
*/
|
|
355
|
+
illuminance_from_raw: {
|
|
356
|
+
id: 'illuminance',
|
|
357
|
+
prop: 'illuminance',
|
|
358
|
+
name: 'Illuminance',
|
|
359
|
+
icon: undefined,
|
|
360
|
+
role: 'value.brightness',
|
|
361
|
+
write: false,
|
|
362
|
+
read: true,
|
|
363
|
+
type: 'number',
|
|
364
|
+
def: 0,
|
|
365
|
+
unit: 'lux',
|
|
366
|
+
getter: (payload) => {
|
|
367
|
+
if (payload.illuminance == null) { return undefined; }
|
|
368
|
+
return Math.round(Math.pow(10, payload.illuminance / 10000));
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
|
|
324
372
|
illuminance_raw: {
|
|
325
373
|
id: 'illuminance_raw',
|
|
326
374
|
prop: 'illuminance',
|
|
@@ -333,8 +381,51 @@ const states = {
|
|
|
333
381
|
def: 0,
|
|
334
382
|
unit: '',
|
|
335
383
|
},
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Rohwert-State wenn das Gerät 'illuminance_raw' als payload-Schlüssel sendet
|
|
387
|
+
* (z.B. Geräte mit eigenem illuminance_raw-Expose).
|
|
388
|
+
*/
|
|
389
|
+
illuminance_raw_direct: {
|
|
390
|
+
id: 'illuminance_raw',
|
|
391
|
+
prop: 'illuminance_raw',
|
|
392
|
+
name: 'Illuminance raw',
|
|
393
|
+
icon: undefined,
|
|
394
|
+
role: 'value.brightness',
|
|
395
|
+
write: false,
|
|
396
|
+
read: true,
|
|
397
|
+
type: 'number',
|
|
398
|
+
def: 0,
|
|
399
|
+
unit: '',
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Illuminance in Lux berechnet aus payload.illuminance_raw.
|
|
404
|
+
* Formel: lux = round(10^(illuminance_raw / 10000))
|
|
405
|
+
* Wird angelegt wenn das Gerät 'illuminance_raw' als Expose-Typ hat,
|
|
406
|
+
* aber kein separates 'illuminance_lux' liefert.
|
|
407
|
+
*/
|
|
408
|
+
illuminance_from_illuminance_raw: {
|
|
409
|
+
id: 'illuminance',
|
|
410
|
+
prop: 'illuminance_raw',
|
|
411
|
+
name: 'Illuminance',
|
|
412
|
+
icon: undefined,
|
|
413
|
+
role: 'value.brightness',
|
|
414
|
+
write: false,
|
|
415
|
+
read: true,
|
|
416
|
+
type: 'number',
|
|
417
|
+
def: 0,
|
|
418
|
+
unit: 'lux',
|
|
419
|
+
getter: (payload) => {
|
|
420
|
+
if (payload.illuminance_raw == null) { return undefined; }
|
|
421
|
+
return Math.round(Math.pow(10, payload.illuminance_raw / 10000));
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
// Fix: prop ergänzt – Z2M sendet payload.occupancy
|
|
336
426
|
occupancy: {
|
|
337
427
|
id: 'occupancy',
|
|
428
|
+
prop: 'occupancy',
|
|
338
429
|
name: 'Occupancy',
|
|
339
430
|
icon: undefined,
|
|
340
431
|
role: 'sensor.motion',
|
|
@@ -343,6 +434,7 @@ const states = {
|
|
|
343
434
|
type: 'boolean',
|
|
344
435
|
def: false,
|
|
345
436
|
},
|
|
437
|
+
|
|
346
438
|
contact: {
|
|
347
439
|
id: 'contact',
|
|
348
440
|
prop: 'contact',
|
|
@@ -354,6 +446,7 @@ const states = {
|
|
|
354
446
|
type: 'boolean',
|
|
355
447
|
def: false,
|
|
356
448
|
},
|
|
449
|
+
|
|
357
450
|
opened: {
|
|
358
451
|
id: 'opened',
|
|
359
452
|
prop: 'contact',
|
|
@@ -364,8 +457,13 @@ const states = {
|
|
|
364
457
|
read: true,
|
|
365
458
|
type: 'boolean',
|
|
366
459
|
def: false,
|
|
367
|
-
|
|
460
|
+
// Fix: null-Guard – !undefined wäre true (Tür fälschlich offen)
|
|
461
|
+
getter: (payload) => {
|
|
462
|
+
if (payload.contact == null) { return undefined; }
|
|
463
|
+
return !payload.contact;
|
|
464
|
+
},
|
|
368
465
|
},
|
|
466
|
+
|
|
369
467
|
tamper: {
|
|
370
468
|
id: 'tampered',
|
|
371
469
|
prop: 'tamper',
|
|
@@ -375,7 +473,9 @@ const states = {
|
|
|
375
473
|
write: false,
|
|
376
474
|
read: true,
|
|
377
475
|
type: 'boolean',
|
|
476
|
+
def: false,
|
|
378
477
|
},
|
|
478
|
+
|
|
379
479
|
water_leak: {
|
|
380
480
|
id: 'detected',
|
|
381
481
|
prop: 'water_leak',
|
|
@@ -387,6 +487,7 @@ const states = {
|
|
|
387
487
|
type: 'boolean',
|
|
388
488
|
def: false,
|
|
389
489
|
},
|
|
490
|
+
|
|
390
491
|
batt_low_t_f: {
|
|
391
492
|
id: 'battery_low',
|
|
392
493
|
prop: 'battery_low',
|
|
@@ -398,6 +499,7 @@ const states = {
|
|
|
398
499
|
type: 'boolean',
|
|
399
500
|
def: false,
|
|
400
501
|
},
|
|
502
|
+
|
|
401
503
|
load_power: {
|
|
402
504
|
id: 'load_power',
|
|
403
505
|
prop: 'power',
|
|
@@ -420,11 +522,10 @@ const states = {
|
|
|
420
522
|
write: false,
|
|
421
523
|
read: true,
|
|
422
524
|
type: 'number',
|
|
423
|
-
unit: 'A',
|
|
424
525
|
def: 0,
|
|
526
|
+
unit: 'A',
|
|
425
527
|
},
|
|
426
528
|
|
|
427
|
-
|
|
428
529
|
temp_calibration: {
|
|
429
530
|
id: 'temperature_calibration',
|
|
430
531
|
prop: 'temperature_calibration',
|
|
@@ -438,6 +539,7 @@ const states = {
|
|
|
438
539
|
unit: '°C',
|
|
439
540
|
isOption: true,
|
|
440
541
|
},
|
|
542
|
+
|
|
441
543
|
local_temperature: {
|
|
442
544
|
id: 'local_temperature',
|
|
443
545
|
prop: 'local_temperature',
|
|
@@ -450,6 +552,7 @@ const states = {
|
|
|
450
552
|
def: 0,
|
|
451
553
|
unit: '°C',
|
|
452
554
|
},
|
|
555
|
+
|
|
453
556
|
local_temperature_calibration: {
|
|
454
557
|
id: 'local_temperature_calibration',
|
|
455
558
|
prop: 'local_temperature_calibration',
|
|
@@ -463,7 +566,6 @@ const states = {
|
|
|
463
566
|
unit: '°C',
|
|
464
567
|
},
|
|
465
568
|
|
|
466
|
-
|
|
467
569
|
climate_away_mode: {
|
|
468
570
|
id: 'away_mode',
|
|
469
571
|
prop: 'away_mode',
|
|
@@ -473,34 +575,41 @@ const states = {
|
|
|
473
575
|
write: true,
|
|
474
576
|
read: true,
|
|
475
577
|
type: 'boolean',
|
|
578
|
+
def: false,
|
|
476
579
|
isEvent: true,
|
|
477
|
-
getter: (payload) =>
|
|
580
|
+
getter: (payload) => payload.away_mode === 'ON',
|
|
478
581
|
setter: (value) => (value ? 'ON' : 'OFF'),
|
|
479
582
|
},
|
|
583
|
+
|
|
584
|
+
// Fix: def ergänzt – ioBroker meldet Fehler beim Anlegen ohne def bei type:'string'
|
|
480
585
|
climate_system_mode: {
|
|
481
586
|
id: 'mode',
|
|
482
|
-
name: 'Mode',
|
|
483
587
|
prop: 'system_mode',
|
|
588
|
+
name: 'Mode',
|
|
484
589
|
icon: undefined,
|
|
485
590
|
role: 'state',
|
|
486
591
|
write: true,
|
|
487
592
|
read: true,
|
|
488
593
|
type: 'string',
|
|
594
|
+
def: '',
|
|
489
595
|
states: { auto: 'auto', off: 'off', heat: 'heat' },
|
|
490
596
|
},
|
|
597
|
+
|
|
598
|
+
// Fix: write:false – running_state ist ein reiner Sensor-State (Z2M sendet nur, setzt nie)
|
|
599
|
+
// Fix: def ergänzt
|
|
491
600
|
climate_running_mode: {
|
|
492
601
|
id: 'running_state',
|
|
493
|
-
name: 'Running Mode',
|
|
494
602
|
prop: 'running_state',
|
|
603
|
+
name: 'Running Mode',
|
|
495
604
|
icon: undefined,
|
|
496
605
|
role: 'state',
|
|
497
|
-
write:
|
|
606
|
+
write: false,
|
|
498
607
|
read: true,
|
|
499
|
-
type: 'string',
|
|
608
|
+
type: 'string',
|
|
609
|
+
def: '',
|
|
500
610
|
states: { idle: 'idle', heat: 'heat' },
|
|
501
611
|
},
|
|
502
612
|
|
|
503
|
-
|
|
504
613
|
brightness_step: {
|
|
505
614
|
id: 'brightness_step',
|
|
506
615
|
prop: 'brightness_step',
|
|
@@ -514,6 +623,7 @@ const states = {
|
|
|
514
623
|
min: -50,
|
|
515
624
|
max: 50,
|
|
516
625
|
},
|
|
626
|
+
|
|
517
627
|
hue_move: {
|
|
518
628
|
id: 'hue_move',
|
|
519
629
|
prop: 'hue_move',
|
|
@@ -523,15 +633,15 @@ const states = {
|
|
|
523
633
|
write: true,
|
|
524
634
|
read: false,
|
|
525
635
|
type: 'number',
|
|
636
|
+
def: 0,
|
|
526
637
|
min: -50,
|
|
527
638
|
max: 50,
|
|
528
|
-
def: 0,
|
|
529
639
|
},
|
|
530
640
|
|
|
531
641
|
child_lock: {
|
|
532
642
|
id: 'lock',
|
|
533
|
-
name: 'Locked',
|
|
534
643
|
prop: 'child_lock',
|
|
644
|
+
name: 'Locked',
|
|
535
645
|
icon: undefined,
|
|
536
646
|
role: 'state',
|
|
537
647
|
write: true,
|