iobroker.zigbee2mqtt 0.1.0 → 1.0.0

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/lib/states.js CHANGED
@@ -71,7 +71,8 @@ const states = {
71
71
  read: true,
72
72
  type: 'number',
73
73
  min: 0,
74
- max: 255
74
+ max: 255,
75
+ def: 10,
75
76
  },
76
77
 
77
78
  available: {
@@ -79,10 +80,11 @@ const states = {
79
80
  prop: 'available',
80
81
  name: 'Available',
81
82
  icon: undefined,
82
- role: 'state',
83
+ role: 'indicator.reachable',
83
84
  write: false,
84
85
  read: true,
85
- type: 'boolean'
86
+ type: 'boolean',
87
+ def: false,
86
88
  },
87
89
  device_query: { // button to trigger device read
88
90
  id: 'device_query',
@@ -280,6 +282,7 @@ const states = {
280
282
  type: 'number',
281
283
  unit: 'V',
282
284
  getter: payload => payload.voltage / 1000,
285
+ def: 0,
283
286
  },
284
287
  ecozy_voltage: {
285
288
  id: 'voltage',
@@ -291,6 +294,7 @@ const states = {
291
294
  type: 'number',
292
295
  unit: 'V',
293
296
  getter: payload => payload.voltage * 10,
297
+ def: 0,
294
298
  },
295
299
  battery: {
296
300
  id: 'battery',
@@ -303,7 +307,8 @@ const states = {
303
307
  type: 'number',
304
308
  unit: '%',
305
309
  min: 0,
306
- max: 100
310
+ max: 100,
311
+ def: 0,
307
312
  },
308
313
  left_click: {
309
314
  id: 'left_click',
@@ -549,7 +554,8 @@ const states = {
549
554
  write: false,
550
555
  read: true,
551
556
  type: 'number',
552
- unit: '°C'
557
+ unit: '°C',
558
+ def: 0,
553
559
  },
554
560
  humidity: {
555
561
  id: 'humidity',
@@ -605,6 +611,7 @@ const states = {
605
611
  write: false,
606
612
  read: true,
607
613
  type: 'boolean',
614
+ def: false,
608
615
  },
609
616
  occupancy_event: {
610
617
  id: 'occupancy',
@@ -615,6 +622,7 @@ const states = {
615
622
  read: true,
616
623
  type: 'boolean',
617
624
  isEvent: true,
625
+ def: false,
618
626
  },
619
627
  occupancy_pirOToUDelay: {
620
628
  // this is different from occupancy_timeout,
@@ -670,17 +678,19 @@ const states = {
670
678
  role: 'state',
671
679
  write: false,
672
680
  read: true,
673
- type: 'boolean'
681
+ type: 'boolean',
682
+ def: false,
674
683
  },
675
684
  opened: {
676
685
  id: 'opened',
677
686
  prop: 'contact',
678
687
  name: 'Is open',
679
688
  icon: undefined,
680
- role: 'state',
689
+ role: 'sensor.window',
681
690
  write: false,
682
691
  read: true,
683
692
  type: 'boolean',
693
+ def: false,
684
694
  getter: payload => !payload.contact,
685
695
  },
686
696
  tamper: {
@@ -701,7 +711,8 @@ const states = {
701
711
  role: 'indicator.leakage',
702
712
  write: false,
703
713
  read: true,
704
- type: 'boolean'
714
+ type: 'boolean',
715
+ def: false,
705
716
  },
706
717
  gas_detected: {
707
718
  id: 'detected',
@@ -711,7 +722,8 @@ const states = {
711
722
  role: 'indicator.alarm.fire',
712
723
  write: false,
713
724
  read: true,
714
- type: 'boolean'
725
+ type: 'boolean',
726
+ def: false,
715
727
  },
716
728
  smoke_detected: {
717
729
  id: 'detected',
@@ -721,7 +733,8 @@ const states = {
721
733
  role: 'indicator.alarm.fire',
722
734
  write: false,
723
735
  read: true,
724
- type: 'boolean'
736
+ type: 'boolean',
737
+ def: false,
725
738
  },
726
739
  smoke_detected2: { // for Heiman
727
740
  id: 'smoke',
@@ -731,7 +744,8 @@ const states = {
731
744
  role: 'indicator.alarm.fire',
732
745
  write: false,
733
746
  read: true,
734
- type: 'boolean'
747
+ type: 'boolean',
748
+ def: false,
735
749
  },
736
750
  co_detected: { // for Heiman
737
751
  id: 'carbon_monoxide',
@@ -741,7 +755,8 @@ const states = {
741
755
  role: 'indicator.alarm.carbon_monoxide',
742
756
  write: false,
743
757
  read: true,
744
- type: 'boolean'
758
+ type: 'boolean',
759
+ def: false,
745
760
  },
746
761
  heiman_batt_low: {
747
762
  id: 'battery_low',
@@ -751,7 +766,8 @@ const states = {
751
766
  role: 'indicator.lowbat',
752
767
  write: false,
753
768
  read: true,
754
- type: 'boolean'
769
+ type: 'boolean',
770
+ def: false
755
771
  },
756
772
  heiman_battery: {
757
773
  id: 'battery',
@@ -764,7 +780,8 @@ const states = {
764
780
  type: 'number',
765
781
  unit: '%',
766
782
  min: 0,
767
- max: 100
783
+ max: 100,
784
+ def: 0,
768
785
  },
769
786
  heiman_smart_controller_armed: {
770
787
  id: 'arm_state',
@@ -1154,7 +1171,7 @@ const states = {
1154
1171
  write: true,
1155
1172
  read: true,
1156
1173
  type: 'number',
1157
- unit: '',
1174
+ unit: '%',
1158
1175
  min: 0,
1159
1176
  max: 100,
1160
1177
  getter: payload => {
@@ -1478,7 +1495,7 @@ const states = {
1478
1495
  write: true,
1479
1496
  read: true,
1480
1497
  type: 'string',
1481
- states: 'low:low;medium:medium;high:high',
1498
+ states: { low: 'low', medium: 'medium', high: 'high' },
1482
1499
  epname: 'ep2',
1483
1500
  },
1484
1501
  occupancy_timeout: {
@@ -2185,7 +2202,7 @@ const states = {
2185
2202
  prop: 'occupied_heating_setpoint',
2186
2203
  name: 'Occupied Target Temperature',
2187
2204
  icon: undefined,
2188
- role: 'value.temperature',
2205
+ role: 'level.temperature',
2189
2206
  write: true,
2190
2207
  read: true,
2191
2208
  type: 'number',
@@ -2196,7 +2213,7 @@ const states = {
2196
2213
  prop: 'unoccupied_heating_setpoint',
2197
2214
  name: 'Unoccupied Target Temperature',
2198
2215
  icon: undefined,
2199
- role: 'value.temperature',
2216
+ role: 'level.temperature',
2200
2217
  write: true,
2201
2218
  read: true,
2202
2219
  type: 'number',
@@ -2629,6 +2646,7 @@ const states = {
2629
2646
  write: false,
2630
2647
  read: true,
2631
2648
  type: 'boolean',
2649
+ def: false,
2632
2650
  },
2633
2651
  natgas_density: {
2634
2652
  id: 'gas_density',
@@ -3715,7 +3733,7 @@ const states = {
3715
3733
  write: true,
3716
3734
  read: true,
3717
3735
  type: 'string', // valid: low, medium, high
3718
- states: 'low:low;medium:medium;high:high',
3736
+ states: { low: 'low', medium: 'medium', high: 'high' },
3719
3737
  },
3720
3738
  cover_stop: {
3721
3739
  id: 'cover_stop',
@@ -4029,7 +4047,7 @@ const states = {
4029
4047
  write: true,
4030
4048
  read: true,
4031
4049
  type: 'string',
4032
- states: 'hold:manual;program:program',
4050
+ states: { hold: 'manual', program: 'program' },
4033
4051
  setattr: 'preset',
4034
4052
  },
4035
4053
  moes_trv_heating: {
@@ -4052,7 +4070,7 @@ const states = {
4052
4070
  write: true,
4053
4071
  read: true,
4054
4072
  type: 'string', // valid: IN, AL, OU
4055
- states: 'IN:IN;AL:AL;OU:OU',
4073
+ states: { IN: 'IN', AL: 'AL', OU: 'OU' },
4056
4074
  setter: (value) => (value) === 'IN' ? 0 : (value) === 'AL' ? 1 : (value) === 'OU' ? 2 : 0,
4057
4075
  },
4058
4076
  tuya_trv_target_temperature: {
@@ -4187,7 +4205,7 @@ const states = {
4187
4205
  write: true,
4188
4206
  read: true,
4189
4207
  type: 'string', // valid: low, medium, high
4190
- states: 'off:off;auto:auto;manual:manual;comfort:comfort;eco:eco;boost:boost;complex:complex',
4208
+ states: { off: 'off', auto: 'auto', manual: 'manual', comfort: 'comfort', eco: 'eco', boost: 'boost', complex: 'complex' },
4191
4209
  },
4192
4210
  climate_preset: {
4193
4211
  id: 'preset',
@@ -4197,7 +4215,7 @@ const states = {
4197
4215
  write: true,
4198
4216
  read: true,
4199
4217
  type: 'string',
4200
- states: 'schedule:schedule;manual:manual;boost:boost;complex:complex;comfort:comfort;eco:eco',
4218
+ states: { schedule: 'schedule', manual: 'manual', boost: 'boost', complex: 'complex', comfort: 'comfort', eco: 'eco' },
4201
4219
  },
4202
4220
  climate_away_mode: {
4203
4221
  id: 'away_mode',
@@ -4221,7 +4239,7 @@ const states = {
4221
4239
  write: true,
4222
4240
  read: true,
4223
4241
  type: 'string',
4224
- states: 'auto:auto;off:off;heat:heat',
4242
+ states: { auto: 'auto', off: 'off', heat: 'heat' },
4225
4243
  },
4226
4244
  climate_running_mode: {
4227
4245
  id: 'running_state',
@@ -4232,7 +4250,7 @@ const states = {
4232
4250
  write: true,
4233
4251
  read: true,
4234
4252
  type: 'string', // valid: low, medium, high
4235
- states: 'idle;idle;heat:heat',
4253
+ states: { idle: 'idle', heat: 'heat' },
4236
4254
  },
4237
4255
  tuya_trv_force_mode: {
4238
4256
  id: 'mode_force',
@@ -4243,7 +4261,7 @@ const states = {
4243
4261
  write: true,
4244
4262
  read: true,
4245
4263
  type: 'string', // valid: low, medium, high
4246
- states: 'normal:normal;open:open;close:close',
4264
+ states: { normal: 'normal', open: 'open', close: 'close' },
4247
4265
  },
4248
4266
  tuya_trv_valve_position: {
4249
4267
  id: 'valve_position',
@@ -4858,7 +4876,7 @@ const states = {
4858
4876
  write: true,
4859
4877
  read: true,
4860
4878
  type: 'string', // valid: low, medium, high
4861
- states: 'low:low;medium:medium;high:high',
4879
+ states: { low: 'low', medium: 'medium', high: 'high' },
4862
4880
  },
4863
4881
  duration: {
4864
4882
  id: 'duration',
@@ -5217,7 +5235,7 @@ const states = {
5217
5235
  write: true,
5218
5236
  read: true,
5219
5237
  type: 'string',
5220
- states: '0:СБМ-20/СТС-5/BOI-33;1:СБМ-19/СТС-6;3:Other',
5238
+ states: { 0: 'СБМ-20/СТС-5/BOI-33', 1: 'СБМ-19/СТС-6', 3: 'Other' },
5221
5239
  setter: (value) => parseInt(value),
5222
5240
  },
5223
5241
  geiger_alert_threshold: {
@@ -5263,7 +5281,8 @@ const states = {
5263
5281
  read: false,
5264
5282
  type: 'number',
5265
5283
  min: -50,
5266
- max: 50
5284
+ max: 50,
5285
+ def: 0
5267
5286
  },
5268
5287
  colortemp_move: {
5269
5288
  id: 'colortemp_move',
@@ -5275,7 +5294,8 @@ const states = {
5275
5294
  read: false,
5276
5295
  type: 'number',
5277
5296
  min: -50,
5278
- max: 50
5297
+ max: 50,
5298
+ def: 0
5279
5299
  },
5280
5300
  hue_move: {
5281
5301
  id: 'hue_move',
@@ -5287,7 +5307,8 @@ const states = {
5287
5307
  read: false,
5288
5308
  type: 'number',
5289
5309
  min: -50,
5290
- max: 50
5310
+ max: 50,
5311
+ def: 0
5291
5312
  },
5292
5313
  saturation_move: {
5293
5314
  id: 'saturation_move',
@@ -5299,7 +5320,8 @@ const states = {
5299
5320
  read: false,
5300
5321
  type: 'number',
5301
5322
  min: -50,
5302
- max: 50
5323
+ max: 50,
5324
+ def: 0
5303
5325
  },
5304
5326
  brightness_step_up: {
5305
5327
  id: 'brightness_step_up',
@@ -5370,6 +5392,7 @@ const states = {
5370
5392
  write: false,
5371
5393
  read: true,
5372
5394
  type: 'boolean',
5395
+ def: 0,
5373
5396
  isEvent: true,
5374
5397
  getter: payload => (payload.action === 'color_temperature_move') ? true : undefined,
5375
5398
  },
@@ -5424,6 +5447,7 @@ const states = {
5424
5447
  write: false,
5425
5448
  read: true,
5426
5449
  type: 'boolean',
5450
+ def: false,
5427
5451
  isEvent: true,
5428
5452
  getter: payload => (payload.action === 'brightness_move_up') ? true : undefined,
5429
5453
  },
@@ -5448,6 +5472,7 @@ const states = {
5448
5472
  write: false,
5449
5473
  read: true,
5450
5474
  type: 'boolean',
5475
+ def: false,
5451
5476
  isEvent: true,
5452
5477
  getter: payload => (payload.action === 'brightness_move_down') ? true : undefined,
5453
5478
  },
@@ -5667,7 +5692,7 @@ const states = {
5667
5692
  write: true,
5668
5693
  read: true,
5669
5694
  type: 'string',
5670
- states: 'auto:auto;manual:manual;away:away',
5695
+ states: { auto: 'auto', manual: 'manual', away: 'away' },
5671
5696
  },
5672
5697
  child_lock: {
5673
5698
  id: 'lock',
@@ -5701,7 +5726,7 @@ const states = {
5701
5726
  write: true,
5702
5727
  read: true,
5703
5728
  type: 'string',
5704
- states: 'internal:internal;external:external;both:both',
5729
+ states: { internal: 'internal', external: 'external', both: 'both' },
5705
5730
  },
5706
5731
  hvacThermostat_external_temp: {
5707
5732
  id: 'external_temp',
@@ -5786,7 +5811,7 @@ const states = {
5786
5811
  write: true,
5787
5812
  read: true,
5788
5813
  type: 'string',
5789
- states: 'steady:steady;snow:snow;rainbow:rainbow;snake:snake;twinkle:twinkle;firework:firework;horizontal_flag:horizontal_flag;waves:waves;updown:updown;vintage:vintage;fading:fading;collide:collide;strobe:strobe;sparkles:sparkles;carnaval:carnaval;glow:glow',
5814
+ states: { steady: 'steady', snow: 'snow', rainbow: 'rainbow', snake: 'snake', twinkle: 'twinkle', firework: 'firework', horizontal_flag: 'horizontal_flag', waves: 'waves', updown: 'updown', vintage: 'vintage', fading: 'fading', collide: 'collide', strobe: 'strobe', sparkles: 'sparkles', carnaval: 'carnaval', glow: 'glow' },
5790
5815
  setter: (value, options) => {
5791
5816
  const effectjson = {
5792
5817
  colors: [{ r: 255, g: 0, b: 0 }, { r: 0, g: 255, b: 0 }, { r: 0, g: 0, b: 255 }],
@@ -5957,7 +5982,7 @@ const states = {
5957
5982
  write: true,
5958
5983
  read: true,
5959
5984
  type: 'string',
5960
- states: 'blink:blink;breathe:breathe;okay:okay;channel_change:channel_change;finish_effect:finish_effect;stop_effect:stop_effect'
5985
+ states: { blink: 'blink', breathe: 'breathe', okay: 'okay', channel_change: 'channel_change', finish_effect: 'finish_effect', stop_effect: 'stop_effect' }
5961
5986
  },
5962
5987
  interlock: {
5963
5988
  id: 'interlock',
@@ -0,0 +1,127 @@
1
+ const utils = require('./utils');
2
+ const incStatsQueue = [];
3
+
4
+ class StatesController {
5
+ constructor(adapter, deviceCache, groupCache, debugDevices) {
6
+ this.adapter = adapter;
7
+ this.groupCache = groupCache;
8
+ this.deviceCache = deviceCache;
9
+ this.debugDevices = debugDevices;
10
+ }
11
+
12
+ async processDeviceMessage(messageObj) {
13
+ // Is payload present?
14
+ if (messageObj.payload == '') {
15
+ return;
16
+ }
17
+
18
+ const device = this.groupCache.concat(this.deviceCache).find(x => x.id == messageObj.topic);
19
+ if (device) {
20
+ try {
21
+ this.setDeviceState(messageObj, device);
22
+ } catch (error) {
23
+ this.adapter.log.error(error);
24
+ }
25
+ }
26
+ else {
27
+ incStatsQueue[incStatsQueue.length] = messageObj;
28
+ this.adapter.log.debug(`Device: ${messageObj.topic} not found, queue state in incStatsQueue!`);
29
+ }
30
+ }
31
+
32
+ async setDeviceState(messageObj, device) {
33
+ if (this.debugDevices.includes(device.ieee_address)) {
34
+ this.adapter.log.warn(`--->>> fromZ2M -> ${device.ieee_address} states: ${JSON.stringify(messageObj)}`);
35
+ }
36
+
37
+ for (const [key, value] of Object.entries(messageObj.payload)) {
38
+ let states;
39
+ if (key == 'action') {
40
+ states = device.states.filter(x => (x.prop && x.prop == key));
41
+ } else {
42
+ states = device.states.filter(x => (x.prop && x.prop == key) || x.id == key);
43
+ }
44
+
45
+ for (const state of states) {
46
+ if (!state) {
47
+ continue;
48
+ }
49
+
50
+ const stateName = `${device.ieee_address}.${state.id}`;
51
+
52
+ try {
53
+ if (state.isEvent) {
54
+ if (state.getter) {
55
+ await this.setStateWithTimeoutAsync(stateName, state.getter(messageObj.payload), 300);
56
+ }
57
+ else {
58
+ await this.setStateWithTimeoutAsync(stateName, value, 300);
59
+ }
60
+ }
61
+ else {
62
+ if (state.getter) {
63
+ await this.setStateAsync(stateName, state.getter(messageObj.payload));
64
+ }
65
+ else {
66
+ await this.setStateAsync(stateName, value);
67
+ }
68
+ }
69
+ } catch (err) {
70
+ //this.adapter.log.warn(`Can not set ${stateName}`);
71
+ incStatsQueue[incStatsQueue.length] = messageObj;
72
+ this.adapter.log.debug(`Can not set ${stateName} for ${messageObj.topic}, queue state in incStatsQueue!`);
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ async setStateAsync(stateName, value) {
79
+ if (value !== undefined) {
80
+ await this.adapter.setStateAsync(stateName, value, true);
81
+ }
82
+ }
83
+
84
+ async setStateWithTimeoutAsync(stateName, value, timeout) {
85
+ if (value !== undefined) {
86
+ await this.adapter.setStateAsync(stateName, value, true);
87
+ setTimeout(() => {
88
+ this.adapter.setStateAsync(stateName, !value, true);
89
+ }, timeout);
90
+ }
91
+ }
92
+
93
+ async processQueue() {
94
+ const oldIncStatsQueue = [];
95
+ utils.moveArray(incStatsQueue, oldIncStatsQueue);
96
+ while (oldIncStatsQueue.length > 0) {
97
+ this.processDeviceMessage(oldIncStatsQueue.shift());
98
+ }
99
+ }
100
+
101
+ async subscribeWritableStates() {
102
+ await this.adapter.unsubscribeObjectsAsync('*');
103
+ for (const device of this.groupCache.concat(this.deviceCache)) {
104
+ for (const state of device.states) {
105
+ if (state.write == true) {
106
+ this.adapter.subscribeStatesAsync(`${device.ieee_address}.${state.id}`);
107
+ }
108
+ }
109
+ }
110
+ this.adapter.subscribeStatesAsync('info.debugmessages');
111
+ this.adapter.subscribeStatesAsync('info.logfilter');
112
+ }
113
+
114
+ async setAllAvailableToFalse() {
115
+ for (const device of this.deviceCache) {
116
+ for (const state of device.states) {
117
+ if (state.id == 'available') {
118
+ await this.adapter.setStateAsync(`${device.ieee_address}.${state.id}`, false, true);
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ module.exports = {
126
+ StatesController
127
+ };
package/lib/utils.js CHANGED
@@ -61,7 +61,7 @@ function toMired(t) {
61
61
  }
62
62
 
63
63
  function miredKelvinConversion(t) {
64
- return (1000000 / t).toFixed();
64
+ return Math.round(1000000 / t);
65
65
  }
66
66
 
67
67
  /**
@@ -118,14 +118,23 @@ function clearArray(array) {
118
118
  }
119
119
  }
120
120
 
121
- exports.bulbLevelToAdapterLevel = bulbLevelToAdapterLevel;
122
- exports.adapterLevelToBulbLevel = adapterLevelToBulbLevel;
123
- exports.bytesArrayToWordArray = bytesArrayToWordArray;
124
- exports.toMired = toMired;
125
- exports.miredKelvinConversion = miredKelvinConversion;
126
- exports.decimalToHex = decimalToHex;
127
- exports.getZbId = getZbId;
128
- exports.getAdId = getAdId;
129
- exports.removeDeviceByIeee = removeDeviceByIeee;
130
- exports.getDeviceIcon = getDeviceIcon;
131
- exports.clearArray = clearArray;
121
+ function moveArray(source, target) {
122
+ while (source.length > 0) {
123
+ target.push(source.shift());
124
+ }
125
+ }
126
+
127
+ module.exports = {
128
+ bulbLevelToAdapterLevel: bulbLevelToAdapterLevel,
129
+ adapterLevelToBulbLevel: adapterLevelToBulbLevel,
130
+ bytesArrayToWordArray: bytesArrayToWordArray,
131
+ toMired: toMired,
132
+ miredKelvinConversion: miredKelvinConversion,
133
+ decimalToHex: decimalToHex,
134
+ getZbId: getZbId,
135
+ getAdId: getAdId,
136
+ removeDeviceByIeee: removeDeviceByIeee,
137
+ getDeviceIcon: getDeviceIcon,
138
+ clearArray: clearArray,
139
+ moveArray: moveArray,
140
+ };
@@ -0,0 +1,80 @@
1
+ class Z2mController {
2
+ constructor(adapter, deviceCache, groupCache, logfilter) {
3
+ this.adapter = adapter;
4
+ this.groupCache = groupCache;
5
+ this.deviceCache = deviceCache;
6
+ this.logfilter = logfilter;
7
+ }
8
+
9
+ async createZ2MMessage(id, state) {
10
+ const splitedID = id.split('.');
11
+ if (splitedID.length < 4) {
12
+ this.adapter.log.warn(`state ${id} not valid`);
13
+ return;
14
+ }
15
+
16
+ const ieee_address = splitedID[2];
17
+ const stateName = splitedID[3];
18
+
19
+ const device = this.groupCache.concat(this.deviceCache).find(d => d.ieee_address == ieee_address);
20
+ if (!device) {
21
+ return;
22
+ }
23
+
24
+ const deviceState = device.states.find(s => s.id == stateName);
25
+ if (!deviceState) {
26
+ return;
27
+ }
28
+
29
+ let stateVal = state.val;
30
+ if (deviceState.setter) {
31
+ stateVal = deviceState.setter(state.val);
32
+ }
33
+
34
+ let stateID = deviceState.id;
35
+ if (deviceState.prop) {
36
+ stateID = deviceState.prop;
37
+ }
38
+
39
+ let topic = `${device.ieee_address}/set`;
40
+ if (device.ieee_address.includes('group_')) {
41
+ topic = `${device.id}/set`;
42
+ }
43
+
44
+ const controlObj = {
45
+ payload: {
46
+ [stateID]: stateVal
47
+ },
48
+ topic: topic
49
+ };
50
+ // set stats with the mentioned role or ids always immediately to ack = true, because these are not reported back by Zigbee2MQTT
51
+ if (['button'].includes(deviceState.role) || ['brightness_move', 'color_temp_move'].includes(stateID)) {
52
+ this.adapter.setState(id, state, true);
53
+ }
54
+
55
+ return controlObj;
56
+ }
57
+
58
+ async proxyZ2MLogs(messageObj) {
59
+ const logMessage = messageObj.payload.message;
60
+ if (this.logfilter.some(x => logMessage.includes(x))) {
61
+ return;
62
+ }
63
+
64
+ const logLevel = messageObj.payload.level;
65
+ switch (logLevel) {
66
+ case 'debug':
67
+ case 'info':
68
+ case 'error':
69
+ this.adapter.log[logLevel](logMessage);
70
+ break;
71
+ case 'warning':
72
+ this.adapter.log.warn(logMessage);
73
+ break;
74
+ }
75
+ }
76
+ }
77
+
78
+ module.exports = {
79
+ Z2mController: Z2mController
80
+ };