iobroker.zigbee2mqtt 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/states.js CHANGED
@@ -71,7 +71,8 @@ const states = {
71
71
  read: true,
72
72
  type: 'number',
73
73
  min: 0,
74
- max: 255
74
+ max: 255,
75
+ def: 10,
75
76
  },
76
77
 
77
78
  available: {
@@ -79,10 +80,11 @@ const states = {
79
80
  prop: 'available',
80
81
  name: 'Available',
81
82
  icon: undefined,
82
- role: 'state',
83
+ role: 'indicator.reachable',
83
84
  write: false,
84
85
  read: true,
85
- type: 'boolean'
86
+ type: 'boolean',
87
+ def: false,
86
88
  },
87
89
  device_query: { // button to trigger device read
88
90
  id: 'device_query',
@@ -280,6 +282,7 @@ const states = {
280
282
  type: 'number',
281
283
  unit: 'V',
282
284
  getter: payload => payload.voltage / 1000,
285
+ def: 0,
283
286
  },
284
287
  ecozy_voltage: {
285
288
  id: 'voltage',
@@ -291,6 +294,7 @@ const states = {
291
294
  type: 'number',
292
295
  unit: 'V',
293
296
  getter: payload => payload.voltage * 10,
297
+ def: 0,
294
298
  },
295
299
  battery: {
296
300
  id: 'battery',
@@ -303,7 +307,8 @@ const states = {
303
307
  type: 'number',
304
308
  unit: '%',
305
309
  min: 0,
306
- max: 100
310
+ max: 100,
311
+ def: 0,
307
312
  },
308
313
  left_click: {
309
314
  id: 'left_click',
@@ -549,7 +554,8 @@ const states = {
549
554
  write: false,
550
555
  read: true,
551
556
  type: 'number',
552
- unit: '°C'
557
+ unit: '°C',
558
+ def: 0,
553
559
  },
554
560
  humidity: {
555
561
  id: 'humidity',
@@ -605,6 +611,7 @@ const states = {
605
611
  write: false,
606
612
  read: true,
607
613
  type: 'boolean',
614
+ def: false,
608
615
  },
609
616
  occupancy_event: {
610
617
  id: 'occupancy',
@@ -615,6 +622,7 @@ const states = {
615
622
  read: true,
616
623
  type: 'boolean',
617
624
  isEvent: true,
625
+ def: false,
618
626
  },
619
627
  occupancy_pirOToUDelay: {
620
628
  // this is different from occupancy_timeout,
@@ -670,17 +678,19 @@ const states = {
670
678
  role: 'state',
671
679
  write: false,
672
680
  read: true,
673
- type: 'boolean'
681
+ type: 'boolean',
682
+ def: false,
674
683
  },
675
684
  opened: {
676
685
  id: 'opened',
677
686
  prop: 'contact',
678
687
  name: 'Is open',
679
688
  icon: undefined,
680
- role: 'state',
689
+ role: 'sensor.window',
681
690
  write: false,
682
691
  read: true,
683
692
  type: 'boolean',
693
+ def: false,
684
694
  getter: payload => !payload.contact,
685
695
  },
686
696
  tamper: {
@@ -701,7 +711,8 @@ const states = {
701
711
  role: 'indicator.leakage',
702
712
  write: false,
703
713
  read: true,
704
- type: 'boolean'
714
+ type: 'boolean',
715
+ def: false,
705
716
  },
706
717
  gas_detected: {
707
718
  id: 'detected',
@@ -711,7 +722,8 @@ const states = {
711
722
  role: 'indicator.alarm.fire',
712
723
  write: false,
713
724
  read: true,
714
- type: 'boolean'
725
+ type: 'boolean',
726
+ def: false,
715
727
  },
716
728
  smoke_detected: {
717
729
  id: 'detected',
@@ -721,7 +733,8 @@ const states = {
721
733
  role: 'indicator.alarm.fire',
722
734
  write: false,
723
735
  read: true,
724
- type: 'boolean'
736
+ type: 'boolean',
737
+ def: false,
725
738
  },
726
739
  smoke_detected2: { // for Heiman
727
740
  id: 'smoke',
@@ -731,7 +744,8 @@ const states = {
731
744
  role: 'indicator.alarm.fire',
732
745
  write: false,
733
746
  read: true,
734
- type: 'boolean'
747
+ type: 'boolean',
748
+ def: false,
735
749
  },
736
750
  co_detected: { // for Heiman
737
751
  id: 'carbon_monoxide',
@@ -741,7 +755,8 @@ const states = {
741
755
  role: 'indicator.alarm.carbon_monoxide',
742
756
  write: false,
743
757
  read: true,
744
- type: 'boolean'
758
+ type: 'boolean',
759
+ def: false,
745
760
  },
746
761
  heiman_batt_low: {
747
762
  id: 'battery_low',
@@ -751,7 +766,8 @@ const states = {
751
766
  role: 'indicator.lowbat',
752
767
  write: false,
753
768
  read: true,
754
- type: 'boolean'
769
+ type: 'boolean',
770
+ def: false
755
771
  },
756
772
  heiman_battery: {
757
773
  id: 'battery',
@@ -764,7 +780,8 @@ const states = {
764
780
  type: 'number',
765
781
  unit: '%',
766
782
  min: 0,
767
- max: 100
783
+ max: 100,
784
+ def: 0,
768
785
  },
769
786
  heiman_smart_controller_armed: {
770
787
  id: 'arm_state',
@@ -1154,7 +1171,7 @@ const states = {
1154
1171
  write: true,
1155
1172
  read: true,
1156
1173
  type: 'number',
1157
- unit: '',
1174
+ unit: '%',
1158
1175
  min: 0,
1159
1176
  max: 100,
1160
1177
  getter: payload => {
@@ -1478,7 +1495,7 @@ const states = {
1478
1495
  write: true,
1479
1496
  read: true,
1480
1497
  type: 'string',
1481
- states: 'low:low;medium:medium;high:high',
1498
+ states: { low: 'low', medium: 'medium', high: 'high' },
1482
1499
  epname: 'ep2',
1483
1500
  },
1484
1501
  occupancy_timeout: {
@@ -2185,7 +2202,7 @@ const states = {
2185
2202
  prop: 'occupied_heating_setpoint',
2186
2203
  name: 'Occupied Target Temperature',
2187
2204
  icon: undefined,
2188
- role: 'value.temperature',
2205
+ role: 'level.temperature',
2189
2206
  write: true,
2190
2207
  read: true,
2191
2208
  type: 'number',
@@ -2196,7 +2213,7 @@ const states = {
2196
2213
  prop: 'unoccupied_heating_setpoint',
2197
2214
  name: 'Unoccupied Target Temperature',
2198
2215
  icon: undefined,
2199
- role: 'value.temperature',
2216
+ role: 'level.temperature',
2200
2217
  write: true,
2201
2218
  read: true,
2202
2219
  type: 'number',
@@ -2629,6 +2646,7 @@ const states = {
2629
2646
  write: false,
2630
2647
  read: true,
2631
2648
  type: 'boolean',
2649
+ def: false,
2632
2650
  },
2633
2651
  natgas_density: {
2634
2652
  id: 'gas_density',
@@ -3715,7 +3733,7 @@ const states = {
3715
3733
  write: true,
3716
3734
  read: true,
3717
3735
  type: 'string', // valid: low, medium, high
3718
- states: 'low:low;medium:medium;high:high',
3736
+ states: { low: 'low', medium: 'medium', high: 'high' },
3719
3737
  },
3720
3738
  cover_stop: {
3721
3739
  id: 'cover_stop',
@@ -4029,7 +4047,7 @@ const states = {
4029
4047
  write: true,
4030
4048
  read: true,
4031
4049
  type: 'string',
4032
- states: 'hold:manual;program:program',
4050
+ states: { hold: 'manual', program: 'program' },
4033
4051
  setattr: 'preset',
4034
4052
  },
4035
4053
  moes_trv_heating: {
@@ -4052,7 +4070,7 @@ const states = {
4052
4070
  write: true,
4053
4071
  read: true,
4054
4072
  type: 'string', // valid: IN, AL, OU
4055
- states: 'IN:IN;AL:AL;OU:OU',
4073
+ states: { IN: 'IN', AL: 'AL', OU: 'OU' },
4056
4074
  setter: (value) => (value) === 'IN' ? 0 : (value) === 'AL' ? 1 : (value) === 'OU' ? 2 : 0,
4057
4075
  },
4058
4076
  tuya_trv_target_temperature: {
@@ -4187,7 +4205,7 @@ const states = {
4187
4205
  write: true,
4188
4206
  read: true,
4189
4207
  type: 'string', // valid: low, medium, high
4190
- states: 'off:off;auto:auto;manual:manual;comfort:comfort;eco:eco;boost:boost;complex:complex',
4208
+ states: { off: 'off', auto: 'auto', manual: 'manual', comfort: 'comfort', eco: 'eco', boost: 'boost', complex: 'complex' },
4191
4209
  },
4192
4210
  climate_preset: {
4193
4211
  id: 'preset',
@@ -4197,7 +4215,7 @@ const states = {
4197
4215
  write: true,
4198
4216
  read: true,
4199
4217
  type: 'string',
4200
- states: 'schedule:schedule;manual:manual;boost:boost;complex:complex;comfort:comfort;eco:eco',
4218
+ states: { schedule: 'schedule', manual: 'manual', boost: 'boost', complex: 'complex', comfort: 'comfort', eco: 'eco' },
4201
4219
  },
4202
4220
  climate_away_mode: {
4203
4221
  id: 'away_mode',
@@ -4221,7 +4239,7 @@ const states = {
4221
4239
  write: true,
4222
4240
  read: true,
4223
4241
  type: 'string',
4224
- states: 'auto:auto;off:off;heat:heat',
4242
+ states: { auto: 'auto', off: 'off', heat: 'heat' },
4225
4243
  },
4226
4244
  climate_running_mode: {
4227
4245
  id: 'running_state',
@@ -4232,7 +4250,7 @@ const states = {
4232
4250
  write: true,
4233
4251
  read: true,
4234
4252
  type: 'string', // valid: low, medium, high
4235
- states: 'idle;idle;heat:heat',
4253
+ states: { idle: 'idle', heat: 'heat' },
4236
4254
  },
4237
4255
  tuya_trv_force_mode: {
4238
4256
  id: 'mode_force',
@@ -4243,7 +4261,7 @@ const states = {
4243
4261
  write: true,
4244
4262
  read: true,
4245
4263
  type: 'string', // valid: low, medium, high
4246
- states: 'normal:normal;open:open;close:close',
4264
+ states: { normal: 'normal', open: 'open', close: 'close' },
4247
4265
  },
4248
4266
  tuya_trv_valve_position: {
4249
4267
  id: 'valve_position',
@@ -4858,7 +4876,7 @@ const states = {
4858
4876
  write: true,
4859
4877
  read: true,
4860
4878
  type: 'string', // valid: low, medium, high
4861
- states: 'low:low;medium:medium;high:high',
4879
+ states: { low: 'low', medium: 'medium', high: 'high' },
4862
4880
  },
4863
4881
  duration: {
4864
4882
  id: 'duration',
@@ -5217,7 +5235,7 @@ const states = {
5217
5235
  write: true,
5218
5236
  read: true,
5219
5237
  type: 'string',
5220
- states: '0:СБМ-20/СТС-5/BOI-33;1:СБМ-19/СТС-6;3:Other',
5238
+ states: { 0: 'СБМ-20/СТС-5/BOI-33', 1: 'СБМ-19/СТС-6', 3: 'Other' },
5221
5239
  setter: (value) => parseInt(value),
5222
5240
  },
5223
5241
  geiger_alert_threshold: {
@@ -5263,7 +5281,8 @@ const states = {
5263
5281
  read: false,
5264
5282
  type: 'number',
5265
5283
  min: -50,
5266
- max: 50
5284
+ max: 50,
5285
+ def: 0
5267
5286
  },
5268
5287
  colortemp_move: {
5269
5288
  id: 'colortemp_move',
@@ -5275,7 +5294,8 @@ const states = {
5275
5294
  read: false,
5276
5295
  type: 'number',
5277
5296
  min: -50,
5278
- max: 50
5297
+ max: 50,
5298
+ def: 0
5279
5299
  },
5280
5300
  hue_move: {
5281
5301
  id: 'hue_move',
@@ -5287,7 +5307,8 @@ const states = {
5287
5307
  read: false,
5288
5308
  type: 'number',
5289
5309
  min: -50,
5290
- max: 50
5310
+ max: 50,
5311
+ def: 0
5291
5312
  },
5292
5313
  saturation_move: {
5293
5314
  id: 'saturation_move',
@@ -5299,7 +5320,8 @@ const states = {
5299
5320
  read: false,
5300
5321
  type: 'number',
5301
5322
  min: -50,
5302
- max: 50
5323
+ max: 50,
5324
+ def: 0
5303
5325
  },
5304
5326
  brightness_step_up: {
5305
5327
  id: 'brightness_step_up',
@@ -5370,6 +5392,7 @@ const states = {
5370
5392
  write: false,
5371
5393
  read: true,
5372
5394
  type: 'boolean',
5395
+ def: 0,
5373
5396
  isEvent: true,
5374
5397
  getter: payload => (payload.action === 'color_temperature_move') ? true : undefined,
5375
5398
  },
@@ -5667,7 +5690,7 @@ const states = {
5667
5690
  write: true,
5668
5691
  read: true,
5669
5692
  type: 'string',
5670
- states: 'auto:auto;manual:manual;away:away',
5693
+ states: { auto: 'auto', manual: 'manual', away: 'away' },
5671
5694
  },
5672
5695
  child_lock: {
5673
5696
  id: 'lock',
@@ -5701,7 +5724,7 @@ const states = {
5701
5724
  write: true,
5702
5725
  read: true,
5703
5726
  type: 'string',
5704
- states: 'internal:internal;external:external;both:both',
5727
+ states: { internal: 'internal', external: 'external', both: 'both' },
5705
5728
  },
5706
5729
  hvacThermostat_external_temp: {
5707
5730
  id: 'external_temp',
@@ -5786,7 +5809,7 @@ const states = {
5786
5809
  write: true,
5787
5810
  read: true,
5788
5811
  type: 'string',
5789
- states: 'steady:steady;snow:snow;rainbow:rainbow;snake:snake;twinkle:twinkle;firework:firework;horizontal_flag:horizontal_flag;waves:waves;updown:updown;vintage:vintage;fading:fading;collide:collide;strobe:strobe;sparkles:sparkles;carnaval:carnaval;glow:glow',
5812
+ states: { steady: 'steady', snow: 'snow', rainbow: 'rainbow', snake: 'snake', twinkle: 'twinkle', firework: 'firework', horizontal_flag: 'horizontal_flag', waves: 'waves', updown: 'updown', vintage: 'vintage', fading: 'fading', collide: 'collide', strobe: 'strobe', sparkles: 'sparkles', carnaval: 'carnaval', glow: 'glow' },
5790
5813
  setter: (value, options) => {
5791
5814
  const effectjson = {
5792
5815
  colors: [{ r: 255, g: 0, b: 0 }, { r: 0, g: 255, b: 0 }, { r: 0, g: 0, b: 255 }],
@@ -5957,7 +5980,7 @@ const states = {
5957
5980
  write: true,
5958
5981
  read: true,
5959
5982
  type: 'string',
5960
- states: 'blink:blink;breathe:breathe;okay:okay;channel_change:channel_change;finish_effect:finish_effect;stop_effect:stop_effect'
5983
+ states: { blink: 'blink', breathe: 'breathe', okay: 'okay', channel_change: 'channel_change', finish_effect: 'finish_effect', stop_effect: 'stop_effect' }
5961
5984
  },
5962
5985
  interlock: {
5963
5986
  id: 'interlock',
package/lib/utils.js CHANGED
@@ -61,7 +61,7 @@ function toMired(t) {
61
61
  }
62
62
 
63
63
  function miredKelvinConversion(t) {
64
- return (1000000 / t).toFixed();
64
+ return Math.round(1000000 / t);
65
65
  }
66
66
 
67
67
  /**