iobroker.zigbee 1.8.3 → 1.8.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.
Files changed (87) hide show
  1. package/README.md +3 -0
  2. package/admin/admin.js +512 -493
  3. package/admin/index_m.html +1171 -1001
  4. package/admin/tab_m.html +44 -3
  5. package/docs/de/img/CC2531.png +0 -0
  6. package/docs/de/img/CC2538_CC2592_PA.PNG +0 -0
  7. package/docs/de/img/CC2591.png +0 -0
  8. package/docs/de/img/boards.jpg +0 -0
  9. package/docs/de/img/cc26x2r.PNG +0 -0
  10. package/docs/de/img/results.jpg +0 -0
  11. package/docs/de/img/sku_429478_2.png +0 -0
  12. package/docs/de/img/sku_429601_2.png +0 -0
  13. package/docs/de/readme.md +27 -0
  14. package/docs/en/img/CC2531.png +0 -0
  15. package/docs/en/img/CC2591.png +0 -0
  16. package/docs/en/img/deconz.png +0 -0
  17. package/docs/en/img/sku_429478_2.png +0 -0
  18. package/docs/en/img/sku_429601_2.png +0 -0
  19. package/docs/en/readme.md +30 -0
  20. package/docs/flashing_via_arduino_(en).md +110 -0
  21. package/docs/ru/img/CC2531.png +0 -0
  22. package/docs/ru/img/CC2591.png +0 -0
  23. package/docs/ru/img/sku_429478_2.png +0 -0
  24. package/docs/ru/img/sku_429601_2.png +0 -0
  25. package/docs/ru/readme.md +28 -0
  26. package/docs/tutorial/CC2530_20190425.zip +0 -0
  27. package/docs/tutorial/CC2530_CC2591_20190515.zip +0 -0
  28. package/docs/tutorial/CC2530_CC2592_20190515.zip +0 -0
  29. package/docs/tutorial/CC2531_20190425.zip +0 -0
  30. package/docs/tutorial/adm5_1.PNG +0 -0
  31. package/docs/tutorial/adm5_2.PNG +0 -0
  32. package/docs/tutorial/cat.PNG +0 -0
  33. package/docs/tutorial/groups-1.png +0 -0
  34. package/docs/tutorial/groups-2.png +0 -0
  35. package/docs/tutorial/inst.PNG +0 -0
  36. package/docs/tutorial/reflash-finish.PNG +0 -0
  37. package/docs/tutorial/reflash-step0.png +0 -0
  38. package/docs/tutorial/reflash-step1.PNG +0 -0
  39. package/docs/tutorial/reflash-step2.PNG +0 -0
  40. package/docs/tutorial/settings.png +0 -0
  41. package/docs/tutorial/tab-dev-1.png +0 -0
  42. package/docs/tutorial/zigbee.png +0 -0
  43. package/docs/tutorial/zigbee15.png +0 -0
  44. package/io-package.json +17 -25
  45. package/lib/backup.js +2 -2
  46. package/lib/binding.js +32 -37
  47. package/lib/colors.js +163 -158
  48. package/lib/commands.js +100 -91
  49. package/lib/developer.js +9 -12
  50. package/lib/devices.js +168 -178
  51. package/lib/exclude.js +30 -36
  52. package/lib/exposes.js +163 -139
  53. package/lib/groups.js +81 -83
  54. package/lib/json.js +5 -6
  55. package/lib/networkmap.js +2 -3
  56. package/lib/ota.js +34 -18
  57. package/lib/rgb.js +114 -72
  58. package/lib/seriallist.js +25 -20
  59. package/lib/states.js +511 -526
  60. package/lib/statescontroller.js +206 -183
  61. package/lib/utils.js +24 -23
  62. package/lib/zbBaseExtension.js +4 -4
  63. package/lib/zbDelayedAction.js +5 -13
  64. package/lib/zbDeviceAvailability.js +69 -65
  65. package/lib/zbDeviceConfigure.js +9 -21
  66. package/lib/zbDeviceEvent.js +3 -4
  67. package/lib/zigbeecontroller.js +133 -128
  68. package/main.js +169 -154
  69. package/package.json +27 -13
  70. package/.eslintignore +0 -2
  71. package/.eslintrc.json +0 -37
  72. package/.github/FUNDING.yml +0 -3
  73. package/.github/auto-merge.yml +0 -17
  74. package/.github/dependabot.yml +0 -24
  75. package/.github/stale.yml +0 -13
  76. package/.github/workflows/codeql.yml +0 -41
  77. package/.github/workflows/dependabot-automerge.yml +0 -22
  78. package/.github/workflows/test-and-release.yml +0 -149
  79. package/.releaseconfig.json +0 -3
  80. package/.travis/wiki.sh +0 -28
  81. package/.travis.yml +0 -41
  82. package/gulpfile.js +0 -464
  83. package/test/integration.js +0 -5
  84. package/test/mocha.custom.opts +0 -2
  85. package/test/mocha.setup.js +0 -14
  86. package/test/package.js +0 -5
  87. package/test/unit.js +0 -5
package/lib/states.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  /*eslint no-unused-vars: ['off']*/
4
4
 
5
- const rgb = require(__dirname + '/rgb.js');
6
- const utils = require(__dirname + '/utils.js');
7
- const colors = require(__dirname + '/colors.js');
5
+ const rgb = require('./rgb.js');
6
+ const utils = require('./utils.js');
7
+ const colors = require('./colors.js');
8
8
 
9
9
  /* states for device:
10
10
  id - sysname of state, id
@@ -43,34 +43,34 @@ const nameLookup = {
43
43
 
44
44
  const unitLookup = {
45
45
  'temperature': 'C',
46
- 'humidity':'%',
47
- 'altitude':'m',
48
- 'pressure':'Pa',
49
- 'quality':'ppm',
50
- 'particle_size':'psize',
51
- 'voltage':'V',
52
- 'current':'A',
53
- 'energy':'Wh',
54
- 'power':'W',
55
- 'frequency':'Hz',
56
- 'power_factor':'pf',
57
- 'illuminance_lux':'lx',
58
-
46
+ 'humidity': '%',
47
+ 'altitude': 'm',
48
+ 'pressure': 'Pa',
49
+ 'quality': 'ppm',
50
+ 'particle_size': 'psize',
51
+ 'voltage': 'V',
52
+ 'current': 'A',
53
+ 'energy': 'Wh',
54
+ 'power': 'W',
55
+ 'frequency': 'Hz',
56
+ 'power_factor': 'pf',
57
+ 'illuminance_lux': 'lx',
59
58
  };
59
+
60
60
  const timers = {};
61
61
 
62
62
  const states = {
63
- /* groups: {
64
- id: 'groups',
65
- name: 'Groups',
66
- icon: undefined,
67
- role: 'state',
68
- write: false,
69
- read: true,
70
- type: 'string',
71
- isOption: true,
72
- },
73
- */
63
+ /* groups: {
64
+ id: 'groups',
65
+ name: 'Groups',
66
+ icon: undefined,
67
+ role: 'state',
68
+ write: false,
69
+ read: true,
70
+ type: 'string',
71
+ isOption: true,
72
+ },
73
+ */
74
74
  link_quality: {
75
75
  id: 'link_quality',
76
76
  prop: 'linkquality',
@@ -140,7 +140,7 @@ const states = {
140
140
  read: true,
141
141
  type: 'boolean',
142
142
  isEvent: true,
143
- getter: payload => (payload.click === 'single') ? true : undefined,
143
+ getter: payload => payload.click === 'single' ? true : undefined,
144
144
  },
145
145
  double_click: {
146
146
  id: 'double_click',
@@ -152,7 +152,7 @@ const states = {
152
152
  read: true,
153
153
  type: 'boolean',
154
154
  isEvent: true,
155
- getter: payload => (payload.click === 'double') ? true : undefined,
155
+ getter: payload => payload.click === 'double' ? true : undefined,
156
156
  },
157
157
  action: {
158
158
  id: 'action',
@@ -173,7 +173,7 @@ const states = {
173
173
  read: true,
174
174
  type: 'boolean',
175
175
  isEvent: true,
176
- getter: payload => (payload.action === 'single') ? true : undefined,
176
+ getter: payload => payload.action === 'single' ? true : undefined,
177
177
  },
178
178
  action_click: {
179
179
  id: 'click',
@@ -185,7 +185,7 @@ const states = {
185
185
  read: true,
186
186
  type: 'boolean',
187
187
  isEvent: true,
188
- getter: payload => (payload.action === 'click') ? true : undefined,
188
+ getter: payload => payload.action === 'click' ? true : undefined,
189
189
  },
190
190
  action_double_click: {
191
191
  id: 'double_click',
@@ -197,7 +197,7 @@ const states = {
197
197
  read: true,
198
198
  type: 'boolean',
199
199
  isEvent: true,
200
- getter: payload => (payload.action === 'double') ? true : undefined,
200
+ getter: payload => payload.action === 'double' ? true : undefined,
201
201
  },
202
202
  action_group: {
203
203
  id: 'action_group',
@@ -218,7 +218,7 @@ const states = {
218
218
  read: true,
219
219
  type: 'boolean',
220
220
  isEvent: true,
221
- getter: payload => (payload.click === 'triple') ? true : undefined,
221
+ getter: payload => payload.click === 'triple' ? true : undefined,
222
222
  },
223
223
  quad_click: {
224
224
  id: 'quad_click',
@@ -230,7 +230,7 @@ const states = {
230
230
  read: true,
231
231
  type: 'boolean',
232
232
  isEvent: true,
233
- getter: payload => (payload.click === 'quadruple') ? true : undefined,
233
+ getter: payload => payload.click === 'quadruple' ? true : undefined,
234
234
  },
235
235
  many_click: {
236
236
  id: 'many_click',
@@ -242,7 +242,7 @@ const states = {
242
242
  read: true,
243
243
  type: 'boolean',
244
244
  isEvent: true,
245
- getter: payload => (payload.click === 'many') ? true : undefined,
245
+ getter: payload => payload.click === 'many' ? true : undefined,
246
246
  },
247
247
  long_click: {
248
248
  id: 'long_click',
@@ -254,7 +254,7 @@ const states = {
254
254
  read: true,
255
255
  type: 'boolean',
256
256
  isEvent: true,
257
- getter: payload => (payload.click === 'long') ? true : undefined,
257
+ getter: payload => payload.click === 'long' ? true : undefined,
258
258
  },
259
259
  action_long_click: {
260
260
  id: 'long_click',
@@ -266,7 +266,7 @@ const states = {
266
266
  read: true,
267
267
  type: 'boolean',
268
268
  isEvent: true,
269
- getter: payload => (payload.action === 'long') ? true : undefined,
269
+ getter: payload => payload.action === 'long' ? true : undefined,
270
270
  },
271
271
  long_press: {
272
272
  id: 'long_press',
@@ -277,7 +277,7 @@ const states = {
277
277
  write: false,
278
278
  read: true,
279
279
  type: 'boolean',
280
- getter: payload => (payload.click === 'long') ? true : (payload.click === 'long_release') ? false : undefined,
280
+ getter: payload => payload.click === 'long' ? true : payload.click === 'long_release' ? false : undefined,
281
281
  },
282
282
  voltage: {
283
283
  id: 'voltage',
@@ -324,7 +324,7 @@ const states = {
324
324
  read: true,
325
325
  type: 'boolean',
326
326
  isEvent: true,
327
- getter: payload => (payload.click === 'left') ? true : undefined,
327
+ getter: payload => payload.click === 'left' ? true : undefined,
328
328
  },
329
329
  right_click: {
330
330
  id: 'right_click',
@@ -336,7 +336,7 @@ const states = {
336
336
  read: true,
337
337
  type: 'boolean',
338
338
  isEvent: true,
339
- getter: payload => (payload.click === 'right') ? true : undefined,
339
+ getter: payload => payload.click === 'right' ? true : undefined,
340
340
  },
341
341
  both_click: {
342
342
  id: 'both_click',
@@ -348,7 +348,7 @@ const states = {
348
348
  read: true,
349
349
  type: 'boolean',
350
350
  isEvent: true,
351
- getter: payload => (payload.click === 'both') ? true : undefined,
351
+ getter: payload => payload.click === 'both' ? true : undefined,
352
352
  },
353
353
  left_click_single: {
354
354
  id: 'left_click',
@@ -360,7 +360,7 @@ const states = {
360
360
  read: true,
361
361
  type: 'boolean',
362
362
  isEvent: true,
363
- getter: payload => (payload.click === 'left_single') ? true : undefined,
363
+ getter: payload => payload.click === 'left_single' ? true : undefined,
364
364
  },
365
365
  right_click_single: {
366
366
  id: 'right_click',
@@ -372,7 +372,7 @@ const states = {
372
372
  read: true,
373
373
  type: 'boolean',
374
374
  isEvent: true,
375
- getter: payload => (payload.click === 'right_single') ? true : undefined,
375
+ getter: payload => payload.click === 'right_single' ? true : undefined,
376
376
  },
377
377
  both_click_single: {
378
378
  id: 'both_click',
@@ -384,7 +384,7 @@ const states = {
384
384
  read: true,
385
385
  type: 'boolean',
386
386
  isEvent: true,
387
- getter: payload => (payload.click === 'both_single') ? true : undefined,
387
+ getter: payload => payload.click === 'both_single' ? true : undefined,
388
388
  },
389
389
  left_click_long: {
390
390
  id: 'left_click_long',
@@ -396,7 +396,7 @@ const states = {
396
396
  read: true,
397
397
  type: 'boolean',
398
398
  isEvent: true,
399
- getter: payload => (payload.click === 'left_long') ? true : undefined,
399
+ getter: payload => payload.click === 'left_long' ? true : undefined,
400
400
  },
401
401
  left_click_double: {
402
402
  id: 'left_click_double',
@@ -408,7 +408,7 @@ const states = {
408
408
  read: true,
409
409
  type: 'boolean',
410
410
  isEvent: true,
411
- getter: payload => (payload.click === 'left_double') ? true : undefined,
411
+ getter: payload => payload.click === 'left_double' ? true : undefined,
412
412
  },
413
413
  right_click_long: {
414
414
  id: 'right_click_long',
@@ -420,7 +420,7 @@ const states = {
420
420
  read: true,
421
421
  type: 'boolean',
422
422
  isEvent: true,
423
- getter: payload => (payload.click === 'right_long') ? true : undefined,
423
+ getter: payload => payload.click === 'right_long' ? true : undefined,
424
424
  },
425
425
  right_click_double: {
426
426
  id: 'right_click_double',
@@ -432,7 +432,7 @@ const states = {
432
432
  read: true,
433
433
  type: 'boolean',
434
434
  isEvent: true,
435
- getter: payload => (payload.click === 'right_double') ? true : undefined,
435
+ getter: payload => payload.click === 'right_double' ? true : undefined,
436
436
  },
437
437
  both_click_long: {
438
438
  id: 'both_click_long',
@@ -444,7 +444,7 @@ const states = {
444
444
  read: true,
445
445
  type: 'boolean',
446
446
  isEvent: true,
447
- getter: payload => (payload.click === 'both_long') ? true : undefined,
447
+ getter: payload => payload.click === 'both_long' ? true : undefined,
448
448
  },
449
449
  both_click_double: {
450
450
  id: 'both_click_double',
@@ -456,7 +456,7 @@ const states = {
456
456
  read: true,
457
457
  type: 'boolean',
458
458
  isEvent: true,
459
- getter: payload => (payload.click === 'both_double') ? true : undefined,
459
+ getter: payload => payload.click === 'both_double' ? true : undefined,
460
460
  },
461
461
  state: {
462
462
  id: 'state',
@@ -466,10 +466,10 @@ const states = {
466
466
  write: true,
467
467
  read: true,
468
468
  type: 'boolean',
469
- getter: payload => (payload.state === 'ON'),
470
- setter: (value) => (value) ? 'ON' : 'OFF',
469
+ getter: payload => payload.state === 'ON',
470
+ setter: value => value ? 'ON' : 'OFF',
471
471
  setterOpt: (value, options) => {
472
- const stateValue = (value ? 'ON' : 'OFF');
472
+ const stateValue = value ? 'ON' : 'OFF';
473
473
  return {...options, state: stateValue};
474
474
  },
475
475
  inOptions: true,
@@ -482,8 +482,8 @@ const states = {
482
482
  write: true,
483
483
  read: true,
484
484
  type: 'boolean',
485
- getter: payload => (payload.state === 'ON'),
486
- setter: (value) => (value) ? 'ON' : 'OFF',
485
+ getter: payload => payload.state === 'ON',
486
+ setter: value => value ? 'ON' : 'OFF',
487
487
  epname: 'default',
488
488
  },
489
489
  left_state: {
@@ -495,8 +495,8 @@ const states = {
495
495
  write: true,
496
496
  read: true,
497
497
  type: 'boolean',
498
- getter: payload => (payload.state_left === 'ON'),
499
- setter: (value) => (value) ? 'ON' : 'OFF',
498
+ getter: payload => payload.state_left === 'ON',
499
+ setter: value => value ? 'ON' : 'OFF',
500
500
  setattr: 'state',
501
501
  epname: 'left',
502
502
  },
@@ -509,8 +509,8 @@ const states = {
509
509
  write: true,
510
510
  read: true,
511
511
  type: 'boolean',
512
- getter: payload => (payload.state_right === 'ON'),
513
- setter: (value) => (value) ? 'ON' : 'OFF',
512
+ getter: payload => payload.state_right === 'ON',
513
+ setter: value => value ? 'ON' : 'OFF',
514
514
  setattr: 'state',
515
515
  epname: 'right',
516
516
  },
@@ -523,8 +523,8 @@ const states = {
523
523
  write: true,
524
524
  read: true,
525
525
  type: 'boolean',
526
- getter: payload => (payload.state_center === 'ON'),
527
- setter: (value) => (value) ? 'ON' : 'OFF',
526
+ getter: payload => payload.state_center === 'ON',
527
+ setter: value => value ? 'ON' : 'OFF',
528
528
  setattr: 'state',
529
529
  epname: 'center',
530
530
  },
@@ -537,7 +537,7 @@ const states = {
537
537
  write: false,
538
538
  read: true,
539
539
  type: 'boolean',
540
- getter: payload => (payload.button_left === 'hold')
540
+ getter: payload => payload.button_left === 'hold',
541
541
  },
542
542
  right_button: {
543
543
  id: 'right_button',
@@ -548,7 +548,7 @@ const states = {
548
548
  write: false,
549
549
  read: true,
550
550
  type: 'boolean',
551
- getter: payload => (payload.button_right === 'hold'),
551
+ getter: payload => payload.button_right === 'hold',
552
552
  },
553
553
  temperature: {
554
554
  id: 'temperature',
@@ -784,7 +784,7 @@ const states = {
784
784
  write: false,
785
785
  read: true,
786
786
  type: 'string',
787
- getter: payload => (payload.action === 'armmode_disarm') ? false : true,
787
+ getter: payload => payload.action !== 'armmode_disarm',
788
788
  },
789
789
  heiman_smart_controller_arm_mode: {
790
790
  id: 'arm_mode',
@@ -795,7 +795,7 @@ const states = {
795
795
  write: false,
796
796
  read: true,
797
797
  type: 'string',
798
- getter: payload => (payload.action === 'armmode_arm_all_zones') ? 'full' : 'partial',
798
+ getter: payload => payload.action === 'armmode_arm_all_zones' ? 'full' : 'partial',
799
799
  },
800
800
  heiman_smart_controller_emergency: {
801
801
  id: 'emergency',
@@ -806,7 +806,7 @@ const states = {
806
806
  write: false,
807
807
  read: true,
808
808
  type: 'boolean',
809
- getter: payload => (payload.action === 'emergency') ? true : false,
809
+ getter: payload => payload.action === 'emergency',
810
810
  },
811
811
  heiman_execute_warning: { // for HEIMAN HS2WD-E
812
812
  id: 'execute_warning',
@@ -817,9 +817,7 @@ const states = {
817
817
  write: true,
818
818
  read: true,
819
819
  type: 'number',
820
- setter: (value) => {
821
- return {strobe: true, duration: value};
822
- },
820
+ setter: value => ({strobe: true, duration: value}),
823
821
  },
824
822
  heiman_execute_warning_strobe_only: { // for HEIMAN HS2WD-E
825
823
  id: 'execute_warning_strobe_only',
@@ -830,9 +828,7 @@ const states = {
830
828
  write: true,
831
829
  read: true,
832
830
  type: 'number',
833
- setter: (value) => {
834
- return {mode: 'stop', strobe: true, duration: value};
835
- },
831
+ setter: value => ({mode: 'stop', strobe: true, duration: value}),
836
832
  },
837
833
  bitron_execute_warning: { // for Biton AV2010/24A
838
834
  id: 'execute_warning',
@@ -843,9 +839,7 @@ const states = {
843
839
  write: true,
844
840
  read: true,
845
841
  type: 'number',
846
- setter: (value) => {
847
- return {strobe: false, duration: value};
848
- },
842
+ setter: value => ({strobe: false, duration: value}),
849
843
  },
850
844
  shake: {
851
845
  id: 'shake',
@@ -857,7 +851,7 @@ const states = {
857
851
  read: true,
858
852
  type: 'boolean',
859
853
  isEvent: true,
860
- getter: payload => (payload.action === 'shake') ? true : undefined,
854
+ getter: payload => payload.action === 'shake' ? true : undefined,
861
855
  },
862
856
  wakeup: {
863
857
  id: 'wakeup',
@@ -869,7 +863,7 @@ const states = {
869
863
  read: true,
870
864
  type: 'boolean',
871
865
  isEvent: true,
872
- getter: payload => (payload.action === 'wakeup') ? true : undefined,
866
+ getter: payload => payload.action === 'wakeup' ? true : undefined,
873
867
  },
874
868
  fall: {
875
869
  id: 'fall',
@@ -881,7 +875,7 @@ const states = {
881
875
  read: true,
882
876
  type: 'boolean',
883
877
  isEvent: true,
884
- getter: payload => (payload.action === 'fall') ? true : undefined,
878
+ getter: payload => payload.action === 'fall' ? true : undefined,
885
879
  },
886
880
  tap: {
887
881
  id: 'tap',
@@ -893,7 +887,7 @@ const states = {
893
887
  read: true,
894
888
  type: 'boolean',
895
889
  isEvent: true,
896
- getter: payload => (payload.action === 'tap') ? true : undefined,
890
+ getter: payload => payload.action === 'tap' ? true : undefined,
897
891
  },
898
892
  tap_side: {
899
893
  id: 'tap_side',
@@ -904,7 +898,7 @@ const states = {
904
898
  write: false,
905
899
  read: true,
906
900
  type: 'number',
907
- getter: payload => (payload.action === 'tap') ? payload.side : undefined,
901
+ getter: payload => payload.action === 'tap' ? payload.side : undefined,
908
902
  },
909
903
  slide: {
910
904
  id: 'slide',
@@ -916,7 +910,7 @@ const states = {
916
910
  read: true,
917
911
  type: 'boolean',
918
912
  isEvent: true,
919
- getter: payload => (payload.action === 'slide') ? true : undefined,
913
+ getter: payload => payload.action === 'slide' ? true : undefined,
920
914
  },
921
915
  slide_side: {
922
916
  id: 'slide_side',
@@ -927,7 +921,7 @@ const states = {
927
921
  write: false,
928
922
  read: true,
929
923
  type: 'number',
930
- getter: payload => (payload.action === 'slide') ? payload.side : undefined,
924
+ getter: payload => payload.action === 'slide' ? payload.side : undefined,
931
925
  },
932
926
  flip180: {
933
927
  id: 'flip180',
@@ -939,7 +933,7 @@ const states = {
939
933
  read: true,
940
934
  type: 'boolean',
941
935
  isEvent: true,
942
- getter: payload => (payload.action === 'flip180') ? true : undefined,
936
+ getter: payload => payload.action === 'flip180' ? true : undefined,
943
937
  },
944
938
  flip180_side: {
945
939
  id: 'flip180_side',
@@ -950,7 +944,7 @@ const states = {
950
944
  write: false,
951
945
  read: true,
952
946
  type: 'number',
953
- getter: payload => (payload.action === 'flip180') ? payload.side : undefined,
947
+ getter: payload => payload.action === 'flip180' ? payload.side : undefined,
954
948
  },
955
949
  flip90: {
956
950
  id: 'flip90',
@@ -962,7 +956,7 @@ const states = {
962
956
  read: true,
963
957
  type: 'boolean',
964
958
  isEvent: true,
965
- getter: payload => (payload.action === 'flip90') ? true : undefined,
959
+ getter: payload => payload.action === 'flip90' ? true : undefined,
966
960
  },
967
961
  flip90_from: {
968
962
  id: 'flip90_from',
@@ -973,7 +967,7 @@ const states = {
973
967
  write: false,
974
968
  read: true,
975
969
  type: 'number',
976
- getter: payload => (payload.action === 'flip90') ? payload.from_side : undefined,
970
+ getter: payload => payload.action === 'flip90' ? payload.from_side : undefined,
977
971
  },
978
972
  flip90_to: {
979
973
  id: 'flip90_to',
@@ -984,7 +978,7 @@ const states = {
984
978
  write: false,
985
979
  read: true,
986
980
  type: 'number',
987
- getter: payload => (payload.action === 'flip90') ? payload.to_side : undefined,
981
+ getter: payload => payload.action === 'flip90' ? payload.to_side : undefined,
988
982
  },
989
983
  rotate_left: {
990
984
  id: 'rotate_left',
@@ -996,7 +990,7 @@ const states = {
996
990
  read: true,
997
991
  type: 'boolean',
998
992
  isEvent: true,
999
- getter: payload => (payload.action === 'rotate_left') ? true : undefined,
993
+ getter: payload => payload.action === 'rotate_left' ? true : undefined,
1000
994
  },
1001
995
  rotate_right: {
1002
996
  id: 'rotate_right',
@@ -1008,7 +1002,7 @@ const states = {
1008
1002
  read: true,
1009
1003
  type: 'boolean',
1010
1004
  isEvent: true,
1011
- getter: payload => (payload.action === 'rotate_right') ? true : undefined,
1005
+ getter: payload => payload.action === 'rotate_right' ? true : undefined,
1012
1006
  },
1013
1007
  rotate_stop: {
1014
1008
  id: 'rotate_stop',
@@ -1020,7 +1014,7 @@ const states = {
1020
1014
  read: true,
1021
1015
  type: 'boolean',
1022
1016
  isEvent: true,
1023
- getter: payload => (payload.action === 'rotate_stop') ? true : undefined,
1017
+ getter: payload => payload.action === 'rotate_stop' ? true : undefined,
1024
1018
  },
1025
1019
  rotate_angle: {
1026
1020
  id: 'rotate_angle',
@@ -1042,7 +1036,7 @@ const states = {
1042
1036
  read: true,
1043
1037
  type: 'boolean',
1044
1038
  isEvent: true,
1045
- getter: payload => (payload.action === 'play_pause') ? true : undefined,
1039
+ getter: payload => payload.action === 'play_pause' ? true : undefined,
1046
1040
  },
1047
1041
  load_power: {
1048
1042
  id: 'load_power',
@@ -1151,9 +1145,7 @@ const states = {
1151
1145
  unit: '',
1152
1146
  min: 0,
1153
1147
  max: 100,
1154
- getter: payload => {
1155
- return utils.bulbLevelToAdapterLevel(payload.brightness);
1156
- },
1148
+ getter: payload => utils.bulbLevelToAdapterLevel(payload.brightness),
1157
1149
  },
1158
1150
  brightness: {
1159
1151
  id: 'brightness',
@@ -1166,12 +1158,8 @@ const states = {
1166
1158
  unit: '',
1167
1159
  min: 0,
1168
1160
  max: 100,
1169
- getter: payload => {
1170
- return utils.bulbLevelToAdapterLevel(payload.brightness);
1171
- },
1172
- setter: (value, options) => {
1173
- return utils.adapterLevelToBulbLevel(value);
1174
- },
1161
+ getter: payload => utils.bulbLevelToAdapterLevel(payload.brightness),
1162
+ setter: (value, options) => utils.adapterLevelToBulbLevel(value),
1175
1163
  setterOpt: (value, options) => {
1176
1164
  const hasTransitionTime = options && options.hasOwnProperty('transition_time');
1177
1165
  const transitionTime = hasTransitionTime ? options.transition_time : 0;
@@ -1179,7 +1167,7 @@ const states = {
1179
1167
  preparedOptions.brightness = utils.adapterLevelToBulbLevel(value);
1180
1168
  return preparedOptions;
1181
1169
  },
1182
- readResponse: (resp) => {
1170
+ readResponse: resp => {
1183
1171
  const respObj = resp[0];
1184
1172
  if (respObj.status === 0 && respObj.attrData != undefined) {
1185
1173
  return utils.bulbLevelToAdapterLevel(respObj.attrData);
@@ -1195,7 +1183,7 @@ const states = {
1195
1183
  write: true,
1196
1184
  read: true,
1197
1185
  type: 'number',
1198
- setter: (value) => {
1186
+ setter: value => {
1199
1187
  return utils.toMired(value);
1200
1188
  },
1201
1189
  setterOpt: (value, options) => {
@@ -1214,7 +1202,7 @@ const states = {
1214
1202
  write: true,
1215
1203
  read: true,
1216
1204
  type: 'string',
1217
- setter: (value) => {
1205
+ setter: value => {
1218
1206
 
1219
1207
  // convert RGB to XY for set
1220
1208
  // const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(value);
@@ -1243,7 +1231,7 @@ const states = {
1243
1231
  getter: payload => {
1244
1232
  if (payload.color && payload.color.hasOwnProperty('x') && payload.color.hasOwnProperty('y')) {
1245
1233
  const colorval = rgb.cie_to_rgb(payload.color.x, payload.color.y);
1246
- return '#' + utils.decimalToHex(colorval[0]) + utils.decimalToHex(colorval[1]) + utils.decimalToHex(colorval[2]);
1234
+ return `#${utils.decimalToHex(colorval[0])}${utils.decimalToHex(colorval[1])}${utils.decimalToHex(colorval[2])}`;
1247
1235
  } else {
1248
1236
  return undefined;
1249
1237
  }
@@ -1269,7 +1257,7 @@ const states = {
1269
1257
  write: true,
1270
1258
  read: true,
1271
1259
  type: 'boolean',
1272
- setter: (value) => {
1260
+ setter: value => {
1273
1261
  return {button: 'single', state: value ? 'decoupled' : 'control_relay'};
1274
1262
  },
1275
1263
  },
@@ -1282,7 +1270,7 @@ const states = {
1282
1270
  write: true,
1283
1271
  read: true,
1284
1272
  type: 'boolean',
1285
- setter: (value) => {
1273
+ setter: value => {
1286
1274
  return {button: 'left', state: value ? 'decoupled' : 'control_left_relay'};
1287
1275
  },
1288
1276
  },
@@ -1295,7 +1283,7 @@ const states = {
1295
1283
  write: true,
1296
1284
  read: true,
1297
1285
  type: 'boolean',
1298
- setter: (value) => {
1286
+ setter: value => {
1299
1287
  return {button: 'right', state: value ? 'decoupled' : 'control_right_relay'};
1300
1288
  },
1301
1289
  },
@@ -1345,7 +1333,7 @@ const states = {
1345
1333
  write: false,
1346
1334
  read: true,
1347
1335
  type: 'string',
1348
- getter: payload => (payload.action === 'circle_click') ? 'press' : (payload.action === 'circle_hold') ? 'hold' : undefined,
1336
+ getter: payload => payload.action === 'circle_click' ? 'press' : payload.action === 'circle_hold' ? 'hold' : undefined,
1349
1337
  },
1350
1338
  switch_state: {
1351
1339
  id: 'state',
@@ -1356,7 +1344,7 @@ const states = {
1356
1344
  write: false,
1357
1345
  read: true,
1358
1346
  type: 'string',
1359
- getter: payload => (payload.action === 'up') ? 'up' : (payload.action === 'down') ? 'down' : (payload.action === 'circle_click') ? 'circle' : undefined,
1347
+ getter: payload => payload.action === 'up' ? 'up' : payload.action === 'down' ? 'down' : payload.action === 'circle_click' ? 'circle' : undefined,
1360
1348
  },
1361
1349
  switch_hold: {
1362
1350
  id: 'hold',
@@ -1367,7 +1355,7 @@ const states = {
1367
1355
  write: false,
1368
1356
  read: true,
1369
1357
  type: 'string',
1370
- getter: payload => (payload.action === 'up_hold') ? 'up' : (payload.action === 'down_hold') ? 'down' : (payload.action === 'circle_hold') ? 'circle': undefined,
1358
+ getter: payload => payload.action === 'up_hold' ? 'up' : (payload.action === 'down_hold' ? 'down' : (payload.action === 'circle_hold' ? 'circle' : undefined)),
1371
1359
  },
1372
1360
  switch_release: {
1373
1361
  id: 'release',
@@ -1378,7 +1366,7 @@ const states = {
1378
1366
  write: false,
1379
1367
  read: true,
1380
1368
  type: 'string',
1381
- getter: payload => (payload.action === 'up_release') ? 'up' : (payload.action === 'down_release') ? 'down' : (payload.action === 'circle_release') ? 'circle': undefined,
1369
+ getter: payload => payload.action === 'up_release' ? 'up' : (payload.action === 'down_release' ? 'down' : (payload.action === 'circle_release' ? 'circle' : undefined)),
1382
1370
  },
1383
1371
  // new RWL states
1384
1372
  rwl_state: {
@@ -1390,7 +1378,7 @@ const states = {
1390
1378
  write: false,
1391
1379
  read: true,
1392
1380
  type: 'boolean',
1393
- getter: payload => (payload.action === 'on-press') ? true : (payload.action === 'off-press') ? false : undefined,
1381
+ getter: payload => payload.action === 'on-press' ? true : payload.action === 'off-press' ? false : undefined,
1394
1382
  },
1395
1383
  rwl_up_button: {
1396
1384
  id: 'up_button',
@@ -1402,7 +1390,7 @@ const states = {
1402
1390
  read: true,
1403
1391
  type: 'boolean',
1404
1392
  isEvent: true,
1405
- getter: payload => (payload.action === 'up-press') ? true : undefined
1393
+ getter: payload => payload.action === 'up-press' ? true : undefined
1406
1394
  },
1407
1395
  rwl_up_hold: {
1408
1396
  id: 'up_hold',
@@ -1414,7 +1402,7 @@ const states = {
1414
1402
  read: true,
1415
1403
  type: 'boolean',
1416
1404
  isEvent: true,
1417
- getter: payload => (payload.action === 'up-hold') ? true : undefined
1405
+ getter: payload => payload.action === 'up-hold' ? true : undefined
1418
1406
  },
1419
1407
  rwl_down_button: {
1420
1408
  id: 'down_button',
@@ -1426,7 +1414,7 @@ const states = {
1426
1414
  read: true,
1427
1415
  type: 'boolean',
1428
1416
  isEvent: true,
1429
- getter: payload => (payload.action === 'down-press') ? true : undefined
1417
+ getter: payload => payload.action === 'down-press' ? true : undefined
1430
1418
  },
1431
1419
  rwl_down_hold: {
1432
1420
  id: 'down_hold',
@@ -1438,7 +1426,7 @@ const states = {
1438
1426
  read: true,
1439
1427
  type: 'boolean',
1440
1428
  isEvent: true,
1441
- getter: payload => (payload.action === 'down-hold') ? true : undefined
1429
+ getter: payload => payload.action === 'down-hold' ? true : undefined
1442
1430
  },
1443
1431
  rwl_counter: {
1444
1432
  id: 'click_count',
@@ -1485,8 +1473,8 @@ const states = {
1485
1473
  min: 0,
1486
1474
  max: 2,
1487
1475
  epname: 'ep2',
1488
- getter: (payload) => (['low','medium','high'].indexOf(payload)),
1489
- setter: (value) => (['low','medium','high'][value]),
1476
+ getter: payload => ['low','medium','high'].indexOf(payload),
1477
+ setter: value => ['low','medium','high'][value],
1490
1478
  },
1491
1479
  */
1492
1480
  sml_sensitivity: {
@@ -1541,8 +1529,8 @@ const states = {
1541
1529
  write: true,
1542
1530
  read: true,
1543
1531
  type: 'boolean',
1544
- getter: (payload) => (payload.state_left === 'ON'),
1545
- setter: (value) => (value) ? 'ON' : 'OFF',
1532
+ getter: payload => payload.state_left === 'ON',
1533
+ setter: value => value ? 'ON' : 'OFF',
1546
1534
  setattr: 'state',
1547
1535
  epname: 'left',
1548
1536
  },
@@ -1555,8 +1543,8 @@ const states = {
1555
1543
  write: true,
1556
1544
  read: true,
1557
1545
  type: 'boolean',
1558
- getter: (payload) => (payload.state_right === 'ON'),
1559
- setter: (value) => (value) ? 'ON' : 'OFF',
1546
+ getter: payload => payload.state_right === 'ON',
1547
+ setter: value => value ? 'ON' : 'OFF',
1560
1548
  setattr: 'state',
1561
1549
  epname: 'right',
1562
1550
  },
@@ -1569,8 +1557,8 @@ const states = {
1569
1557
  write: true,
1570
1558
  read: true,
1571
1559
  type: 'boolean',
1572
- getter: (payload) => (payload.state_center === 'ON'),
1573
- setter: (value) => (value) ? 'ON' : 'OFF',
1560
+ getter: payload => payload.state_center === 'ON',
1561
+ setter: value => value ? 'ON' : 'OFF',
1574
1562
  setattr: 'state',
1575
1563
  epname: 'center',
1576
1564
  },
@@ -1583,8 +1571,8 @@ const states = {
1583
1571
  write: true,
1584
1572
  read: true,
1585
1573
  type: 'boolean',
1586
- getter: (payload) => (payload.state_bottom_left === 'ON'),
1587
- setter: (value) => (value) ? 'ON' : 'OFF',
1574
+ getter: payload => payload.state_bottom_left === 'ON',
1575
+ setter: value => value ? 'ON' : 'OFF',
1588
1576
  setattr: 'state',
1589
1577
  epname: 'bottom_left',
1590
1578
  },
@@ -1597,8 +1585,8 @@ const states = {
1597
1585
  write: true,
1598
1586
  read: true,
1599
1587
  type: 'boolean',
1600
- getter: (payload) => (payload.state_bottom_right === 'ON'),
1601
- setter: (value) => (value) ? 'ON' : 'OFF',
1588
+ getter: payload => payload.state_bottom_right === 'ON',
1589
+ setter: value => value ? 'ON' : 'OFF',
1602
1590
  setattr: 'state',
1603
1591
  epname: 'bottom_right',
1604
1592
  },
@@ -1611,8 +1599,8 @@ const states = {
1611
1599
  write: true,
1612
1600
  read: true,
1613
1601
  type: 'boolean',
1614
- getter: (payload) => (payload.state_top_left === 'ON'),
1615
- setter: (value) => (value) ? 'ON' : 'OFF',
1602
+ getter: payload => payload.state_top_left === 'ON',
1603
+ setter: value => value ? 'ON' : 'OFF',
1616
1604
  setattr: 'state',
1617
1605
  epname: 'top_left',
1618
1606
  },
@@ -1625,8 +1613,8 @@ const states = {
1625
1613
  write: true,
1626
1614
  read: true,
1627
1615
  type: 'boolean',
1628
- getter: (payload) => (payload.state_top_right === 'ON'),
1629
- setter: (value) => (value) ? 'ON' : 'OFF',
1616
+ getter: payload => payload.state_top_right === 'ON',
1617
+ setter: value => value ? 'ON' : 'OFF',
1630
1618
  setattr: 'state',
1631
1619
  epname: 'top_right',
1632
1620
  },
@@ -1640,7 +1628,7 @@ const states = {
1640
1628
  read: true,
1641
1629
  type: 'boolean',
1642
1630
  isEvent: true,
1643
- getter: payload => (payload.action === 'vibration') ? true : undefined,
1631
+ getter: payload => payload.action === 'vibration' ? true : undefined,
1644
1632
  },
1645
1633
  tilt_action: {
1646
1634
  id: 'tilt',
@@ -1652,7 +1640,7 @@ const states = {
1652
1640
  read: true,
1653
1641
  type: 'boolean',
1654
1642
  isEvent: true,
1655
- getter: payload => (payload.action === 'tilt') ? true : undefined,
1643
+ getter: payload => payload.action === 'tilt' ? true : undefined,
1656
1644
  },
1657
1645
  drop_action: {
1658
1646
  id: 'drop',
@@ -1664,7 +1652,7 @@ const states = {
1664
1652
  read: true,
1665
1653
  type: 'boolean',
1666
1654
  isEvent: true,
1667
- getter: payload => (payload.action === 'drop') ? true : undefined,
1655
+ getter: payload => payload.action === 'drop' ? true : undefined,
1668
1656
  },
1669
1657
  tilt_angle: {
1670
1658
  id: 'tilt_angle',
@@ -1736,7 +1724,7 @@ const states = {
1736
1724
  read: true,
1737
1725
  type: 'boolean',
1738
1726
  isEvent: true,
1739
- getter: payload => (payload.action === 'toggle') ? true : undefined,
1727
+ getter: payload => payload.action === 'toggle' ? true : undefined,
1740
1728
  },
1741
1729
  E1524_hold: {
1742
1730
  id: 'hold',
@@ -1748,7 +1736,7 @@ const states = {
1748
1736
  read: true,
1749
1737
  type: 'boolean',
1750
1738
  isEvent: true,
1751
- getter: payload => (payload.action === 'toggle_hold') ? true : undefined,
1739
+ getter: payload => payload.action === 'toggle_hold' ? true : undefined,
1752
1740
  },
1753
1741
  E1524_left_click: {
1754
1742
  id: 'left_click',
@@ -1760,7 +1748,7 @@ const states = {
1760
1748
  read: true,
1761
1749
  type: 'boolean',
1762
1750
  isEvent: true,
1763
- getter: payload => (payload.action === 'arrow_left_click') ? true : undefined,
1751
+ getter: payload => payload.action === 'arrow_left_click' ? true : undefined,
1764
1752
  },
1765
1753
  E1524_right_click: {
1766
1754
  id: 'right_click',
@@ -1772,7 +1760,7 @@ const states = {
1772
1760
  read: true,
1773
1761
  type: 'boolean',
1774
1762
  isEvent: true,
1775
- getter: payload => (payload.action === 'arrow_right_click') ? true : undefined,
1763
+ getter: payload => payload.action === 'arrow_right_click' ? true : undefined,
1776
1764
  },
1777
1765
  E1524_left_button: {
1778
1766
  id: 'left_button',
@@ -1783,7 +1771,7 @@ const states = {
1783
1771
  write: false,
1784
1772
  read: true,
1785
1773
  type: 'boolean',
1786
- getter: payload => (payload.action === 'arrow_left_hold') ? true : (payload.action === 'arrow_left_release') ? false : undefined,
1774
+ getter: payload => payload.action === 'arrow_left_hold' ? true : payload.action === 'arrow_left_release' ? false : undefined,
1787
1775
  },
1788
1776
  E1524_right_button: {
1789
1777
  id: 'right_button',
@@ -1794,7 +1782,7 @@ const states = {
1794
1782
  write: false,
1795
1783
  read: true,
1796
1784
  type: 'boolean',
1797
- getter: payload => (payload.action === 'arrow_right_hold') ? true : (payload.action === 'arrow_right_release') ? false : undefined,
1785
+ getter: payload => payload.action === 'arrow_right_hold' ? true : payload.action === 'arrow_right_release' ? false : undefined,
1798
1786
  },
1799
1787
 
1800
1788
  E1524_up_click: {
@@ -1807,7 +1795,7 @@ const states = {
1807
1795
  read: true,
1808
1796
  type: 'boolean',
1809
1797
  isEvent: true,
1810
- getter: payload => (payload.action === 'brightness_up_click') ? true : undefined,
1798
+ getter: payload => payload.action === 'brightness_up_click' ? true : undefined,
1811
1799
  },
1812
1800
  E1524_down_click: {
1813
1801
  id: 'down_click',
@@ -1819,7 +1807,7 @@ const states = {
1819
1807
  read: true,
1820
1808
  type: 'boolean',
1821
1809
  isEvent: true,
1822
- getter: payload => (payload.action === 'brightness_down_click') ? true : undefined,
1810
+ getter: payload => payload.action === 'brightness_down_click' ? true : undefined,
1823
1811
  },
1824
1812
  E1524_up_button: {
1825
1813
  id: 'up_button',
@@ -1830,7 +1818,7 @@ const states = {
1830
1818
  write: false,
1831
1819
  read: true,
1832
1820
  type: 'boolean',
1833
- getter: payload => (payload.action === 'brightness_up_hold') ? true : (payload.action === 'brightness_up_release') ? false : undefined,
1821
+ getter: payload => payload.action === 'brightness_up_hold' ? true : payload.action === 'brightness_up_release' ? false : undefined,
1834
1822
  },
1835
1823
  E1743_onoff: {
1836
1824
  id: 'state',
@@ -1841,7 +1829,7 @@ const states = {
1841
1829
  write: false,
1842
1830
  read: true,
1843
1831
  type: 'boolean',
1844
- getter: payload => (payload.click === 'on') ? true : ((payload.click === 'off') ? false : undefined),
1832
+ getter: payload => payload.click === 'on' ? true : (payload.click === 'off' ? false : undefined),
1845
1833
  },
1846
1834
  E1743_up_button: {
1847
1835
  id: 'up_button',
@@ -1852,7 +1840,7 @@ const states = {
1852
1840
  write: false,
1853
1841
  read: true,
1854
1842
  type: 'boolean',
1855
- getter: payload => (payload.click === 'brightness_up') ? true : ((payload.click === 'brightness_stop') ? false : undefined),
1843
+ getter: payload => payload.click === 'brightness_up' ? true : (payload.click === 'brightness_stop' ? false : undefined),
1856
1844
  },
1857
1845
  E1743_down_button: {
1858
1846
  id: 'down_button',
@@ -1863,7 +1851,7 @@ const states = {
1863
1851
  write: false,
1864
1852
  read: true,
1865
1853
  type: 'boolean',
1866
- getter: payload => (payload.click === 'brightness_down') ? true : ((payload.click === 'brightness_stop') ? false : undefined),
1854
+ getter: payload => payload.click === 'brightness_down' ? true : (payload.click === 'brightness_stop' ? false : undefined),
1867
1855
  },
1868
1856
  E1524_down_button: {
1869
1857
  id: 'down_button',
@@ -1874,7 +1862,7 @@ const states = {
1874
1862
  write: false,
1875
1863
  read: true,
1876
1864
  type: 'boolean',
1877
- getter: payload => (payload.action === 'brightness_down_hold') ? true : (payload.action === 'brightness_down_release') ? false : undefined,
1865
+ getter: payload => payload.action === 'brightness_down_hold' ? true : payload.action === 'brightness_down_release' ? false : undefined,
1878
1866
  },
1879
1867
  tint404011_onoff: {
1880
1868
  id: 'state',
@@ -1885,7 +1873,7 @@ const states = {
1885
1873
  write: false,
1886
1874
  read: true,
1887
1875
  type: 'boolean',
1888
- getter: payload => (payload.action === 'on') ? true : ((payload.action === 'off') ? false : undefined),
1876
+ getter: payload => payload.action === 'on' ? true : (payload.action === 'off' ? false : undefined),
1889
1877
  },
1890
1878
  tint404011_brightness_up_click: {
1891
1879
  id: 'brightness_up_click',
@@ -1897,7 +1885,7 @@ const states = {
1897
1885
  read: true,
1898
1886
  type: 'boolean',
1899
1887
  isEvent: true,
1900
- getter: payload => (payload.action === 'brightness_up_click') ? true : undefined,
1888
+ getter: payload => payload.action === 'brightness_up_click' ? true : undefined,
1901
1889
  },
1902
1890
  tint404011_brightness_up_hold: {
1903
1891
  id: 'brightness_up_hold',
@@ -1909,7 +1897,7 @@ const states = {
1909
1897
  read: true,
1910
1898
  type: 'boolean',
1911
1899
  isEvent: false,
1912
- getter: payload => (payload.action === 'brightness_up_hold') ? true : ( payload.action === 'brightness_up_release' ) ? false : undefined,
1900
+ getter: payload => payload.action === 'brightness_up_hold' ? true : payload.action === 'brightness_up_release' ? false : undefined,
1913
1901
  },
1914
1902
  tint404011_brightness_down_click: {
1915
1903
  id: 'brightness_down_click',
@@ -1921,7 +1909,7 @@ const states = {
1921
1909
  read: true,
1922
1910
  type: 'boolean',
1923
1911
  isEvent: true,
1924
- getter: payload => (payload.action === 'brightness_down_click') ? true : undefined,
1912
+ getter: payload => payload.action === 'brightness_down_click' ? true : undefined,
1925
1913
  },
1926
1914
  tint404011_brightness_down_hold: {
1927
1915
  id: 'brightness_down_hold',
@@ -1933,7 +1921,7 @@ const states = {
1933
1921
  read: true,
1934
1922
  type: 'boolean',
1935
1923
  isEvent: false,
1936
- getter: payload => (payload.action === 'brightness_down_hold') ? true : ( payload.action === 'brightness_down_release' ) ? false : undefined,
1924
+ getter: payload => payload.action === 'brightness_down_hold' ? true : (payload.action === 'brightness_down_release' ? false : undefined),
1937
1925
  },
1938
1926
  tint404011_colortemp_read: {
1939
1927
  id: 'colortemp',
@@ -1944,7 +1932,7 @@ const states = {
1944
1932
  write: false,
1945
1933
  read: true,
1946
1934
  type: 'number',
1947
- getter: payload => (payload.action === 'color_temp') ? payload.action_color_temperature : undefined,
1935
+ getter: payload => payload.action === 'color_temp' ? payload.action_color_temperature : undefined,
1948
1936
  },
1949
1937
  tint404011_color_read: {
1950
1938
  id: 'color',
@@ -1955,8 +1943,8 @@ const states = {
1955
1943
  write: false,
1956
1944
  read: true,
1957
1945
  type: 'string',
1958
- getter: (payload) => {
1959
- if( payload.action === 'color_wheel') {
1946
+ getter: payload => {
1947
+ if (payload.action === 'color_wheel') {
1960
1948
  const colorval = rgb.cie_to_rgb(payload.action_color.x, payload.action_color.y);
1961
1949
  return '#' + utils.decimalToHex(colorval[0]) + utils.decimalToHex(colorval[1]) + utils.decimalToHex(colorval[2]);
1962
1950
  } else {
@@ -1975,9 +1963,9 @@ const states = {
1975
1963
  read: true,
1976
1964
  type: 'boolean',
1977
1965
  isEvent: true,
1978
- getter: payload => (payload.action === 'scene_3') ? true : undefined,
1966
+ getter: payload => payload.action === 'scene_3' ? true : undefined,
1979
1967
  },
1980
- tint404011_scene_sunset: {
1968
+ tint404011_scene_sunset: {
1981
1969
  // starting with warm-white light at 50% brightness then dims after 15 minutes.
1982
1970
  // after another 10 minutes the light is turned off
1983
1971
  id: 'scene_sunset',
@@ -1989,7 +1977,7 @@ const states = {
1989
1977
  read: true,
1990
1978
  type: 'boolean',
1991
1979
  isEvent: true,
1992
- getter: payload => (payload.action === 'scene_1') ? true : undefined,
1980
+ getter: payload => payload.action === 'scene_1' ? true : undefined,
1993
1981
  },
1994
1982
  tint404011_scene_party: {
1995
1983
  // colourful continuous change of light color
@@ -2002,7 +1990,7 @@ const states = {
2002
1990
  read: true,
2003
1991
  type: 'boolean',
2004
1992
  isEvent: true,
2005
- getter: payload => (payload.action === 'scene_2') ? true : undefined,
1993
+ getter: payload => payload.action === 'scene_2' ? true : undefined,
2006
1994
  },
2007
1995
  tint404011_scene_nightlight: {
2008
1996
  // warm-white light dimmed to 5%
@@ -2015,7 +2003,7 @@ const states = {
2015
2003
  read: true,
2016
2004
  type: 'boolean',
2017
2005
  isEvent: true,
2018
- getter: payload => (payload.action === 'scene_6') ? true : undefined,
2006
+ getter: payload => payload.action === 'scene_6' ? true : undefined,
2019
2007
  },
2020
2008
  tint404011_scene_bonfire: {
2021
2009
  // simulates a bonfire with flickering colours between orange, red and white
@@ -2028,7 +2016,7 @@ const states = {
2028
2016
  read: true,
2029
2017
  type: 'boolean',
2030
2018
  isEvent: true,
2031
- getter: payload => (payload.action === 'scene_4') ? true : undefined,
2019
+ getter: payload => payload.action === 'scene_4' ? true : undefined,
2032
2020
  },
2033
2021
  tint404011_scene_romance: {
2034
2022
  // constantly transitioning colours between red, violet and pink
@@ -2041,7 +2029,7 @@ const states = {
2041
2029
  read: true,
2042
2030
  type: 'boolean',
2043
2031
  isEvent: true,
2044
- getter: payload => (payload.action === 'scene_5') ? true : undefined,
2032
+ getter: payload => payload.action === 'scene_5' ? true : undefined,
2045
2033
  },
2046
2034
  button_action_on: {
2047
2035
  // generic on button with 'action=on' as payload
@@ -2054,7 +2042,7 @@ const states = {
2054
2042
  read: true,
2055
2043
  type: 'boolean',
2056
2044
  isEvent: true,
2057
- getter: payload => (payload.action === 'on') ? true : undefined,
2045
+ getter: payload => payload.action === 'on' ? true : undefined,
2058
2046
  },
2059
2047
  button_action_off: {
2060
2048
  // generic on button with 'action=on' as payload
@@ -2067,7 +2055,7 @@ const states = {
2067
2055
  read: true,
2068
2056
  type: 'boolean',
2069
2057
  isEvent: true,
2070
- getter: payload => (payload.action === 'off') ? true : undefined,
2058
+ getter: payload => payload.action === 'off' ? true : undefined,
2071
2059
  },
2072
2060
  button_action_skip_forward: {
2073
2061
  // generic on button with 'action=on' as payload
@@ -2080,7 +2068,7 @@ const states = {
2080
2068
  read: true,
2081
2069
  type: 'boolean',
2082
2070
  isEvent: true,
2083
- getter: payload => (payload.action === 'skip_forward') ? true : undefined,
2071
+ getter: payload => payload.action === 'skip_forward' ? true : undefined,
2084
2072
  },
2085
2073
  button_action_skip_back: {
2086
2074
  // generic on button with 'action=on' as payload
@@ -2093,7 +2081,7 @@ const states = {
2093
2081
  read: true,
2094
2082
  type: 'boolean',
2095
2083
  isEvent: true,
2096
- getter: payload => (payload.action === 'skip_backward') ? true : undefined,
2084
+ getter: payload => payload.action === 'skip_backward' ? true : undefined,
2097
2085
  },
2098
2086
  button_action_press: {
2099
2087
  id: 'button_press',
@@ -2105,7 +2093,7 @@ const states = {
2105
2093
  read: true,
2106
2094
  type: 'boolean',
2107
2095
  isEvent: false,
2108
- getter: payload => (payload.action === 'press') ? true : undefined,
2096
+ getter: payload => payload.action === 'press' ? true : undefined,
2109
2097
  },
2110
2098
  button_action_hold: {
2111
2099
  id: 'button_hold',
@@ -2117,7 +2105,7 @@ const states = {
2117
2105
  read: true,
2118
2106
  type: 'boolean',
2119
2107
  isEvent: false,
2120
- getter: payload => (payload.action === 'hold') ? true : undefined,
2108
+ getter: payload => payload.action === 'hold' ? true : undefined,
2121
2109
  },
2122
2110
  button_action_release: {
2123
2111
  id: 'button_release',
@@ -2129,7 +2117,7 @@ const states = {
2129
2117
  read: true,
2130
2118
  type: 'boolean',
2131
2119
  isEvent: false,
2132
- getter: payload => (payload.action === 'release') ? true : undefined,
2120
+ getter: payload => payload.action === 'release' ? true : undefined,
2133
2121
  },
2134
2122
 
2135
2123
  // hvac Thermostat cluster - generic states
@@ -2162,8 +2150,8 @@ const states = {
2162
2150
  icon: undefined,
2163
2151
  write: true,
2164
2152
  read: true,
2165
- min: 0,
2166
- max: 7,
2153
+ min: 0,
2154
+ max: 7,
2167
2155
  type: 'number',
2168
2156
  },
2169
2157
  hvacThermostat_control_sequence_of_operation_write: {
@@ -2195,8 +2183,8 @@ const states = {
2195
2183
  write: false,
2196
2184
  read: true,
2197
2185
  type: 'boolean',
2198
- getter: (payload) => (payload.occupancy % 1 === 1),
2199
- setter: (value) => (value) ? 1 : 0,
2186
+ getter: payload => payload.occupancy % 1 === 1,
2187
+ setter: value => value ? 1 : 0,
2200
2188
  setattr: 'state',
2201
2189
  epname: 'left',
2202
2190
  },
@@ -2381,8 +2369,8 @@ const states = {
2381
2369
  min: 0,
2382
2370
  max: 100,
2383
2371
  unit: '%',
2384
- setter: value => { return Math.round(value * 2.55); },
2385
- getter: payload => { return Math.round(payload.eurotronic_valve_position / 2.55); },
2372
+ setter: value => Math.round(value * 2.55),
2373
+ getter: payload => Math.round(payload.eurotronic_valve_position / 2.55),
2386
2374
  },
2387
2375
  SPBZ0001_current_heating_setpoint: { //0x4003
2388
2376
  id: 'heating_setpnt_current',
@@ -2488,12 +2476,8 @@ const states = {
2488
2476
  read: true,
2489
2477
  type: 'boolean',
2490
2478
  inOptions: true,
2491
- setter: (value, options) => {
2492
- return {child_protection: value};
2493
- },
2494
- setterOpt: (value, options) => {
2495
- return {state: {eurotronic_host_flags: {...options, child_protection: !value}}};
2496
- },
2479
+ setter: (value, options) => ({child_protection: value}),
2480
+ setterOpt: (value, options) => ({state: {eurotronic_host_flags: {...options, child_protection: !value}}}),
2497
2481
  getter: payload => payload.eurotronic_host_flags.child_protection,
2498
2482
  },
2499
2483
 
@@ -2507,12 +2491,8 @@ const states = {
2507
2491
  read: true,
2508
2492
  type: 'boolean',
2509
2493
  inOptions: true,
2510
- setter: (value, options) => {
2511
- return {mirror_display: value};
2512
- },
2513
- setterOpt: (value, options) => {
2514
- return {state: {eurotronic_host_flags: {...options, mirror_display: !value}}};
2515
- },
2494
+ setter: (value, options) => ({mirror_display: value}),
2495
+ setterOpt: (value, options) => ({state: {eurotronic_host_flags: {...options, mirror_display: !value}}}),
2516
2496
  getter: payload => payload.eurotronic_host_flags.mirror_display,
2517
2497
  },
2518
2498
  danfoss_window_open: {
@@ -2536,26 +2516,26 @@ const states = {
2536
2516
  type: 'number',
2537
2517
  },
2538
2518
  danfoss_testrun_day_of_week: {
2539
- id: 'testrun_day_of_week',
2519
+ id: 'testrun_day_of_week',
2540
2520
  name: 'testrun_day_of_week',
2541
2521
  prop: 'day_of_week',
2542
- icon: undefined,
2543
- role: 'state',
2522
+ icon: undefined,
2523
+ role: 'state',
2544
2524
  write: true,
2545
- read: true,
2546
- type: 'number',
2525
+ read: true,
2526
+ type: 'number',
2547
2527
  min: 0,
2548
2528
  max: 7,
2549
2529
  },
2550
2530
  danfoss_testrun_hour: {
2551
- id: 'testrun_hour',
2531
+ id: 'testrun_hour',
2552
2532
  name: 'testrun_hour',
2553
2533
  prop: 'trigger_time',
2554
- icon: undefined,
2555
- role: 'state',
2534
+ icon: undefined,
2535
+ role: 'state',
2556
2536
  write: true,
2557
- read: true,
2558
- type: 'number',
2537
+ read: true,
2538
+ type: 'number',
2559
2539
  },
2560
2540
  danfoss_mounted_direction: {
2561
2541
  id: 'thermostat_orientation',
@@ -2586,7 +2566,7 @@ const states = {
2586
2566
  write: false,
2587
2567
  read: true,
2588
2568
  type: 'string',
2589
- getter: payload => (payload.mounted_mode ? 'not Mounted' : 'Mounted'),
2569
+ getter: payload => payload.mounted_mode ? 'not Mounted' : 'Mounted',
2590
2570
  },
2591
2571
  danfoss_algorithm_scale: {
2592
2572
  id: 'algorithm_scale_factor',
@@ -2628,12 +2608,11 @@ const states = {
2628
2608
  role: 'state',
2629
2609
  write: true,
2630
2610
  read: true,
2631
- min: 0,
2632
- max: 1,
2611
+ min: 0,
2612
+ max: 1,
2633
2613
  type: 'number',
2634
2614
  },
2635
- thermostat_keypad_lockout:
2636
- {
2615
+ thermostat_keypad_lockout: {
2637
2616
  id: 'keypad_lockout',
2638
2617
  name: 'Keypad Lockout',
2639
2618
  prop: 'keypad_lockout',
@@ -2713,7 +2692,7 @@ const states = {
2713
2692
  write: false,
2714
2693
  read: true,
2715
2694
  type: 'number',
2716
- getter: payload => (payload.inserted === 'unknown') ? -1 : (payload.inserted === undefined ? null : parseInt(payload.inserted, 10)),
2695
+ getter: payload => payload.inserted === 'unknown' ? -1 : (payload.inserted === undefined ? null : parseInt(payload.inserted, 10)),
2717
2696
  },
2718
2697
  forgotten: {
2719
2698
  id: 'forgotten',
@@ -2724,7 +2703,7 @@ const states = {
2724
2703
  write: false,
2725
2704
  read: true,
2726
2705
  type: 'number',
2727
- getter: payload => (payload.forgotten === undefined ? null : parseInt(payload.forgotten)),
2706
+ getter: payload => payload.forgotten === undefined ? null : parseInt(payload.forgotten),
2728
2707
  },
2729
2708
  key_error: {
2730
2709
  id: 'key_error',
@@ -2746,8 +2725,8 @@ const states = {
2746
2725
  write: true,
2747
2726
  read: true,
2748
2727
  type: 'boolean',
2749
- getter: payload => (payload.state_l1 === 'ON'),
2750
- setter: (value) => (value) ? 'ON' : 'OFF',
2728
+ getter: payload => payload.state_l1 === 'ON',
2729
+ setter: value => value ? 'ON' : 'OFF',
2751
2730
  setattr: 'state',
2752
2731
  epname: 'l1',
2753
2732
  },
@@ -2760,8 +2739,8 @@ const states = {
2760
2739
  write: true,
2761
2740
  read: true,
2762
2741
  type: 'boolean',
2763
- getter: payload => (payload.state_l2 === 'ON'),
2764
- setter: (value) => (value) ? 'ON' : 'OFF',
2742
+ getter: payload => payload.state_l2 === 'ON',
2743
+ setter: value => value ? 'ON' : 'OFF',
2765
2744
  setattr: 'state',
2766
2745
  epname: 'l2',
2767
2746
  },
@@ -2774,8 +2753,8 @@ const states = {
2774
2753
  write: true,
2775
2754
  read: true,
2776
2755
  type: 'boolean',
2777
- getter: payload => (payload.state_l1 === 'ON'),
2778
- setter: (value) => (value) ? 'ON' : 'OFF',
2756
+ getter: payload => payload.state_l1 === 'ON',
2757
+ setter: value => value ? 'ON' : 'OFF',
2779
2758
  setattr: 'state',
2780
2759
  epname: 'l1',
2781
2760
  },
@@ -2788,8 +2767,8 @@ const states = {
2788
2767
  write: true,
2789
2768
  read: true,
2790
2769
  type: 'boolean',
2791
- getter: payload => (payload.state_l2 === 'ON'),
2792
- setter: (value) => (value) ? 'ON' : 'OFF',
2770
+ getter: payload => payload.state_l2 === 'ON',
2771
+ setter: value => value ? 'ON' : 'OFF',
2793
2772
  setattr: 'state',
2794
2773
  epname: 'l2',
2795
2774
  },
@@ -2802,8 +2781,8 @@ const states = {
2802
2781
  write: true,
2803
2782
  read: true,
2804
2783
  type: 'boolean',
2805
- getter: payload => (payload.state_l3 === 'ON'),
2806
- setter: (value) => (value) ? 'ON' : 'OFF',
2784
+ getter: payload => payload.state_l3 === 'ON',
2785
+ setter: value => value ? 'ON' : 'OFF',
2807
2786
  setattr: 'state',
2808
2787
  epname: 'l3',
2809
2788
  },
@@ -2816,7 +2795,7 @@ const states = {
2816
2795
  write: true,
2817
2796
  read: true,
2818
2797
  type: 'string',
2819
- getter: payload => (payload.state === 'LOCK') ? 'locked' : (payload.state === 'UNLOCK') ? 'unlocked' : undefined,
2798
+ getter: payload => payload.state === 'LOCK' ? 'locked' : payload.state === 'UNLOCK' ? 'unlocked' : undefined,
2820
2799
  },
2821
2800
  DIYRUZ_buzzer: {
2822
2801
  id: 'buzzer',
@@ -2827,8 +2806,8 @@ const states = {
2827
2806
  write: true,
2828
2807
  read: true,
2829
2808
  type: 'boolean',
2830
- getter: (payload) => (payload.state_center === 'ON'),
2831
- setter: (value) => (value) ? 'ON' : 'OFF',
2809
+ getter: payload => payload.state_center === 'ON',
2810
+ setter: value => value ? 'ON' : 'OFF',
2832
2811
  setattr: 'state',
2833
2812
  epname: 'center',
2834
2813
  },
@@ -2927,7 +2906,7 @@ const states = {
2927
2906
  min: 0,
2928
2907
  max: 100,
2929
2908
  unit: '%',
2930
- getter: payload => (payload.position !== null) && !isNaN(payload.position) ? payload.position : undefined,
2909
+ getter: payload => payload.position !== null && !isNaN(payload.position) ? payload.position : undefined,
2931
2910
  },
2932
2911
  curtain_stop: {
2933
2912
  id: 'stop',
@@ -2939,7 +2918,7 @@ const states = {
2939
2918
  read: true,
2940
2919
  type: 'boolean',
2941
2920
  isEvent: true,
2942
- setter: value => { return {state: 'stop'}; },
2921
+ setter: value => ({state: 'stop'}),
2943
2922
  },
2944
2923
  curtain_reverse_direction: {
2945
2924
  id: 'reverse_direction',
@@ -2951,9 +2930,7 @@ const states = {
2951
2930
  read: true,
2952
2931
  type: 'boolean',
2953
2932
  isEvent: true,
2954
- setterOpt: (value, options) => {
2955
- return {...options, reverse_direction: value};
2956
- },
2933
+ setterOpt: (value, options) => ({...options, reverse_direction: value}),
2957
2934
  },
2958
2935
  curtain_xiaomi_reverse_direction: {
2959
2936
  id: 'reverse_direction',
@@ -2965,13 +2942,9 @@ const states = {
2965
2942
  read: true,
2966
2943
  type: 'boolean',
2967
2944
  inOptions: true,
2968
- getter: payload => (payload.options !== null) && payload.options.hasOwnProperty('reverse_direction') && !isNaN(payload.options.reverse_direction) ? payload.options.reverse_direction : undefined,
2969
- setterOpt: (value, options) => {
2970
- return {...options, reverse_direction: value};
2971
- },
2972
- setter: (value, options) => {
2973
- return {...options, reverse_direction: value};
2974
- },
2945
+ getter: payload => payload.options !== null && payload.options.hasOwnProperty('reverse_direction') && !isNaN(payload.options.reverse_direction) ? payload.options.reverse_direction : undefined,
2946
+ setterOpt: (value, options) => ({...options, reverse_direction: value}),
2947
+ setter: (value, options) => ({...options, reverse_direction: value}),
2975
2948
  },
2976
2949
  curtain_xiaomi_hand_open: {
2977
2950
  id: 'hand_open',
@@ -2983,13 +2956,9 @@ const states = {
2983
2956
  read: true,
2984
2957
  type: 'boolean',
2985
2958
  inOptions: true,
2986
- getter: payload => (payload.options !== null) && payload.options.hasOwnProperty('hand_open') && !isNaN(payload.options.hand_open) ? payload.options.hand_open : undefined,
2987
- setterOpt: (value, options) => {
2988
- return {...options, hand_open: value};
2989
- },
2990
- setter: (value, options) => {
2991
- return {...options, hand_open: value};
2992
- },
2959
+ getter: payload => payload.options !== null && payload.options.hasOwnProperty('hand_open') && !isNaN(payload.options.hand_open) ? payload.options.hand_open : undefined,
2960
+ setterOpt: (value, options) => ({...options, hand_open: value}),
2961
+ setter: (value, options) => ({...options, hand_open: value}),
2993
2962
  },
2994
2963
  curtain_xiaomi_reset_limits: {
2995
2964
  id: 'reset_limits',
@@ -2999,11 +2968,9 @@ const states = {
2999
2968
  write: true,
3000
2969
  read: true,
3001
2970
  type: 'boolean',
3002
- getter: payload => (undefined),
2971
+ getter: payload => undefined,
3003
2972
  inOptions: true,
3004
- setter: (value, options) => {
3005
- return {...options, reset_limits: value};
3006
- },
2973
+ setter: (value, options) => ({...options, reset_limits: value}),
3007
2974
  },
3008
2975
  blind_position: {
3009
2976
  id: 'position',
@@ -3017,7 +2984,7 @@ const states = {
3017
2984
  min: 0,
3018
2985
  max: 100,
3019
2986
  unit: '%',
3020
- getter: payload => (payload.position !== null) && !isNaN(payload.position) ? payload.position : undefined,
2987
+ getter: payload => payload.position !== null && !isNaN(payload.position) ? payload.position : undefined,
3021
2988
  },
3022
2989
  blind_stop: {
3023
2990
  id: 'stop',
@@ -3029,7 +2996,7 @@ const states = {
3029
2996
  read: true,
3030
2997
  type: 'boolean',
3031
2998
  isEvent: true,
3032
- setter: value => { return 'STOP'; },
2999
+ setter: value => 'STOP',
3033
3000
  },
3034
3001
  blind_open: {
3035
3002
  id: 'open',
@@ -3041,7 +3008,7 @@ const states = {
3041
3008
  read: true,
3042
3009
  type: 'boolean',
3043
3010
  isEvent: true,
3044
- setter: value => { return 'OPEN'; },
3011
+ setter: value => 'OPEN',
3045
3012
  },
3046
3013
  blind_close: {
3047
3014
  id: 'close',
@@ -3053,7 +3020,7 @@ const states = {
3053
3020
  read: true,
3054
3021
  type: 'boolean',
3055
3022
  isEvent: true,
3056
- setter: value => { return 'CLOSE'; },
3023
+ setter: value => 'CLOSE',
3057
3024
  },
3058
3025
  hold: {
3059
3026
  id: 'hold',
@@ -3064,7 +3031,7 @@ const states = {
3064
3031
  write: false,
3065
3032
  read: true,
3066
3033
  type: 'boolean',
3067
- getter: payload => (payload.action === 'hold') ? true : (payload.action === 'release') ? false : undefined,
3034
+ getter: payload => payload.action === 'hold' ? true : payload.action === 'release' ? false : undefined,
3068
3035
  },
3069
3036
  keypad_btn1: {
3070
3037
  id: 'btn_1',
@@ -3086,7 +3053,7 @@ const states = {
3086
3053
  read: true,
3087
3054
  type: 'boolean',
3088
3055
  isEvent: true,
3089
- getter: payload => (payload.action === 'stop') ? true : false,
3056
+ getter: payload => payload.action === 'stop',
3090
3057
  },
3091
3058
  ZYCT202_on: {
3092
3059
  id: 'off',
@@ -3098,7 +3065,7 @@ const states = {
3098
3065
  read: true,
3099
3066
  type: 'boolean',
3100
3067
  isEvent: true,
3101
- getter: payload => (payload.action === 'on') ? true : false,
3068
+ getter: payload => payload.action === 'on',
3102
3069
  },
3103
3070
  ZYCT202_off: {
3104
3071
  id: 'off',
@@ -3110,7 +3077,7 @@ const states = {
3110
3077
  read: true,
3111
3078
  type: 'boolean',
3112
3079
  isEvent: true,
3113
- getter: payload => (payload.action === 'off') ? true : false,
3080
+ getter: payload => payload.action === 'off',
3114
3081
  },
3115
3082
  ZYCT202_up: {
3116
3083
  id: 'up',
@@ -3122,7 +3089,7 @@ const states = {
3122
3089
  read: true,
3123
3090
  type: 'boolean',
3124
3091
  isEvent: true,
3125
- getter: payload => (payload.action === 'up-press') ? true : false,
3092
+ getter: payload => payload.action === 'up-press',
3126
3093
  },
3127
3094
  ZYCT202_down: {
3128
3095
  id: 'down',
@@ -3134,7 +3101,7 @@ const states = {
3134
3101
  read: true,
3135
3102
  type: 'boolean',
3136
3103
  isEvent: true,
3137
- getter: payload => (payload.action === 'down-press') ? true : false,
3104
+ getter: payload => payload.action === 'down-press',
3138
3105
  },
3139
3106
  keypad_btn2: {
3140
3107
  id: 'btn_2',
@@ -3335,7 +3302,7 @@ const states = {
3335
3302
  write: false,
3336
3303
  read: true,
3337
3304
  type: 'string',
3338
- getter: payload => (payload.occupancy === true) ? payload.side : undefined,
3305
+ getter: payload => payload.occupancy === true ? payload.side : undefined,
3339
3306
  },
3340
3307
  btn1_pressed: {
3341
3308
  id: 'btn_1_pressed',
@@ -3346,7 +3313,7 @@ const states = {
3346
3313
  write: false,
3347
3314
  read: true,
3348
3315
  type: 'boolean',
3349
- getter: payload => (payload.btn_1 === 'hold') ? true : (payload.btn_1 === 'release') ? false : undefined,
3316
+ getter: payload => payload.btn_1 === 'hold' ? true : payload.btn_1 === 'release' ? false : undefined,
3350
3317
  },
3351
3318
  btn1_click: {
3352
3319
  id: 'btn_1',
@@ -3356,7 +3323,7 @@ const states = {
3356
3323
  write: false,
3357
3324
  read: true,
3358
3325
  type: 'boolean',
3359
- getter: payload => (payload.btn_1 === 'click') ? true : undefined,
3326
+ getter: payload => payload.btn_1 === 'click' ? true : undefined,
3360
3327
  isEvent: true,
3361
3328
  },
3362
3329
  btn2_pressed: {
@@ -3368,7 +3335,7 @@ const states = {
3368
3335
  write: false,
3369
3336
  read: true,
3370
3337
  type: 'boolean',
3371
- getter: payload => (payload.btn_2 === 'hold') ? true : (payload.btn_2 === 'release') ? false : undefined,
3338
+ getter: payload => payload.btn_2 === 'hold' ? true : payload.btn_2 === 'release' ? false : undefined,
3372
3339
  },
3373
3340
  btn2_click: {
3374
3341
  id: 'btn_2',
@@ -3378,7 +3345,7 @@ const states = {
3378
3345
  write: false,
3379
3346
  read: true,
3380
3347
  type: 'boolean',
3381
- getter: payload => (payload.btn_2 === 'click') ? true : undefined,
3348
+ getter: payload => payload.btn_2 === 'click' ? true : undefined,
3382
3349
  isEvent: true,
3383
3350
  },
3384
3351
  btn3_pressed: {
@@ -3390,7 +3357,7 @@ const states = {
3390
3357
  write: false,
3391
3358
  read: true,
3392
3359
  type: 'boolean',
3393
- getter: payload => (payload.btn_3 === 'hold') ? true : (payload.btn_3 === 'release') ? false : undefined,
3360
+ getter: payload => payload.btn_3 === 'hold' ? true : payload.btn_3 === 'release' ? false : undefined,
3394
3361
  },
3395
3362
  btn3_click: {
3396
3363
  id: 'btn_3',
@@ -3400,7 +3367,7 @@ const states = {
3400
3367
  write: false,
3401
3368
  read: true,
3402
3369
  type: 'boolean',
3403
- getter: payload => (payload.btn_3 === 'click') ? true : undefined,
3370
+ getter: payload => payload.btn_3 === 'click' ? true : undefined,
3404
3371
  isEvent: true,
3405
3372
  },
3406
3373
  btn4_pressed: {
@@ -3412,7 +3379,7 @@ const states = {
3412
3379
  write: false,
3413
3380
  read: true,
3414
3381
  type: 'boolean',
3415
- getter: payload => (payload.btn_4 === 'hold') ? true : (payload.btn_4 === 'release') ? false : undefined,
3382
+ getter: payload => payload.btn_4 === 'hold' ? true : payload.btn_4 === 'release' ? false : undefined,
3416
3383
  },
3417
3384
  btn4_click: {
3418
3385
  id: 'btn_4',
@@ -3422,7 +3389,7 @@ const states = {
3422
3389
  write: false,
3423
3390
  read: true,
3424
3391
  type: 'boolean',
3425
- getter: payload => (payload.btn_4 === 'click') ? true : undefined,
3392
+ getter: payload => payload.btn_4 === 'click' ? true : undefined,
3426
3393
  isEvent: true,
3427
3394
  },
3428
3395
  aqara_opple_1: {
@@ -3434,7 +3401,7 @@ const states = {
3434
3401
  write: false,
3435
3402
  read: true,
3436
3403
  type: 'boolean',
3437
- getter: payload => (payload.action === 'button_1_single') ? true : undefined,
3404
+ getter: payload => payload.action === 'button_1_single' ? true : undefined,
3438
3405
  isEvent: true,
3439
3406
  },
3440
3407
  aqara_opple_1_double: {
@@ -3446,7 +3413,7 @@ const states = {
3446
3413
  write: false,
3447
3414
  read: true,
3448
3415
  type: 'boolean',
3449
- getter: payload => (payload.action === 'button_1_double') ? true : undefined,
3416
+ getter: payload => payload.action === 'button_1_double' ? true : undefined,
3450
3417
  isEvent: true,
3451
3418
  },
3452
3419
  aqara_opple_1_triple: {
@@ -3458,7 +3425,7 @@ const states = {
3458
3425
  write: false,
3459
3426
  read: true,
3460
3427
  type: 'boolean',
3461
- getter: payload => (payload.action === 'button_1_triple') ? true : undefined,
3428
+ getter: payload => payload.action === 'button_1_triple' ? true : undefined,
3462
3429
  isEvent: true,
3463
3430
  },
3464
3431
  aqara_opple_1_hold: {
@@ -3470,7 +3437,7 @@ const states = {
3470
3437
  write: false,
3471
3438
  read: true,
3472
3439
  type: 'boolean',
3473
- getter: payload => (payload.action === 'button_1_hold') ? true : (payload.action === 'button_1_release') ? false : undefined,
3440
+ getter: payload => payload.action === 'button_1_hold' ? true : payload.action === 'button_1_release' ? false : undefined,
3474
3441
  },
3475
3442
  aqara_opple_2: {
3476
3443
  id: 'button_2_click',
@@ -3481,7 +3448,7 @@ const states = {
3481
3448
  write: false,
3482
3449
  read: true,
3483
3450
  type: 'boolean',
3484
- getter: payload => (payload.action === 'button_2_single') ? true : undefined,
3451
+ getter: payload => payload.action === 'button_2_single' ? true : undefined,
3485
3452
  isEvent: true,
3486
3453
  },
3487
3454
  aqara_opple_2_double: {
@@ -3493,7 +3460,7 @@ const states = {
3493
3460
  write: false,
3494
3461
  read: true,
3495
3462
  type: 'boolean',
3496
- getter: payload => (payload.action === 'button_2_double') ? true : undefined,
3463
+ getter: payload => payload.action === 'button_2_double' ? true : undefined,
3497
3464
  isEvent: true,
3498
3465
  },
3499
3466
  aqara_opple_2_triple: {
@@ -3505,7 +3472,7 @@ const states = {
3505
3472
  write: false,
3506
3473
  read: true,
3507
3474
  type: 'boolean',
3508
- getter: payload => (payload.action === 'button_2_triple') ? true : undefined,
3475
+ getter: payload => payload.action === 'button_2_triple' ? true : undefined,
3509
3476
  isEvent: true,
3510
3477
  },
3511
3478
  aqara_opple_2_hold: {
@@ -3517,7 +3484,7 @@ const states = {
3517
3484
  write: false,
3518
3485
  read: true,
3519
3486
  type: 'boolean',
3520
- getter: payload => (payload.action === 'button_2_hold') ? true : (payload.action === 'button_2_release') ? false : undefined,
3487
+ getter: payload => payload.action === 'button_2_hold' ? true : payload.action === 'button_2_release' ? false : undefined,
3521
3488
  },
3522
3489
  aqara_opple_3: {
3523
3490
  id: 'button_3_click',
@@ -3528,7 +3495,7 @@ const states = {
3528
3495
  write: false,
3529
3496
  read: true,
3530
3497
  type: 'boolean',
3531
- getter: payload => (payload.action === 'button_3_single') ? true : undefined,
3498
+ getter: payload => payload.action === 'button_3_single' ? true : undefined,
3532
3499
  isEvent: true,
3533
3500
  },
3534
3501
  aqara_opple_3_double: {
@@ -3540,7 +3507,7 @@ const states = {
3540
3507
  write: false,
3541
3508
  read: true,
3542
3509
  type: 'boolean',
3543
- getter: payload => (payload.action === 'button_3_double') ? true : undefined,
3510
+ getter: payload => payload.action === 'button_3_double' ? true : undefined,
3544
3511
  isEvent: true,
3545
3512
  },
3546
3513
  aqara_opple_3_triple: {
@@ -3552,7 +3519,7 @@ const states = {
3552
3519
  write: false,
3553
3520
  read: true,
3554
3521
  type: 'boolean',
3555
- getter: payload => (payload.action === 'button_3_triple') ? true : undefined,
3522
+ getter: payload => payload.action === 'button_3_triple' ? true : undefined,
3556
3523
  isEvent: true,
3557
3524
  },
3558
3525
  aqara_opple_3_hold: {
@@ -3564,7 +3531,7 @@ const states = {
3564
3531
  write: false,
3565
3532
  read: true,
3566
3533
  type: 'boolean',
3567
- getter: payload => (payload.action === 'button_3_hold') ? true : (payload.action === 'button_3_release') ? false : undefined,
3534
+ getter: payload => payload.action === 'button_3_hold' ? true : payload.action === 'button_3_release' ? false : undefined,
3568
3535
  },
3569
3536
  aqara_opple_4: {
3570
3537
  id: 'button_4_click',
@@ -3575,7 +3542,7 @@ const states = {
3575
3542
  write: false,
3576
3543
  read: true,
3577
3544
  type: 'boolean',
3578
- getter: payload => (payload.action === 'button_4_single') ? true : undefined,
3545
+ getter: payload => payload.action === 'button_4_single' ? true : undefined,
3579
3546
  isEvent: true,
3580
3547
  },
3581
3548
  aqara_opple_4_double: {
@@ -3587,7 +3554,7 @@ const states = {
3587
3554
  write: false,
3588
3555
  read: true,
3589
3556
  type: 'boolean',
3590
- getter: payload => (payload.action === 'button_4_double') ? true : undefined,
3557
+ getter: payload => payload.action === 'button_4_double' ? true : undefined,
3591
3558
  isEvent: true,
3592
3559
  },
3593
3560
  aqara_opple_4_triple: {
@@ -3599,7 +3566,7 @@ const states = {
3599
3566
  write: false,
3600
3567
  read: true,
3601
3568
  type: 'boolean',
3602
- getter: payload => (payload.action === 'button_4_triple') ? true : undefined,
3569
+ getter: payload => payload.action === 'button_4_triple' ? true : undefined,
3603
3570
  isEvent: true,
3604
3571
  },
3605
3572
  aqara_opple_4_hold: {
@@ -3611,7 +3578,7 @@ const states = {
3611
3578
  write: false,
3612
3579
  read: true,
3613
3580
  type: 'boolean',
3614
- getter: payload => (payload.action === 'button_4_hold') ? true : (payload.action === 'button_4_release') ? false : undefined,
3581
+ getter: payload => payload.action === 'button_4_hold' ? true : payload.action === 'button_4_release' ? false : undefined,
3615
3582
  },
3616
3583
  aqara_opple_5: {
3617
3584
  id: 'button_5_click',
@@ -3622,7 +3589,7 @@ const states = {
3622
3589
  write: false,
3623
3590
  read: true,
3624
3591
  type: 'boolean',
3625
- getter: payload => (payload.action === 'button_5_single') ? true : undefined,
3592
+ getter: payload => payload.action === 'button_5_single' ? true : undefined,
3626
3593
  isEvent: true,
3627
3594
  },
3628
3595
  aqara_opple_5_double: {
@@ -3634,7 +3601,7 @@ const states = {
3634
3601
  write: false,
3635
3602
  read: true,
3636
3603
  type: 'boolean',
3637
- getter: payload => (payload.action === 'button_5_double') ? true : undefined,
3604
+ getter: payload => payload.action === 'button_5_double' ? true : undefined,
3638
3605
  isEvent: true,
3639
3606
  },
3640
3607
  aqara_opple_5_triple: {
@@ -3646,7 +3613,7 @@ const states = {
3646
3613
  write: false,
3647
3614
  read: true,
3648
3615
  type: 'boolean',
3649
- getter: payload => (payload.action === 'button_5_triple') ? true : undefined,
3616
+ getter: payload => payload.action === 'button_5_triple' ? true : undefined,
3650
3617
  isEvent: true,
3651
3618
  },
3652
3619
  aqara_opple_5_hold: {
@@ -3658,7 +3625,7 @@ const states = {
3658
3625
  write: false,
3659
3626
  read: true,
3660
3627
  type: 'boolean',
3661
- getter: payload => (payload.action === 'button_5_hold') ? true : (payload.action === 'button_5_release') ? false : undefined,
3628
+ getter: payload => payload.action === 'button_5_hold' ? true : payload.action === 'button_5_release' ? false : undefined,
3662
3629
  },
3663
3630
  aqara_opple_6: {
3664
3631
  id: 'button_6_click',
@@ -3669,7 +3636,7 @@ const states = {
3669
3636
  write: false,
3670
3637
  read: true,
3671
3638
  type: 'boolean',
3672
- getter: payload => (payload.action === 'button_6_single') ? true : undefined,
3639
+ getter: payload => payload.action === 'button_6_single' ? true : undefined,
3673
3640
  isEvent: true,
3674
3641
  },
3675
3642
  aqara_opple_6_double: {
@@ -3681,7 +3648,7 @@ const states = {
3681
3648
  write: false,
3682
3649
  read: true,
3683
3650
  type: 'boolean',
3684
- getter: payload => (payload.action === 'button_6_double') ? true : undefined,
3651
+ getter: payload => payload.action === 'button_6_double' ? true : undefined,
3685
3652
  isEvent: true,
3686
3653
  },
3687
3654
  aqara_opple_6_triple: {
@@ -3693,7 +3660,7 @@ const states = {
3693
3660
  write: false,
3694
3661
  read: true,
3695
3662
  type: 'boolean',
3696
- getter: payload => (payload.action === 'button_6_triple') ? true : undefined,
3663
+ getter: payload => payload.action === 'button_6_triple' ? true : undefined,
3697
3664
  isEvent: true,
3698
3665
  },
3699
3666
  aqara_opple_6_hold: {
@@ -3705,7 +3672,7 @@ const states = {
3705
3672
  write: false,
3706
3673
  read: true,
3707
3674
  type: 'boolean',
3708
- getter: payload => (payload.action === 'button_6_hold') ? true : (payload.action === 'button_6_release') ? false : undefined,
3675
+ getter: payload => payload.action === 'button_6_hold' ? true : payload.action === 'button_6_release' ? false : undefined,
3709
3676
  },
3710
3677
  aqara_opple_mode: {
3711
3678
  id: 'mode',
@@ -3716,7 +3683,7 @@ const states = {
3716
3683
  write: true,
3717
3684
  read: true,
3718
3685
  type: 'boolean',
3719
- setter: (value) => (value) ? 'command' : 'event',
3686
+ setter: value => value ? 'command' : 'event',
3720
3687
  },
3721
3688
  genOnOff: {
3722
3689
  id: 'genOnOff',
@@ -3728,7 +3695,7 @@ const states = {
3728
3695
  read: true,
3729
3696
  type: 'boolean',
3730
3697
  isEvent: false,
3731
- getter: payload => (payload.click === 'on' ? true : payload.click === 'off' ? false : undefined),
3698
+ getter: payload => payload.click === 'on' ? true : payload.click === 'off' ? false : undefined,
3732
3699
  },
3733
3700
  sensitivity: {
3734
3701
  id: 'sensitivity',
@@ -3751,7 +3718,7 @@ const states = {
3751
3718
  read: true,
3752
3719
  type: 'boolean',
3753
3720
  isEvent: true,
3754
- getter: payload => (payload.click === 'release') ? true : undefined,
3721
+ getter: payload => payload.click === 'release' ? true : undefined,
3755
3722
  },
3756
3723
  cover_open: {
3757
3724
  id: 'cover_open',
@@ -3763,7 +3730,7 @@ const states = {
3763
3730
  read: true,
3764
3731
  type: 'boolean',
3765
3732
  isEvent: true,
3766
- getter: payload => (payload.click === 'open') ? true : undefined,
3733
+ getter: payload => payload.click === 'open' ? true : undefined,
3767
3734
  },
3768
3735
  cover_release: {
3769
3736
  id: 'cover_release',
@@ -3775,7 +3742,7 @@ const states = {
3775
3742
  read: true,
3776
3743
  type: 'boolean',
3777
3744
  isEvent: true,
3778
- getter: payload => (payload.click === 'release') ? true : undefined,
3745
+ getter: payload => payload.click === 'release' ? true : undefined,
3779
3746
  },
3780
3747
  cover_close: {
3781
3748
  id: 'cover_close',
@@ -3787,7 +3754,7 @@ const states = {
3787
3754
  read: true,
3788
3755
  type: 'boolean',
3789
3756
  isEvent: true,
3790
- getter: payload => (payload.click === 'close') ? true : undefined,
3757
+ getter: payload => payload.click === 'close' ? true : undefined,
3791
3758
  },
3792
3759
  disarm: {
3793
3760
  id: 'disarm',
@@ -3799,7 +3766,7 @@ const states = {
3799
3766
  read: true,
3800
3767
  type: 'boolean',
3801
3768
  isEvent: true,
3802
- getter: payload => (payload.action === 'disarm') ? true : undefined,
3769
+ getter: payload => payload.action === 'disarm' ? true : undefined,
3803
3770
  },
3804
3771
  arm_stay: {
3805
3772
  id: 'arm_stay',
@@ -3811,7 +3778,7 @@ const states = {
3811
3778
  read: true,
3812
3779
  type: 'boolean',
3813
3780
  isEvent: true,
3814
- getter: payload => (payload.action === 'arm_day_zones') ? true : undefined,
3781
+ getter: payload => payload.action === 'arm_day_zones' ? true : undefined,
3815
3782
  },
3816
3783
  arm_away: {
3817
3784
  id: 'arm_away',
@@ -3823,7 +3790,7 @@ const states = {
3823
3790
  read: true,
3824
3791
  type: 'boolean',
3825
3792
  isEvent: true,
3826
- getter: payload => (payload.action === 'arm_all_zones') ? true : undefined,
3793
+ getter: payload => payload.action === 'arm_all_zones' ? true : undefined,
3827
3794
  },
3828
3795
  emergency: {
3829
3796
  id: 'emergency',
@@ -3835,7 +3802,7 @@ const states = {
3835
3802
  read: true,
3836
3803
  type: 'boolean',
3837
3804
  isEvent: true,
3838
- getter: payload => (payload.action === 'emergency') ? true : undefined,
3805
+ getter: payload => payload.action === 'emergency' ? true : undefined,
3839
3806
  },
3840
3807
  white_brightness: {
3841
3808
  id: 'white_brightness',
@@ -3873,8 +3840,8 @@ const states = {
3873
3840
  write: true,
3874
3841
  read: true,
3875
3842
  type: 'boolean',
3876
- getter: payload => (payload.state === 'ON'),
3877
- setter: (value) => (value) ? 'ON' : 'OFF',
3843
+ getter: payload => payload.state === 'ON',
3844
+ setter: value => value ? 'ON' : 'OFF',
3878
3845
  epname: 'white',
3879
3846
  },
3880
3847
  white_colortemp: {
@@ -3929,8 +3896,8 @@ const states = {
3929
3896
  write: true,
3930
3897
  read: true,
3931
3898
  type: 'boolean',
3932
- getter: payload => (payload.state === 'ON'),
3933
- setter: (value) => (value) ? 'ON' : 'OFF',
3899
+ getter: payload => payload.state === 'ON',
3900
+ setter: value => value ? 'ON' : 'OFF',
3934
3901
  epname: 'cct',
3935
3902
  },
3936
3903
  white8_colortemp: {
@@ -3957,11 +3924,9 @@ const states = {
3957
3924
  write: true,
3958
3925
  read: true,
3959
3926
  type: 'boolean',
3960
- getter: payload => (payload.state === 'ON'),
3961
- setter: (value) => (value) ? 'ON' : 'OFF',
3962
- setterOpt: (value, options) => {
3963
- return {...options, state: {white_value: -1}};
3964
- },
3927
+ getter: payload => payload.state === 'ON',
3928
+ setter: value => value ? 'ON' : 'OFF',
3929
+ setterOpt: (value, options) => ({...options, state: {white_value: -1}}),
3965
3930
  inOptions: true,
3966
3931
  epname: 'rgb',
3967
3932
  },
@@ -4016,13 +3981,13 @@ const states = {
4016
3981
  write: true,
4017
3982
  read: true,
4018
3983
  type: 'string',
4019
- setter: (value) => {
3984
+ setter: value => {
4020
3985
  let xy = [0, 0];
4021
3986
  const rgbcolor = colors.ParseColor(value);
4022
3987
  xy = rgb.rgb_to_cie(rgbcolor.r, rgbcolor.g, rgbcolor.b);
4023
3988
  return {
4024
3989
  x: xy[0],
4025
- y: xy[1]
3990
+ y: xy[1],
4026
3991
  };
4027
3992
  },
4028
3993
  setterOpt: (value, options) => {
@@ -4041,8 +4006,8 @@ const states = {
4041
4006
  write: true,
4042
4007
  read: true,
4043
4008
  type: 'boolean',
4044
- getter: payload => (payload.system_mode === 'heat'),
4045
- setter: (value) => (value) ? 'heat' : 'off',
4009
+ getter: payload => payload.system_mode === 'heat',
4010
+ setter: value => value ? 'heat' : 'off',
4046
4011
  },
4047
4012
  moes_trv_system_mode: {
4048
4013
  id: 'system_mode',
@@ -4065,7 +4030,7 @@ const states = {
4065
4030
  write: false,
4066
4031
  read: true,
4067
4032
  type: 'boolean',
4068
- getter: payload => (payload.heat === 'ON'),
4033
+ getter: payload => payload.heat === 'ON',
4069
4034
  },
4070
4035
  moes_trv_sensor: {
4071
4036
  id: 'sensor',
@@ -4077,7 +4042,7 @@ const states = {
4077
4042
  read: true,
4078
4043
  type: 'string', // valid: IN, AL, OU
4079
4044
  states: 'IN:IN;AL:AL;OU:OU',
4080
- setter: (value) => (value) === 'IN' ? 0 : (value) === 'AL' ? 1 : (value) === 'OU' ? 2 : 0,
4045
+ setter: value => value === 'IN' ? 0 : (value === 'AL' ? 1 : (value === 'OU' ? 2 : 0)),
4081
4046
  },
4082
4047
  tuya_trv_target_temperature: {
4083
4048
  id: 'target_temperature',
@@ -4101,8 +4066,8 @@ const states = {
4101
4066
  write: true,
4102
4067
  read: true,
4103
4068
  type: 'boolean',
4104
- getter: payload => (payload.child_lock === 'LOCKED'),
4105
- setter: (value) => (value) ? 'LOCK': 'UNLOCK',
4069
+ getter: payload => payload.child_lock === 'LOCKED',
4070
+ setter: value => value ? 'LOCK' : 'UNLOCK',
4106
4071
  },
4107
4072
  tuya_trv_window_detected: {
4108
4073
  id: 'window_detected',
@@ -4113,7 +4078,7 @@ const states = {
4113
4078
  write: false,
4114
4079
  read: true,
4115
4080
  type: 'boolean',
4116
- getter: payload => (payload.window_detection === 'ON'),
4081
+ getter: payload => payload.window_detection === 'ON',
4117
4082
  },
4118
4083
  tuya_trv_valve_detected: {
4119
4084
  id: 'valve_detected',
@@ -4124,7 +4089,7 @@ const states = {
4124
4089
  write: false,
4125
4090
  read: true,
4126
4091
  type: 'boolean',
4127
- getter: payload => (payload.valve_detection === 'ON'),
4092
+ getter: payload => payload.valve_detection === 'ON',
4128
4093
  },
4129
4094
  tuya_trv_auto_lock: {
4130
4095
  id: 'auto_lock',
@@ -4135,7 +4100,7 @@ const states = {
4135
4100
  write: false,
4136
4101
  read: true,
4137
4102
  type: 'boolean',
4138
- getter: payload => (payload.auto_lock === 'AUTO'),
4103
+ getter: payload => payload.auto_lock === 'AUTO',
4139
4104
  },
4140
4105
  tuya_trv_min_temp: {
4141
4106
  id: 'min_temperature',
@@ -4233,8 +4198,8 @@ const states = {
4233
4198
  read: true,
4234
4199
  type: 'boolean',
4235
4200
  isEvent: true,
4236
- getter: payload => (payload.action === 'ON') ? true : false,
4237
- setter: (value) => (value) ? 'ON' : 'OFF',
4201
+ getter: payload => payload.action === 'ON',
4202
+ setter: value => value ? 'ON' : 'OFF',
4238
4203
  },
4239
4204
  climate_system_mode: {
4240
4205
  id: 'mode',
@@ -4292,7 +4257,7 @@ const states = {
4292
4257
  write: false,
4293
4258
  read: true,
4294
4259
  type: 'number',
4295
- getter: payload => (payload.click === 'off') ? 0 : (payload.click === 'on') ? 1 : parseInt(payload.click) + 1,
4260
+ getter: payload => payload.click === 'off' ? 0 : (payload.click === 'on' ? 1 : (parseInt(payload.click) + 1)),
4296
4261
  },
4297
4262
  icasa_click: {
4298
4263
  id: 'click',
@@ -4303,7 +4268,7 @@ const states = {
4303
4268
  write: false,
4304
4269
  read: true,
4305
4270
  type: 'boolean',
4306
- getter: payload => (payload.click === 'off') ? false : (payload.click === 'on') ? true : undefined,
4271
+ getter: payload => payload.click === 'off' ? false : (payload.click === 'on' ? true : undefined),
4307
4272
  },
4308
4273
  icasa_action: {
4309
4274
  id: 'rotation',
@@ -4314,7 +4279,7 @@ const states = {
4314
4279
  write: false,
4315
4280
  read: true,
4316
4281
  type: 'string',
4317
- getter: payload => (payload.action === 'rotate_left') ? 'left' : (payload.action === 'rotate_right') ? 'right' : (payload.action === 'rotate_stop') ? 'stop' : undefined,
4282
+ getter: payload => payload.action === 'rotate_left' ? 'left' : (payload.action === 'rotate_right' ? 'right' : (payload.action === 'rotate_stop' ? 'stop' : undefined)),
4318
4283
  },
4319
4284
  icasa_brightness: {
4320
4285
  id: 'brightness',
@@ -4336,8 +4301,8 @@ const states = {
4336
4301
  write: true,
4337
4302
  read: true,
4338
4303
  type: 'boolean',
4339
- getter: payload => (payload.state_top === 'ON'),
4340
- setter: (value) => (value) ? 'ON' : 'OFF',
4304
+ getter: payload => payload.state_top === 'ON',
4305
+ setter: value => value ? 'ON' : 'OFF',
4341
4306
  setattr: 'state',
4342
4307
  epname: 'top',
4343
4308
  },
@@ -4350,8 +4315,8 @@ const states = {
4350
4315
  write: true,
4351
4316
  read: true,
4352
4317
  type: 'boolean',
4353
- getter: payload => (payload.state_bottom === 'ON'),
4354
- setter: (value) => (value) ? 'ON' : 'OFF',
4318
+ getter: payload => payload.state_bottom === 'ON',
4319
+ setter: value => value ? 'ON' : 'OFF',
4355
4320
  setattr: 'state',
4356
4321
  epname: 'bottom',
4357
4322
  },
@@ -4384,7 +4349,7 @@ const states = {
4384
4349
  write: false,
4385
4350
  read: true,
4386
4351
  type: 'boolean',
4387
- getter: payload => (payload.action === '2_single') ? true : undefined,
4352
+ getter: payload => payload.action === '2_single' ? true : undefined,
4388
4353
  isEvent: true,
4389
4354
  },
4390
4355
  ts0042_left_click: {
@@ -4396,7 +4361,7 @@ const states = {
4396
4361
  write: false,
4397
4362
  read: true,
4398
4363
  type: 'boolean',
4399
- getter: payload => (payload.action === '1_single') ? true : undefined,
4364
+ getter: payload => payload.action === '1_single' ? true : undefined,
4400
4365
  isEvent: true,
4401
4366
  },
4402
4367
  ts0042_right_double: {
@@ -4408,7 +4373,7 @@ const states = {
4408
4373
  write: false,
4409
4374
  read: true,
4410
4375
  type: 'boolean',
4411
- getter: payload => (payload.action === '2_double') ? true : undefined,
4376
+ getter: payload => payload.action === '2_double' ? true : undefined,
4412
4377
  isEvent: true,
4413
4378
  },
4414
4379
  ts0042_left_double: {
@@ -4420,7 +4385,7 @@ const states = {
4420
4385
  write: false,
4421
4386
  read: true,
4422
4387
  type: 'boolean',
4423
- getter: payload => (payload.action === '1_double') ? true : undefined,
4388
+ getter: payload => payload.action === '1_double' ? true : undefined,
4424
4389
  isEvent: true,
4425
4390
  },
4426
4391
  ts0042_right_hold: {
@@ -4432,7 +4397,7 @@ const states = {
4432
4397
  write: false,
4433
4398
  read: true,
4434
4399
  type: 'boolean',
4435
- getter: payload => (payload.action === '2_hold') ? true : undefined,
4400
+ getter: payload => payload.action === '2_hold' ? true : undefined,
4436
4401
  isEvent: true,
4437
4402
  },
4438
4403
  ts0042_left_hold: {
@@ -4444,7 +4409,7 @@ const states = {
4444
4409
  write: false,
4445
4410
  read: true,
4446
4411
  type: 'boolean',
4447
- getter: payload => (payload.action === '1_hold') ? true : undefined,
4412
+ getter: payload => payload.action === '1_hold' ? true : undefined,
4448
4413
  isEvent: true,
4449
4414
  },
4450
4415
  ts0043_right_click: {
@@ -4456,7 +4421,7 @@ const states = {
4456
4421
  write: false,
4457
4422
  read: true,
4458
4423
  type: 'boolean',
4459
- getter: payload => (payload.action === '3_single') ? true : undefined,
4424
+ getter: payload => payload.action === '3_single' ? true : undefined,
4460
4425
  isEvent: true,
4461
4426
  },
4462
4427
  ts0043_middle_click: {
@@ -4468,7 +4433,7 @@ const states = {
4468
4433
  write: false,
4469
4434
  read: true,
4470
4435
  type: 'boolean',
4471
- getter: payload => (payload.action === '2_single') ? true : undefined,
4436
+ getter: payload => payload.action === '2_single' ? true : undefined,
4472
4437
  isEvent: true,
4473
4438
  },
4474
4439
  ts0043_left_click: {
@@ -4480,7 +4445,7 @@ const states = {
4480
4445
  write: false,
4481
4446
  read: true,
4482
4447
  type: 'boolean',
4483
- getter: payload => (payload.action === '1_single') ? true : undefined,
4448
+ getter: payload => payload.action === '1_single' ? true : undefined,
4484
4449
  isEvent: true,
4485
4450
  },
4486
4451
  ts0043_right_double: {
@@ -4492,7 +4457,7 @@ const states = {
4492
4457
  write: false,
4493
4458
  read: true,
4494
4459
  type: 'boolean',
4495
- getter: payload => (payload.action === '3_double') ? true : undefined,
4460
+ getter: payload => payload.action === '3_double' ? true : undefined,
4496
4461
  isEvent: true,
4497
4462
  },
4498
4463
  ts0043_middle_double: {
@@ -4504,7 +4469,7 @@ const states = {
4504
4469
  write: false,
4505
4470
  read: true,
4506
4471
  type: 'boolean',
4507
- getter: payload => (payload.action === '2_double') ? true : undefined,
4472
+ getter: payload => payload.action === '2_double' ? true : undefined,
4508
4473
  isEvent: true,
4509
4474
  },
4510
4475
  ts0043_left_double: {
@@ -4516,7 +4481,7 @@ const states = {
4516
4481
  write: false,
4517
4482
  read: true,
4518
4483
  type: 'boolean',
4519
- getter: payload => (payload.action === '1_double') ? true : undefined,
4484
+ getter: payload => payload.action === '1_double' ? true : undefined,
4520
4485
  isEvent: true,
4521
4486
  },
4522
4487
  ts0043_right_hold: {
@@ -4528,7 +4493,7 @@ const states = {
4528
4493
  write: false,
4529
4494
  read: true,
4530
4495
  type: 'boolean',
4531
- getter: payload => (payload.action === '3_hold') ? true : undefined,
4496
+ getter: payload => payload.action === '3_hold' ? true : undefined,
4532
4497
  isEvent: true,
4533
4498
  },
4534
4499
  ts0043_middle_hold: {
@@ -4540,7 +4505,7 @@ const states = {
4540
4505
  write: false,
4541
4506
  read: true,
4542
4507
  type: 'boolean',
4543
- getter: payload => (payload.action === '2_hold') ? true : undefined,
4508
+ getter: payload => payload.action === '2_hold' ? true : undefined,
4544
4509
  isEvent: true,
4545
4510
  },
4546
4511
  ts0043_left_hold: {
@@ -4552,7 +4517,7 @@ const states = {
4552
4517
  write: false,
4553
4518
  read: true,
4554
4519
  type: 'boolean',
4555
- getter: payload => (payload.action === '1_hold') ? true : undefined,
4520
+ getter: payload => payload.action === '1_hold' ? true : undefined,
4556
4521
  isEvent: true,
4557
4522
  },
4558
4523
  rm01_row_2: {
@@ -4564,8 +4529,8 @@ const states = {
4564
4529
  write: true,
4565
4530
  read: true,
4566
4531
  type: 'boolean',
4567
- getter: payload => (payload.action === 'row_2_on') ? true : (payload.action === 'row_2_off') ? false : undefined,
4568
- setter: (value) => (value) ? 'row_2_on' : 'row_2_off',
4532
+ getter: payload => payload.action === 'row_2_on' ? true : payload.action === 'row_2_off' ? false : undefined,
4533
+ setter: value => value ? 'row_2_on' : 'row_2_off',
4569
4534
  },
4570
4535
  rm01_row_3: {
4571
4536
  id: 'rm01_row_3',
@@ -4576,8 +4541,8 @@ const states = {
4576
4541
  write: true,
4577
4542
  read: true,
4578
4543
  type: 'boolean',
4579
- getter: payload => (payload.action === 'row_3_on') ? true : (payload.action === 'row_3_off') ? false : undefined,
4580
- setter: (value) => (value) ? 'row_3_on' : 'row_3_off',
4544
+ getter: payload => payload.action === 'row_3_on' ? true : payload.action === 'row_3_off' ? false : undefined,
4545
+ setter: value => value ? 'row_3_on' : 'row_3_off',
4581
4546
  },
4582
4547
  rm01_row_4: {
4583
4548
  id: 'rm01_row_4',
@@ -4588,8 +4553,8 @@ const states = {
4588
4553
  write: true,
4589
4554
  read: true,
4590
4555
  type: 'boolean',
4591
- getter: payload => (payload.action === 'row_4_on') ? true : (payload.action === 'row_4_off') ? false : undefined,
4592
- setter: (value) => (value) ? 'row_4_on' : 'row_4_off',
4556
+ getter: payload => payload.action === 'row_4_on' ? true : (payload.action === 'row_4_off' ? false : undefined),
4557
+ setter: value => value ? 'row_4_on' : 'row_4_off',
4593
4558
  },
4594
4559
  left_top_click: {
4595
4560
  id: 'left_top_click',
@@ -4601,7 +4566,7 @@ const states = {
4601
4566
  read: true,
4602
4567
  type: 'boolean',
4603
4568
  isEvent: true,
4604
- getter: payload => (payload.action === 'left_top_click') ? true : undefined,
4569
+ getter: payload => payload.action === 'left_top_click' ? true : undefined,
4605
4570
  },
4606
4571
  right_top_click: {
4607
4572
  id: 'right_top_click',
@@ -4613,7 +4578,7 @@ const states = {
4613
4578
  read: true,
4614
4579
  type: 'boolean',
4615
4580
  isEvent: true,
4616
- getter: payload => (payload.action === 'right_top_click') ? true : undefined,
4581
+ getter: payload => payload.action === 'right_top_click' ? true : undefined,
4617
4582
  },
4618
4583
  left_bottom_click: {
4619
4584
  id: 'left_bottom_click',
@@ -4625,7 +4590,7 @@ const states = {
4625
4590
  read: true,
4626
4591
  type: 'boolean',
4627
4592
  isEvent: true,
4628
- getter: payload => (payload.action === 'left_bottom_click') ? true : undefined,
4593
+ getter: payload => payload.action === 'left_bottom_click' ? true : undefined,
4629
4594
  },
4630
4595
  right_bottom_click: {
4631
4596
  id: 'right_bottom_click',
@@ -4637,7 +4602,7 @@ const states = {
4637
4602
  read: true,
4638
4603
  type: 'boolean',
4639
4604
  isEvent: true,
4640
- getter: payload => (payload.action === 'right_bottom_click') ? true : undefined,
4605
+ getter: payload => payload.action === 'right_bottom_click' ? true : undefined,
4641
4606
  },
4642
4607
  left_top_hold: {
4643
4608
  id: 'left_top_hold',
@@ -4649,7 +4614,7 @@ const states = {
4649
4614
  read: true,
4650
4615
  type: 'boolean',
4651
4616
  isEvent: true,
4652
- getter: payload => (payload.action === 'left_top_hold') ? true : undefined,
4617
+ getter: payload => payload.action === 'left_top_hold' ? true : undefined,
4653
4618
  },
4654
4619
  right_top_hold: {
4655
4620
  id: 'right_top_hold',
@@ -4661,7 +4626,7 @@ const states = {
4661
4626
  read: true,
4662
4627
  type: 'boolean',
4663
4628
  isEvent: true,
4664
- getter: payload => (payload.action === 'right_top_hold') ? true : undefined,
4629
+ getter: payload => payload.action === 'right_top_hold' ? true : undefined,
4665
4630
  },
4666
4631
  left_bottom_hold: {
4667
4632
  id: 'left_bottom_hold',
@@ -4673,7 +4638,7 @@ const states = {
4673
4638
  read: true,
4674
4639
  type: 'boolean',
4675
4640
  isEvent: true,
4676
- getter: payload => (payload.action === 'left_bottom_hold') ? true : undefined,
4641
+ getter: payload => payload.action === 'left_bottom_hold' ? true : undefined,
4677
4642
  },
4678
4643
  right_bottom_hold: {
4679
4644
  id: 'right_bottom_hold',
@@ -4685,7 +4650,7 @@ const states = {
4685
4650
  read: true,
4686
4651
  type: 'boolean',
4687
4652
  isEvent: true,
4688
- getter: payload => (payload.action === 'right_bottom_hold') ? true : undefined,
4653
+ getter: payload => payload.action === 'right_bottom_hold' ? true : undefined,
4689
4654
  },
4690
4655
  left_top_release: {
4691
4656
  id: 'left_top_release',
@@ -4697,7 +4662,7 @@ const states = {
4697
4662
  read: true,
4698
4663
  type: 'boolean',
4699
4664
  isEvent: true,
4700
- getter: payload => (payload.action === 'left_top_release') ? true : undefined,
4665
+ getter: payload => payload.action === 'left_top_release' ? true : undefined,
4701
4666
  },
4702
4667
  right_top_release: {
4703
4668
  id: 'right_top_release',
@@ -4709,7 +4674,7 @@ const states = {
4709
4674
  read: true,
4710
4675
  type: 'boolean',
4711
4676
  isEvent: true,
4712
- getter: payload => (payload.action === 'right_top_release') ? true : undefined,
4677
+ getter: payload => payload.action === 'right_top_release' ? true : undefined,
4713
4678
  },
4714
4679
  left_bottom_release: {
4715
4680
  id: 'left_bottom_release',
@@ -4721,7 +4686,7 @@ const states = {
4721
4686
  read: true,
4722
4687
  type: 'boolean',
4723
4688
  isEvent: true,
4724
- getter: payload => (payload.action === 'left_bottom_release') ? true : undefined,
4689
+ getter: payload => payload.action === 'left_bottom_release' ? true : undefined,
4725
4690
  },
4726
4691
  right_bottom_release: {
4727
4692
  id: 'right_bottom_release',
@@ -4733,7 +4698,7 @@ const states = {
4733
4698
  read: true,
4734
4699
  type: 'boolean',
4735
4700
  isEvent: true,
4736
- getter: payload => (payload.action === 'right_bottom_release') ? true : undefined,
4701
+ getter: payload => payload.action === 'right_bottom_release' ? true : undefined,
4737
4702
  },
4738
4703
  lumi_left_click: {
4739
4704
  id: 'left_click',
@@ -4745,7 +4710,7 @@ const states = {
4745
4710
  read: true,
4746
4711
  type: 'boolean',
4747
4712
  isEvent: true,
4748
- getter: payload => (payload.action === 'left') ? true : undefined,
4713
+ getter: payload => payload.action === 'left' ? true : undefined,
4749
4714
  },
4750
4715
  lumi_right_click: {
4751
4716
  id: 'right_click',
@@ -4757,7 +4722,7 @@ const states = {
4757
4722
  read: true,
4758
4723
  type: 'boolean',
4759
4724
  isEvent: true,
4760
- getter: payload => (payload.action === 'right') ? true : undefined,
4725
+ getter: payload => payload.action === 'right' ? true : undefined,
4761
4726
  },
4762
4727
  lumi_both_click: {
4763
4728
  id: 'both_click',
@@ -4769,7 +4734,7 @@ const states = {
4769
4734
  read: true,
4770
4735
  type: 'boolean',
4771
4736
  isEvent: true,
4772
- getter: payload => (payload.action === 'both') ? true : undefined,
4737
+ getter: payload => payload.action === 'both' ? true : undefined,
4773
4738
  },
4774
4739
  lumi_left_click_long: {
4775
4740
  id: 'left_click_long',
@@ -4781,7 +4746,7 @@ const states = {
4781
4746
  read: true,
4782
4747
  type: 'boolean',
4783
4748
  isEvent: true,
4784
- getter: payload => (payload.action === 'left_long') ? true : undefined,
4749
+ getter: payload => payload.action === 'left_long' ? true : undefined,
4785
4750
  },
4786
4751
  lumi_right_click_long: {
4787
4752
  id: 'right_click_long',
@@ -4793,7 +4758,7 @@ const states = {
4793
4758
  read: true,
4794
4759
  type: 'boolean',
4795
4760
  isEvent: true,
4796
- getter: payload => (payload.action === 'right_long') ? true : undefined,
4761
+ getter: payload => payload.action === 'right_long' ? true : undefined,
4797
4762
  },
4798
4763
  lumi_left_click_double: {
4799
4764
  id: 'left_click_double',
@@ -4805,7 +4770,7 @@ const states = {
4805
4770
  read: true,
4806
4771
  type: 'boolean',
4807
4772
  isEvent: true,
4808
- getter: payload => (payload.action === 'left_double') ? true : undefined,
4773
+ getter: payload => payload.action === 'left_double' ? true : undefined,
4809
4774
  },
4810
4775
  lumi_right_click_double: {
4811
4776
  id: 'right_click_double',
@@ -4817,7 +4782,7 @@ const states = {
4817
4782
  read: true,
4818
4783
  type: 'boolean',
4819
4784
  isEvent: true,
4820
- getter: payload => (payload.action === 'right_double') ? true : undefined,
4785
+ getter: payload => payload.action === 'right_double' ? true : undefined,
4821
4786
  },
4822
4787
  lumi_both_click_long: {
4823
4788
  id: 'both_click_long',
@@ -4829,7 +4794,7 @@ const states = {
4829
4794
  read: true,
4830
4795
  type: 'boolean',
4831
4796
  isEvent: true,
4832
- getter: payload => (payload.action === 'both_long') ? true : undefined,
4797
+ getter: payload => payload.action === 'both_long' ? true : undefined,
4833
4798
  },
4834
4799
  lumi_both_click_double: {
4835
4800
  id: 'both_click_double',
@@ -4841,7 +4806,7 @@ const states = {
4841
4806
  read: true,
4842
4807
  type: 'boolean',
4843
4808
  isEvent: true,
4844
- getter: payload => (payload.action === 'both_double') ? true : undefined,
4809
+ getter: payload => payload.action === 'both_double' ? true : undefined,
4845
4810
  },
4846
4811
  plug_summdelivered: {
4847
4812
  id: 'energy',
@@ -4963,8 +4928,8 @@ const states = {
4963
4928
  write: true,
4964
4929
  read: true,
4965
4930
  type: 'boolean',
4966
- getter: payload => (payload.state_l1 === 'ON'),
4967
- setter: (value) => (value) ? 'ON' : 'OFF',
4931
+ getter: payload => payload.state_l1 === 'ON',
4932
+ setter: value => value ? 'ON' : 'OFF',
4968
4933
  setattr: 'state',
4969
4934
  epname: 'l1',
4970
4935
  },
@@ -4977,8 +4942,8 @@ const states = {
4977
4942
  write: true,
4978
4943
  read: true,
4979
4944
  type: 'boolean',
4980
- getter: payload => (payload.state_l2 === 'ON'),
4981
- setter: (value) => (value) ? 'ON' : 'OFF',
4945
+ getter: payload => payload.state_l2 === 'ON',
4946
+ setter: value => value ? 'ON' : 'OFF',
4982
4947
  setattr: 'state',
4983
4948
  epname: 'l2',
4984
4949
  },
@@ -4991,8 +4956,8 @@ const states = {
4991
4956
  write: true,
4992
4957
  read: true,
4993
4958
  type: 'boolean',
4994
- getter: payload => (payload.state_l3 === 'ON'),
4995
- setter: (value) => (value) ? 'ON' : 'OFF',
4959
+ getter: payload => payload.state_l3 === 'ON',
4960
+ setter: value => value ? 'ON' : 'OFF',
4996
4961
  setattr: 'state',
4997
4962
  epname: 'l3',
4998
4963
  },
@@ -5005,8 +4970,8 @@ const states = {
5005
4970
  write: true,
5006
4971
  read: true,
5007
4972
  type: 'boolean',
5008
- getter: payload => (payload.state_l4 === 'ON'),
5009
- setter: (value) => (value) ? 'ON' : 'OFF',
4973
+ getter: payload => payload.state_l4 === 'ON',
4974
+ setter: value => value ? 'ON' : 'OFF',
5010
4975
  setattr: 'state',
5011
4976
  epname: 'l4',
5012
4977
  },
@@ -5019,8 +4984,8 @@ const states = {
5019
4984
  write: true,
5020
4985
  read: true,
5021
4986
  type: 'boolean',
5022
- getter: payload => (payload.state_l5 === 'ON'),
5023
- setter: (value) => (value) ? 'ON' : 'OFF',
4987
+ getter: payload => payload.state_l5 === 'ON',
4988
+ setter: value => value ? 'ON' : 'OFF',
5024
4989
  setattr: 'state',
5025
4990
  epname: 'l5',
5026
4991
  },
@@ -5033,8 +4998,8 @@ const states = {
5033
4998
  write: true,
5034
4999
  read: true,
5035
5000
  type: 'boolean',
5036
- getter: payload => (payload.state_l6 === 'ON'),
5037
- setter: (value) => (value) ? 'ON' : 'OFF',
5001
+ getter: payload => payload.state_l6 === 'ON',
5002
+ setter: value => value ? 'ON' : 'OFF',
5038
5003
  setattr: 'state',
5039
5004
  epname: 'l6',
5040
5005
  },
@@ -5047,8 +5012,8 @@ const states = {
5047
5012
  write: true,
5048
5013
  read: true,
5049
5014
  type: 'boolean',
5050
- getter: payload => (payload.state_l7 === 'ON'),
5051
- setter: (value) => (value) ? 'ON' : 'OFF',
5015
+ getter: payload => payload.state_l7 === 'ON',
5016
+ setter: value => value ? 'ON' : 'OFF',
5052
5017
  setattr: 'state',
5053
5018
  epname: 'l7',
5054
5019
  },
@@ -5061,8 +5026,8 @@ const states = {
5061
5026
  write: true,
5062
5027
  read: true,
5063
5028
  type: 'boolean',
5064
- getter: payload => (payload.state_l8 === 'ON'),
5065
- setter: (value) => (value) ? 'ON' : 'OFF',
5029
+ getter: payload => payload.state_l8 === 'ON',
5030
+ setter: value => value ? 'ON' : 'OFF',
5066
5031
  setattr: 'state',
5067
5032
  epname: 'l8',
5068
5033
  },
@@ -5076,7 +5041,7 @@ const states = {
5076
5041
  read: true,
5077
5042
  type: 'boolean',
5078
5043
  isEvent: true,
5079
- getter: payload => (payload.action === 'single_1') ? true : undefined,
5044
+ getter: payload => payload.action === 'single_1' ? true : undefined,
5080
5045
  },
5081
5046
  btn2_single: {
5082
5047
  id: 'btn2_single',
@@ -5088,7 +5053,7 @@ const states = {
5088
5053
  read: true,
5089
5054
  type: 'boolean',
5090
5055
  isEvent: true,
5091
- getter: payload => (payload.action === 'single_2') ? true : undefined,
5056
+ getter: payload => payload.action === 'single_2' ? true : undefined,
5092
5057
  },
5093
5058
  btn3_single: {
5094
5059
  id: 'btn3_single',
@@ -5100,7 +5065,7 @@ const states = {
5100
5065
  read: true,
5101
5066
  type: 'boolean',
5102
5067
  isEvent: true,
5103
- getter: payload => (payload.action === 'single_3') ? true : undefined,
5068
+ getter: payload => payload.action === 'single_3' ? true : undefined,
5104
5069
  },
5105
5070
  btn4_single: {
5106
5071
  id: 'btn4_single',
@@ -5112,7 +5077,7 @@ const states = {
5112
5077
  read: true,
5113
5078
  type: 'boolean',
5114
5079
  isEvent: true,
5115
- getter: payload => (payload.action === 'single_4') ? true : undefined,
5080
+ getter: payload => payload.action === 'single_4' ? true : undefined,
5116
5081
  },
5117
5082
  btn5_single: {
5118
5083
  id: 'btn5_single',
@@ -5124,7 +5089,7 @@ const states = {
5124
5089
  read: true,
5125
5090
  type: 'boolean',
5126
5091
  isEvent: true,
5127
- getter: payload => (payload.action === 'single_5') ? true : undefined,
5092
+ getter: payload => payload.action === 'single_5' ? true : undefined,
5128
5093
  },
5129
5094
  btn6_single: {
5130
5095
  id: 'btn6_single',
@@ -5136,7 +5101,7 @@ const states = {
5136
5101
  read: true,
5137
5102
  type: 'boolean',
5138
5103
  isEvent: true,
5139
- getter: payload => (payload.action === 'single_6') ? true : undefined,
5104
+ getter: payload => payload.action === 'single_6' ? true : undefined,
5140
5105
  },
5141
5106
  btn7_single: {
5142
5107
  id: 'btn7_single',
@@ -5148,7 +5113,7 @@ const states = {
5148
5113
  read: true,
5149
5114
  type: 'boolean',
5150
5115
  isEvent: true,
5151
- getter: payload => (payload.action === 'single_7') ? true : undefined,
5116
+ getter: payload => payload.action === 'single_7' ? true : undefined,
5152
5117
  },
5153
5118
  btn8_single: {
5154
5119
  id: 'btn8_single',
@@ -5160,7 +5125,7 @@ const states = {
5160
5125
  read: true,
5161
5126
  type: 'boolean',
5162
5127
  isEvent: true,
5163
- getter: payload => (payload.action === 'single_8') ? true : undefined,
5128
+ getter: payload => payload.action === 'single_8' ? true : undefined,
5164
5129
  },
5165
5130
  radioactive_events_per_minute: {
5166
5131
  id: 'radioactive_events_per_minute',
@@ -5191,7 +5156,7 @@ const states = {
5191
5156
  write: false,
5192
5157
  read: true,
5193
5158
  type: 'boolean',
5194
- getter: payload => (payload.action === 'on') ? true : ((payload.action === 'off') ? false : undefined),
5159
+ getter: payload => payload.action === 'on' ? true : (payload.action === 'off' ? false : undefined),
5195
5160
  },
5196
5161
  geiger_sensitivity: {
5197
5162
  id: 'sensitivity',
@@ -5211,7 +5176,7 @@ const states = {
5211
5176
  write: true,
5212
5177
  read: true,
5213
5178
  type: 'boolean',
5214
- setter: (value) => (value) ? 'ON' : 'OFF',
5179
+ setter: value => value ? 'ON' : 'OFF',
5215
5180
  },
5216
5181
  geiger_buzzer_feedback: {
5217
5182
  id: 'buzzer_feedback',
@@ -5221,7 +5186,7 @@ const states = {
5221
5186
  write: true,
5222
5187
  read: true,
5223
5188
  type: 'boolean',
5224
- setter: (value) => (value) ? 'ON' : 'OFF',
5189
+ setter: value => value ? 'ON' : 'OFF',
5225
5190
  },
5226
5191
  geiger_sensors_count: {
5227
5192
  id: 'sensors_count',
@@ -5242,7 +5207,7 @@ const states = {
5242
5207
  read: true,
5243
5208
  type: 'string',
5244
5209
  states: '0:СБМ-20/СТС-5/BOI-33;1:СБМ-19/СТС-6;3:Other',
5245
- setter: (value) => parseInt(value),
5210
+ setter: value => parseInt(value),
5246
5211
  },
5247
5212
  geiger_alert_threshold: {
5248
5213
  id: 'alert_threshold',
@@ -5263,7 +5228,7 @@ const states = {
5263
5228
  write: false,
5264
5229
  read: true,
5265
5230
  type: 'string',
5266
- getter: payload => (payload.action.startsWith('scene_')) ? payload.action.split('_')[1] : undefined,
5231
+ getter: payload => payload.action.startsWith('scene_') ? payload.action.split('_')[1] : undefined,
5267
5232
  },
5268
5233
  brightness_step: {
5269
5234
  id: 'brightness_step',
@@ -5335,7 +5300,7 @@ const states = {
5335
5300
  read: true,
5336
5301
  type: 'boolean',
5337
5302
  isEvent: true,
5338
- getter: payload => (payload.action === 'brightness_step_up') ? true : undefined,
5303
+ getter: payload => payload.action === 'brightness_step_up' ? true : undefined,
5339
5304
  },
5340
5305
  brightness_step_down: {
5341
5306
  id: 'brightness_step_down',
@@ -5347,7 +5312,7 @@ const states = {
5347
5312
  read: true,
5348
5313
  type: 'boolean',
5349
5314
  isEvent: true,
5350
- getter: payload => (payload.action === 'brightness_step_down') ? true : undefined,
5315
+ getter: payload => payload.action === 'brightness_step_down' ? true : undefined,
5351
5316
  },
5352
5317
  brightness_step_up_size: {
5353
5318
  id: 'brightness_step_up_size',
@@ -5359,7 +5324,7 @@ const states = {
5359
5324
  read: true,
5360
5325
  type: 'number',
5361
5326
  unit: '',
5362
- getter: payload => (payload.action === 'brightness_step_up') ? payload.action_step_size : undefined,
5327
+ getter: payload => payload.action === 'brightness_step_up' ? payload.action_step_size : undefined,
5363
5328
  },
5364
5329
  brightness_step_down_size: {
5365
5330
  id: 'brightness_step_down_size',
@@ -5371,7 +5336,7 @@ const states = {
5371
5336
  read: true,
5372
5337
  type: 'number',
5373
5338
  unit: '',
5374
- getter: payload => (payload.action === 'brightness_step_down') ? payload.action_step_size : undefined,
5339
+ getter: payload => payload.action === 'brightness_step_down' ? payload.action_step_size : undefined,
5375
5340
  },
5376
5341
  brightness_stop: {
5377
5342
  id: 'brightness_stop',
@@ -5383,7 +5348,7 @@ const states = {
5383
5348
  read: true,
5384
5349
  type: 'boolean',
5385
5350
  isEvent: true,
5386
- getter: payload => (payload.action === 'brightness_stop') ? true : undefined,
5351
+ getter: payload => payload.action === 'brightness_stop' ? true : undefined,
5387
5352
  },
5388
5353
  color_temperature_move: {
5389
5354
  id: 'color_temperature_move',
@@ -5395,7 +5360,7 @@ const states = {
5395
5360
  read: true,
5396
5361
  type: 'boolean',
5397
5362
  isEvent: true,
5398
- getter: payload => (payload.action === 'color_temperature_move') ? true : undefined,
5363
+ getter: payload => payload.action === 'color_temperature_move' ? true : undefined,
5399
5364
  },
5400
5365
  color_temperature_move_value: {
5401
5366
  id: 'color_temperature_move_value',
@@ -5407,7 +5372,7 @@ const states = {
5407
5372
  read: true,
5408
5373
  type: 'number',
5409
5374
  unit: '',
5410
- getter: payload => (payload.action === 'color_temperature_move') ? payload.action_color_temperature : undefined,
5375
+ getter: payload => payload.action === 'color_temperature_move' ? payload.action_color_temperature : undefined,
5411
5376
  },
5412
5377
  color_move: {
5413
5378
  id: 'color_move',
@@ -5419,7 +5384,7 @@ const states = {
5419
5384
  read: true,
5420
5385
  type: 'boolean',
5421
5386
  isEvent: true,
5422
- getter: payload => (payload.action === 'color_move') ? true : undefined,
5387
+ getter: payload => payload.action === 'color_move' ? true : undefined,
5423
5388
  },
5424
5389
  color_move_value: {
5425
5390
  id: 'color_move_value',
@@ -5430,10 +5395,10 @@ const states = {
5430
5395
  write: false,
5431
5396
  read: true,
5432
5397
  type: 'string',
5433
- getter: (payload) => {
5434
- if( payload.action === 'color_move') {
5398
+ getter: payload => {
5399
+ if (payload.action === 'color_move') {
5435
5400
  const colorval = rgb.cie_to_rgb(payload.action_color.x, payload.action_color.y);
5436
- return '#' + utils.decimalToHex(colorval[0]) + utils.decimalToHex(colorval[1]) + utils.decimalToHex(colorval[2]);
5401
+ return `#${utils.decimalToHex(colorval[0])}${utils.decimalToHex(colorval[1])}${utils.decimalToHex(colorval[2])}`;
5437
5402
  } else {
5438
5403
  return undefined;
5439
5404
  }
@@ -5449,7 +5414,7 @@ const states = {
5449
5414
  read: true,
5450
5415
  type: 'boolean',
5451
5416
  isEvent: true,
5452
- getter: payload => (payload.action === 'brightness_move_up') ? true : undefined,
5417
+ getter: payload => payload.action === 'brightness_move_up' ? true : undefined,
5453
5418
  },
5454
5419
  brightness_move_up_size: {
5455
5420
  id: 'brightness_move_up_size',
@@ -5461,7 +5426,7 @@ const states = {
5461
5426
  read: true,
5462
5427
  type: 'number',
5463
5428
  unit: '',
5464
- getter: payload => (payload.action === 'brightness_move_up') ? payload.action_rate : undefined,
5429
+ getter: payload => payload.action === 'brightness_move_up' ? payload.action_rate : undefined,
5465
5430
  },
5466
5431
  brightness_move_down: {
5467
5432
  id: 'brightness_move_down',
@@ -5473,7 +5438,7 @@ const states = {
5473
5438
  read: true,
5474
5439
  type: 'boolean',
5475
5440
  isEvent: true,
5476
- getter: payload => (payload.action === 'brightness_move_down') ? true : undefined,
5441
+ getter: payload => payload.action === 'brightness_move_down' ? true : undefined,
5477
5442
  },
5478
5443
  brightness_move_down_size: {
5479
5444
  id: 'brightness_move_down_size',
@@ -5485,7 +5450,7 @@ const states = {
5485
5450
  read: true,
5486
5451
  type: 'number',
5487
5452
  unit: '',
5488
- getter: payload => (payload.action === 'brightness_move_down') ? payload.action_rate : undefined,
5453
+ getter: payload => payload.action === 'brightness_move_down' ? payload.action_rate : undefined,
5489
5454
  },
5490
5455
  enhanced_move_to_hue_and_saturation: {
5491
5456
  id: 'enhanced_move',
@@ -5497,7 +5462,7 @@ const states = {
5497
5462
  read: true,
5498
5463
  type: 'boolean',
5499
5464
  isEvent: true,
5500
- getter: payload => (payload.action === 'enhanced_move_to_hue_and_saturation') ? true : undefined,
5465
+ getter: payload => payload.action === 'enhanced_move_to_hue_and_saturation' ? true : undefined,
5501
5466
  },
5502
5467
  enhanced_move_enhanced_hue: {
5503
5468
  id: 'enhanced_move_enhanced_hue',
@@ -5509,7 +5474,7 @@ const states = {
5509
5474
  read: true,
5510
5475
  type: 'number',
5511
5476
  unit: '',
5512
- getter: payload => (payload.action === 'enhanced_move_to_hue_and_saturation') ? payload.action_enhanced_hue : undefined,
5477
+ getter: payload => payload.action === 'enhanced_move_to_hue_and_saturation' ? payload.action_enhanced_hue : undefined,
5513
5478
  },
5514
5479
  enhanced_move_hue: {
5515
5480
  id: 'enhanced_move_hue',
@@ -5521,7 +5486,7 @@ const states = {
5521
5486
  read: true,
5522
5487
  type: 'number',
5523
5488
  unit: '',
5524
- getter: payload => (payload.action === 'enhanced_move_to_hue_and_saturation') ? payload.action_hue : undefined,
5489
+ getter: payload => payload.action === 'enhanced_move_to_hue_and_saturation' ? payload.action_hue : undefined,
5525
5490
  },
5526
5491
  enhanced_move_saturation: {
5527
5492
  id: 'enhanced_move_saturation',
@@ -5533,7 +5498,7 @@ const states = {
5533
5498
  read: true,
5534
5499
  type: 'number',
5535
5500
  unit: '',
5536
- getter: payload => (payload.action === 'enhanced_move_to_hue_and_saturation') ? payload.action_saturation : undefined,
5501
+ getter: payload => payload.action === 'enhanced_move_to_hue_and_saturation' ? payload.action_saturation : undefined,
5537
5502
  },
5538
5503
  density: {
5539
5504
  id: 'density',
@@ -5642,7 +5607,7 @@ const states = {
5642
5607
  write: false,
5643
5608
  read: true,
5644
5609
  type: 'boolean',
5645
- getter: payload => (payload.action === 'on_1') ? false : ( payload.action === 'off_1' ) ? true : undefined,
5610
+ getter: payload => payload.action === 'on_1' ? false : (payload.action === 'off_1' ? true : undefined),
5646
5611
  isEvent: true,
5647
5612
  },
5648
5613
  rob_2_click: {
@@ -5654,7 +5619,7 @@ const states = {
5654
5619
  write: false,
5655
5620
  read: true,
5656
5621
  type: 'boolean',
5657
- getter: payload => (payload.action === 'on_2') ? false : ( payload.action === 'off_2' ) ? true : undefined,
5622
+ getter: payload => payload.action === 'on_2' ? false : (payload.action === 'off_2' ? true : undefined),
5658
5623
  isEvent: true,
5659
5624
  },
5660
5625
  rob_3_click: {
@@ -5666,7 +5631,7 @@ const states = {
5666
5631
  write: false,
5667
5632
  read: true,
5668
5633
  type: 'boolean',
5669
- getter: payload => (payload.action === 'on_3') ? false : ( payload.action === 'off_3' ) ? true : undefined,
5634
+ getter: payload => payload.action === 'on_3' ? false : (payload.action === 'off_3' ? true : undefined),
5670
5635
  isEvent: true,
5671
5636
  },
5672
5637
  rob_4_click: {
@@ -5678,7 +5643,7 @@ const states = {
5678
5643
  write: false,
5679
5644
  read: true,
5680
5645
  type: 'boolean',
5681
- getter: payload => (payload.action === 'on_4') ? false : ( payload.action === 'off_4' ) ? true : undefined,
5646
+ getter: payload => payload.action === 'on_4' ? false : (payload.action === 'off_4' ? true : undefined),
5682
5647
  isEvent: true,
5683
5648
  },
5684
5649
 
@@ -5702,8 +5667,8 @@ const states = {
5702
5667
  write: true,
5703
5668
  read: true,
5704
5669
  type: 'boolean',
5705
- getter: payload => (payload.child_lock === 'LOCKED'),
5706
- setter: (value) => (value) ? 'LOCKED' : 'UNLOCKED',
5670
+ getter: payload => payload.child_lock === 'LOCKED',
5671
+ setter: value => value ? 'LOCKED' : 'UNLOCKED',
5707
5672
  },
5708
5673
  volume_percent: {
5709
5674
  id: 'volume',
@@ -5767,7 +5732,7 @@ const states = {
5767
5732
  write: true,
5768
5733
  read: true,
5769
5734
  type: 'boolean',
5770
- setter: (value) => (value) ? 'ON' : 'OFF',
5735
+ setter: value => value ? 'ON' : 'OFF',
5771
5736
  },
5772
5737
  airsense_enable_abc: {
5773
5738
  id: 'enable_abc',
@@ -5777,7 +5742,7 @@ const states = {
5777
5742
  write: true,
5778
5743
  read: true,
5779
5744
  type: 'boolean',
5780
- setter: (value) => (value) ? 'ON' : 'OFF',
5745
+ setter: value => value ? 'ON' : 'OFF',
5781
5746
  },
5782
5747
  airsense_threshold1: {
5783
5748
  id: 'threshold1',
@@ -5813,25 +5778,26 @@ const states = {
5813
5778
  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
5779
  setter: (value, options) => {
5815
5780
  const effectjson = {
5816
- colors:[{r: 255,g: 0,b: 0},{r: 0,g: 255,b: 0},{r: 0,g: 0,b: 255}],
5817
- speed:10,
5818
- effect:'glow',
5781
+ colors: [{r: 255, g: 0, b: 0}, {r: 0, g: 255, b: 0}, {r: 0, g: 0, b: 255}],
5782
+ speed: 10,
5783
+ effect: 'glow',
5819
5784
  };
5820
- if (options && options.hasOwnProperty('effect_speed'))
5785
+ if (options && options.hasOwnProperty('effect_speed')) {
5821
5786
  effectjson.speed = options.effect_speed;
5822
- if (options && options.hasOwnProperty('effect_colors'))
5823
- {
5787
+ }
5788
+ if (options && options.hasOwnProperty('effect_colors')) {
5824
5789
  effectjson.colors = rgb.colorArrayFromString(options.effect_colors);
5825
5790
  }
5826
5791
  effectjson.effect = value;
5827
5792
  return effectjson;
5828
5793
  },
5829
- getter: (payload) => {
5830
- if (payload && payload.effect && payload.effect.hasOwnProperty('effect')) return payload.effect.effect;
5831
- return "steady";
5794
+ getter: payload => {
5795
+ if (payload && payload.effect && payload.effect.hasOwnProperty('effect')) {
5796
+ return payload.effect.effect;
5797
+ }
5798
+ return 'steady';
5832
5799
  }
5833
-
5834
- },
5800
+ },
5835
5801
  effect_json: {
5836
5802
  id: 'effect_json',
5837
5803
  name: 'Effect',
@@ -5844,19 +5810,21 @@ const states = {
5844
5810
  setter: (value, options) => {
5845
5811
  try {
5846
5812
  return JSON.parse(value);
5847
- }
5848
- catch {
5813
+ } catch {
5849
5814
  const effectjson = {
5850
- colors:[{r: 255,g: 0,b: 0},{r: 0,g: 255,b: 0},{r: 0,g: 0,b: 255}],
5851
- speed:10,
5852
- effect:'glow',
5815
+ colors: [{r: 255, g: 0, b: 0}, {r: 0, g: 255, b: 0}, {r: 0, g: 0, b: 255}],
5816
+ speed: 10,
5817
+ effect: 'glow',
5853
5818
  };
5854
- if (options && options.hasOwnProperty('effect_speed'))
5819
+ if (options && options.hasOwnProperty('effect_speed')) {
5855
5820
  effectjson.speed = options.effect_speed;
5856
- if (options && options.hasOwnProperty('effect_colors'))
5821
+ }
5822
+ if (options && options.hasOwnProperty('effect_colors')) {
5857
5823
  effectjson.colors = rgb.colorArrayFromString(options.effect_colors);
5858
- if (options && options.hasOwnProperty('effect_type'))
5824
+ }
5825
+ if (options && options.hasOwnProperty('effect_type')) {
5859
5826
  effectjson.effect = options.effect_type;
5827
+ }
5860
5828
  value = JSON.stringify(effectjson);
5861
5829
  return effectjson;
5862
5830
  }
@@ -5877,19 +5845,23 @@ const states = {
5877
5845
  unit: '',
5878
5846
  setter: (value, options) => {
5879
5847
  const effectjson = {
5880
- colors:[{r: 255,g: 0,b: 0},{r: 0,g: 255,b: 0},{r: 0,g: 0,b: 255}],
5881
- speed:10,
5882
- effect:'snake',
5848
+ colors: [{r: 255, g: 0, b: 0}, {r: 0, g: 255, b: 0}, {r: 0, g: 0, b: 255}],
5849
+ speed: 10,
5850
+ effect: 'snake',
5883
5851
  };
5884
- if (options && options.hasOwnProperty('effect_type'))
5852
+ if (options && options.hasOwnProperty('effect_type')) {
5885
5853
  effectjson.effect = options.effect_type;
5886
- if (options && options.hasOwnProperty('effect_colors'))
5854
+ }
5855
+ if (options && options.hasOwnProperty('effect_colors')) {
5887
5856
  effectjson.colors = rgb.colorArrayFromString(options.effect_colors);
5857
+ }
5888
5858
  effectjson.speed = value;
5889
5859
  return effectjson;
5890
5860
  },
5891
- getter: (payload) => {
5892
- if (payload && payload.effect && payload.effect.hasOwnProperty('speed')) return payload.effect.speed;
5861
+ getter: payload => {
5862
+ if (payload && payload.effect && payload.effect.hasOwnProperty('speed')) {
5863
+ return payload.effect.speed;
5864
+ }
5893
5865
  return 1;
5894
5866
  }
5895
5867
  },
@@ -5906,20 +5878,24 @@ const states = {
5906
5878
  type: 'string',
5907
5879
  setter: (value, options) => {
5908
5880
  const effectjson = {
5909
- colors:[{r: 255,g: 0,b: 0},{r: 0,g: 255,b: 0},{r: 0,g: 0,b: 255}],
5910
- speed:10,
5911
- effect:'sparkle',
5881
+ colors: [{r: 255, g: 0, b: 0}, {r: 0, g: 255, b: 0}, {r: 0, g: 0, b: 255}],
5882
+ speed: 10,
5883
+ effect: 'sparkle',
5912
5884
  };
5913
5885
 
5914
- if (options && options.hasOwnProperty('effect_speed'))
5886
+ if (options && options.hasOwnProperty('effect_speed')) {
5915
5887
  effectjson.speed = options.effect_speed;
5916
- if (options && options.hasOwnProperty('effect_type'))
5888
+ }
5889
+ if (options && options.hasOwnProperty('effect_type')) {
5917
5890
  effectjson.effect = options.effect_type;
5891
+ }
5918
5892
  effectjson.colors = rgb.colorArrayFromString(value);
5919
5893
  return effectjson;
5920
5894
  },
5921
- getter: (payload) => {
5922
- if (payload && payload.effect && payload.effect.hasOwnProperty('colors')) return rgb.colorStringFromRGBArray(payload.effect.colors);
5895
+ getter: payload => {
5896
+ if (payload && payload.effect && payload.effect.hasOwnProperty('colors')) {
5897
+ return rgb.colorStringFromRGBArray(payload.effect.colors);
5898
+ }
5923
5899
  return '#ffff00,#ff00ff,#00ffff,#0000ff,#00ff00,#ff0000';
5924
5900
  }
5925
5901
  },
@@ -5949,19 +5925,20 @@ const states = {
5949
5925
  const _rgb = colors.ParseColor(value);
5950
5926
  const hsv = rgb.rgbToHSV(_rgb.r, _rgb.g, _rgb.b, true);
5951
5927
  return {
5952
- hue: Math.min(Math.max(hsv.h,1),359),
5928
+ hue: Math.min(Math.max(hsv.h, 1), 359),
5953
5929
  saturation: hsv.s,
5954
5930
  brightness: Math.floor(hsv.v * 2.55),
5955
-
5956
5931
  };
5957
5932
  },
5958
- getter: (payload) => {
5933
+ getter: payload => {
5959
5934
  if (payload.color) {
5960
5935
  const c = payload.color;
5961
- if (c.hasOwnProperty("h") && c.hasOwnProperty("s") && c.hasOwnProperty("b"))
5962
- return rgb.hsvToRGBString(c.h, c.s, c.b * 100 / 255);
5963
- if (c.hasOwnProperty("h") && c.hasOwnProperty("s") && c.hasOwnProperty("v"))
5964
- return rgb.hsvToRGBString(c.h, c.s, c.v * 100);
5936
+ if (c.hasOwnProperty('h') && c.hasOwnProperty('s') && c.hasOwnProperty('b')) {
5937
+ return rgb.hsvToRGBString(c.h, c.s, c.b * 100 / 255);
5938
+ }
5939
+ if (c.hasOwnProperty('h') && c.hasOwnProperty('s') && c.hasOwnProperty('v')) {
5940
+ return rgb.hsvToRGBString(c.h, c.s, c.v * 100);
5941
+ }
5965
5942
  }
5966
5943
  },
5967
5944
  setterOpt: (value, options) => {
@@ -6002,9 +5979,9 @@ const states = {
6002
5979
  type: 'number',
6003
5980
  write: false,
6004
5981
  read: true,
6005
- getter: (payload) => {
5982
+ getter: payload => {
6006
5983
  const rv = {};
6007
- const id = (typeof(payload.device_l1) == 'string' ? payload.device_l1.replace(/[-. ]/g, ''):'unset');
5984
+ const id = typeof payload.device_l1 === 'string' ? payload.device_l1.replace(/[-. ]/g, '') : 'unset';
6008
5985
  let unit = undefined;
6009
5986
  let measurement = undefined;
6010
5987
  for (const item in payload) {
@@ -6018,12 +5995,13 @@ const states = {
6018
5995
  }
6019
5996
  }
6020
5997
  }
6021
- if (measurement)
6022
- rv.stateid = id + '_'+measurement;
6023
- else
5998
+ if (measurement) {
5999
+ rv.stateid = `${id}_${measurement}`;
6000
+ } else {
6024
6001
  rv.stateid = id;
6002
+ }
6025
6003
  rv.value = payload.l1;
6026
- rv.name = (measurement? measurement + ' 0x'+ id: '0x'+id);
6004
+ rv.name = measurement ? `${measurement} 0x${id}` : `0x${id}`;
6027
6005
  rv.unit = unit;
6028
6006
  rv.role = measurement;
6029
6007
 
@@ -6039,9 +6017,9 @@ const states = {
6039
6017
  type: 'number',
6040
6018
  write: false,
6041
6019
  read: true,
6042
- getter: (payload) => {
6020
+ getter: payload => {
6043
6021
  const rv = {};
6044
- const id = (typeof(payload.device_l2) == 'string' ? payload.device_l2.replace(/[-. ]/g, ''):'unset');
6022
+ const id = typeof payload.device_l2 === 'string' ? payload.device_l2.replace(/[-. ]/g, '') : 'unset';
6045
6023
  let unit = undefined;
6046
6024
  let measurement = undefined;
6047
6025
  for (const item in payload) {
@@ -6055,12 +6033,13 @@ const states = {
6055
6033
  }
6056
6034
  }
6057
6035
  }
6058
- if (measurement)
6059
- rv.stateid = id + '_'+measurement;
6060
- else
6036
+ if (measurement) {
6037
+ rv.stateid = `${id}_${measurement}`;
6038
+ } else {
6061
6039
  rv.stateid = id;
6040
+ }
6062
6041
  rv.value = payload.l2;
6063
- rv.name = (measurement? measurement + ' 0x'+ id: '0x'+id);
6042
+ rv.name = measurement ? `${measurement} 0x${id}` : `0x${id}`;
6064
6043
  rv.unit = unit;
6065
6044
  rv.role = measurement;
6066
6045
 
@@ -6076,9 +6055,9 @@ const states = {
6076
6055
  type: 'number',
6077
6056
  write: false,
6078
6057
  read: true,
6079
- getter: (payload) => {
6058
+ getter: payload => {
6080
6059
  const rv = {};
6081
- const id = (typeof(payload.device_l3) == 'string' ? payload.device_l3.replace(/[-. ]/g, ''):'unset');
6060
+ const id = typeof payload.device_l3 === 'string' ? payload.device_l3.replace(/[-. ]/g, '') : 'unset';
6082
6061
  let unit = undefined;
6083
6062
  let measurement = undefined;
6084
6063
  for (const item in payload) {
@@ -6092,12 +6071,13 @@ const states = {
6092
6071
  }
6093
6072
  }
6094
6073
  }
6095
- if (measurement)
6096
- rv.stateid = id + '_'+measurement;
6097
- else
6074
+ if (measurement) {
6075
+ rv.stateid = `${id}_${measurement}`;
6076
+ } else {
6098
6077
  rv.stateid = id;
6078
+ }
6099
6079
  rv.value = payload.l3;
6100
- rv.name = (measurement? measurement + ' 0x'+ id: '0x'+id);
6080
+ rv.name = measurement ? `${measurement} 0x${id}` : `0x${id}`;
6101
6081
  rv.unit = unit;
6102
6082
  rv.role = measurement;
6103
6083
 
@@ -6113,9 +6093,9 @@ const states = {
6113
6093
  type: 'number',
6114
6094
  write: false,
6115
6095
  read: true,
6116
- getter: (payload) => {
6096
+ getter: payload => {
6117
6097
  const rv = {};
6118
- const id = (typeof(payload.device_l4) == 'string' ? payload.device_l4.replace(/[-. ]/g, ''):'unset');
6098
+ const id = typeof payload.device_l4 === 'string' ? payload.device_l4.replace(/[-. ]/g, '') : 'unset';
6119
6099
  let unit = undefined;
6120
6100
  let measurement = undefined;
6121
6101
  for (const item in payload) {
@@ -6129,12 +6109,13 @@ const states = {
6129
6109
  }
6130
6110
  }
6131
6111
  }
6132
- if (measurement)
6133
- rv.stateid = id + '_'+measurement;
6134
- else
6112
+ if (measurement) {
6113
+ rv.stateid = `${id}_${measurement}`;
6114
+ } else {
6135
6115
  rv.stateid = id;
6116
+ }
6136
6117
  rv.value = payload.l4;
6137
- rv.name = (measurement? measurement + ' 0x'+ id: '0x'+id);
6118
+ rv.name = measurement ? `${measurement} 0x${id}` : `0x${id}`;
6138
6119
  rv.unit = unit;
6139
6120
  rv.role = measurement;
6140
6121
 
@@ -6150,9 +6131,9 @@ const states = {
6150
6131
  type: 'number',
6151
6132
  write: false,
6152
6133
  read: true,
6153
- getter: (payload) => {
6134
+ getter: payload => {
6154
6135
  const rv = {};
6155
- const id = (typeof(payload.device_l5) == 'string' ? payload.device_l5.replace(/[-. ]/g, ''):'unset');
6136
+ const id = typeof payload.device_l5 === 'string' ? payload.device_l5.replace(/[-. ]/g, '') : 'unset';
6156
6137
  let unit = undefined;
6157
6138
  let measurement = undefined;
6158
6139
  for (const item in payload) {
@@ -6166,12 +6147,13 @@ const states = {
6166
6147
  }
6167
6148
  }
6168
6149
  }
6169
- if (measurement)
6170
- rv.stateid = id + '_'+measurement;
6171
- else
6150
+ if (measurement) {
6151
+ rv.stateid = `${id}_${measurement}`;
6152
+ } else {
6172
6153
  rv.stateid = id;
6154
+ }
6173
6155
  rv.value = payload.l5;
6174
- rv.name = (measurement? measurement + ' 0x'+ id: '0x'+id);
6156
+ rv.name = measurement ? `${measurement} 0x${id}` : `0x${id}`;
6175
6157
  rv.unit = unit;
6176
6158
  rv.role = measurement;
6177
6159
 
@@ -6187,9 +6169,9 @@ const states = {
6187
6169
  type: 'number',
6188
6170
  write: false,
6189
6171
  read: true,
6190
- getter: (payload) => {
6172
+ getter: payload => {
6191
6173
  const rv = {};
6192
- const id = (typeof(payload.device_l6) == 'string' ? payload.device_l6.replace(/[-. ]/g, ''):'unset');
6174
+ const id = typeof payload.device_l6 === 'string' ? payload.device_l6.replace(/[-. ]/g, '') : 'unset';
6193
6175
  let unit = undefined;
6194
6176
  let measurement = undefined;
6195
6177
  for (const item in payload) {
@@ -6203,12 +6185,13 @@ const states = {
6203
6185
  }
6204
6186
  }
6205
6187
  }
6206
- if (measurement)
6207
- rv.stateid = id + '_'+measurement;
6208
- else
6188
+ if (measurement) {
6189
+ rv.stateid = `${id}_${measurement}`;
6190
+ } else {
6209
6191
  rv.stateid = id;
6192
+ }
6210
6193
  rv.value = payload.l6;
6211
- rv.name = (measurement? measurement + ' 0x'+ id: '0x'+id);
6194
+ rv.name = measurement ? `${measurement} 0x${id}` : `0x${id}`;
6212
6195
  rv.unit = unit;
6213
6196
  rv.role = measurement;
6214
6197
 
@@ -6224,9 +6207,9 @@ const states = {
6224
6207
  type: 'number',
6225
6208
  write: false,
6226
6209
  read: true,
6227
- getter: (payload) => {
6210
+ getter: payload => {
6228
6211
  const rv = {};
6229
- const id = (typeof(payload.device_l7) == 'string' ? payload.device_l7.replace(/[-. ]/g, ''):'unset');
6212
+ const id = typeof payload.device_l7 === 'string' ? payload.device_l7.replace(/[-. ]/g, '') : 'unset';
6230
6213
  let unit = undefined;
6231
6214
  let measurement = undefined;
6232
6215
  for (const item in payload) {
@@ -6240,12 +6223,13 @@ const states = {
6240
6223
  }
6241
6224
  }
6242
6225
  }
6243
- if (measurement)
6244
- rv.stateid = id + '_'+measurement;
6245
- else
6226
+ if (measurement) {
6227
+ rv.stateid = `${id}_${measurement}`;
6228
+ } else {
6246
6229
  rv.stateid = id;
6230
+ }
6247
6231
  rv.value = payload.l7;
6248
- rv.name = (measurement? measurement + ' 0x'+ id: '0x'+id);
6232
+ rv.name = measurement ? `${measurement} 0x${id}` : `0x${id}`;
6249
6233
  rv.unit = unit;
6250
6234
  rv.role = measurement;
6251
6235
 
@@ -6261,9 +6245,9 @@ const states = {
6261
6245
  type: 'number',
6262
6246
  write: false,
6263
6247
  read: true,
6264
- getter: (payload) => {
6248
+ getter: payload => {
6265
6249
  const rv = {};
6266
- const id = (typeof(payload.device_l8) == 'string' ? payload.device_l8.replace(/[-. ]/g, ''):'unset');
6250
+ const id = typeof payload.device_l8 === 'string' ? payload.device_l8.replace(/[-. ]/g, '') : 'unset';
6267
6251
  let unit = undefined;
6268
6252
  let measurement = undefined;
6269
6253
  for (const item in payload) {
@@ -6277,12 +6261,13 @@ const states = {
6277
6261
  }
6278
6262
  }
6279
6263
  }
6280
- if (measurement)
6281
- rv.stateid = id + '_'+measurement;
6282
- else
6264
+ if (measurement) {
6265
+ rv.stateid = `${id}_${measurement}`;
6266
+ } else {
6283
6267
  rv.stateid = id;
6268
+ }
6284
6269
  rv.value = payload.l8;
6285
- rv.name = (measurement? measurement + ' 0x'+ id: '0x'+id);
6270
+ rv.name = measurement ? `${measurement} 0x${id}` : `0x${id}`;
6286
6271
  rv.unit = unit;
6287
6272
  rv.role = measurement;
6288
6273
 
@@ -6299,8 +6284,8 @@ const states = {
6299
6284
  read: true,
6300
6285
  type: 'boolean',
6301
6286
  setattr: 'l1',
6302
- getter: (payload) => payload === 'ON',
6303
- setter: (value) => (value) ? 'ON' : 'OFF',
6287
+ getter: payload => payload === 'ON',
6288
+ setter: value => value ? 'ON' : 'OFF',
6304
6289
  },
6305
6290
  ptvo_switch_2: {
6306
6291
  id: 'channel_2.switch',
@@ -6312,8 +6297,8 @@ const states = {
6312
6297
  read: true,
6313
6298
  type: 'boolean',
6314
6299
  setattr: 'l2',
6315
- getter: (payload) => payload === 'ON',
6316
- setter: (value) => (value) ? 'ON' : 'OFF',
6300
+ getter: payload => payload === 'ON',
6301
+ setter: value => value ? 'ON' : 'OFF',
6317
6302
  },
6318
6303
  ptvo_switch_3: {
6319
6304
  id: 'channel_3.switch',
@@ -6325,8 +6310,8 @@ const states = {
6325
6310
  read: true,
6326
6311
  type: 'boolean',
6327
6312
  setattr: 'l3',
6328
- getter: (payload) => payload === 'ON',
6329
- setter: (value) => (value) ? 'ON' : 'OFF',
6313
+ getter: payload => payload === 'ON',
6314
+ setter: value => value ? 'ON' : 'OFF',
6330
6315
  },
6331
6316
  ptvo_switch_4: {
6332
6317
  id: 'channel_4.switch',
@@ -6337,7 +6322,7 @@ const states = {
6337
6322
  write: true,
6338
6323
  read: true,
6339
6324
  type: 'boolean',
6340
- getter: (payload) => payload === 'ON',
6325
+ getter: payload => payload === 'ON',
6341
6326
  setattr: 'l4',
6342
6327
  },
6343
6328
  ptvo_switch_5: {
@@ -6350,8 +6335,8 @@ const states = {
6350
6335
  read: true,
6351
6336
  type: 'boolean',
6352
6337
  setattr: 'l5',
6353
- getter: (payload) => payload === 'ON',
6354
- setter: (value) => (value) ? 'ON' : 'OFF',
6338
+ getter: payload => payload === 'ON',
6339
+ setter: value => value ? 'ON' : 'OFF',
6355
6340
  },
6356
6341
  ptvo_switch_6: {
6357
6342
  id: 'channel_6.switch',
@@ -6362,7 +6347,7 @@ const states = {
6362
6347
  write: true,
6363
6348
  read: true,
6364
6349
  type: 'boolean',
6365
- getter: (payload) => payload === 'ON',
6350
+ getter: payload => payload === 'ON',
6366
6351
  setattr: 'l6',
6367
6352
  },
6368
6353
  ptvo_switch_7: {
@@ -6375,8 +6360,8 @@ const states = {
6375
6360
  read: true,
6376
6361
  type: 'boolean',
6377
6362
  setattr: 'l7',
6378
- getter: (payload) => payload === 'ON',
6379
- setter: (value) => (value) ? 'ON' : 'OFF',
6363
+ getter: payload => payload === 'ON',
6364
+ setter: value => value ? 'ON' : 'OFF',
6380
6365
  },
6381
6366
  ptvo_switch_8: {
6382
6367
  id: 'channel_8.switch',
@@ -6388,8 +6373,8 @@ const states = {
6388
6373
  read: true,
6389
6374
  type: 'boolean',
6390
6375
  setattr: 'l8',
6391
- getter: (payload) => payload === 'ON',
6392
- setter: (value) => (value) ? 'ON' : 'OFF',
6376
+ getter: payload => payload === 'ON',
6377
+ setter: value => value ? 'ON' : 'OFF',
6393
6378
  },
6394
6379
  ptvo_trigger: {
6395
6380
  id: 'trigger',
@@ -6414,7 +6399,7 @@ const states = {
6414
6399
  };
6415
6400
 
6416
6401
  module.exports = {
6417
- states: states,
6418
- unitLookup: unitLookup,
6419
- nameLookup: nameLookup,
6402
+ states,
6403
+ unitLookup,
6404
+ nameLookup,
6420
6405
  };