zigbee-herdsman-converters 14.0.521 → 14.0.522

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/devices/kmpcil.js CHANGED
@@ -3,8 +3,71 @@ const fz = {...require('../converters/fromZigbee'), legacy: require('../lib/lega
3
3
  const tz = require('../converters/toZigbee');
4
4
  const constants = require('../lib/constants');
5
5
  const reporting = require('../lib/reporting');
6
+ const globalStore = require('../lib/store');
7
+ const utils = require('../lib/utils');
6
8
  const e = exposes.presets;
7
9
 
10
+ const kmpcilOptions={
11
+ presence_timeout_dc: () => {
12
+ return exposes.numeric('presence_timeout_dc').withValueMin(60).withDescription(
13
+ 'Time in seconds after which presence is cleared after detecting it (default 60 seconds) while in DC.');
14
+ },
15
+ presence_timeout_battery: () => {
16
+ return exposes.numeric('presence_timeout_battery').withValueMin(120).withDescription(
17
+ 'Time in seconds after which presence is cleared after detecting it (default 420 seconds) while in Battery.');
18
+ },
19
+ };
20
+
21
+ function handleKmpcilPresence(model, msg, publish, options, meta) {
22
+ const useOptionsTimeoutBattery = options && options.hasOwnProperty('presence_timeout_battery');
23
+ const timeoutBattery = useOptionsTimeoutBattery ? options.presence_timeout_battery : 420; // 100 seconds by default
24
+
25
+ const useOptionsTimeoutDc = options && options.hasOwnProperty('presence_timeout_dc');
26
+ const timeoutDc = useOptionsTimeoutDc ? options.presence_timeout_dc : 60;
27
+
28
+ const mode = meta.state? meta.state['power_state'] : false;
29
+
30
+ const timeout = mode ? timeoutDc : timeoutBattery;
31
+ // Stop existing timer because motion is detected and set a new one.
32
+ clearTimeout(globalStore.getValue(msg.endpoint, 'timer'));
33
+ const timer = setTimeout(() => publish({presence: false}), timeout * 1000);
34
+ globalStore.putValue(msg.endpoint, 'timer', timer);
35
+
36
+ return {presence: true};
37
+ }
38
+
39
+ const kmpcilConverters = {
40
+ presence_binary_input: {
41
+ cluster: 'genBinaryInput',
42
+ type: ['attributeReport', 'readResponse'],
43
+ convert: (model, msg, publish, options, meta) => {
44
+ const payload = handleKmpcilPresence(model, msg, publish, options, meta);
45
+ if (msg.data.hasOwnProperty('presentValue')) {
46
+ const presentValue = msg.data['presentValue'];
47
+ payload.power_state = (presentValue & 0x01)> 0;
48
+ payload.occupancy = (presentValue & 0x04) > 0;
49
+ payload.vibration = (presentValue & 0x02) > 0;
50
+ }
51
+ return payload;
52
+ },
53
+ },
54
+ presence_power: {
55
+ cluster: 'genPowerCfg',
56
+ type: ['attributeReport', 'readResponse'],
57
+ options: [kmpcilOptions.presence_timeout_dc(), kmpcilOptions.presence_timeout_battery()],
58
+ convert: (model, msg, publish, options, meta) => {
59
+ const payload = handleKmpcilPresence(model, msg, publish, options, meta);
60
+ if (msg.data.hasOwnProperty('batteryVoltage')) {
61
+ payload.voltage = msg.data['batteryVoltage'] * 100;
62
+ if (model.meta && model.meta.battery && model.meta.battery.voltageToPercentage) {
63
+ payload.battery = utils.batteryVoltageToPercentage(payload.voltage, model.meta.battery.voltageToPercentage);
64
+ }
65
+ }
66
+ return payload;
67
+ },
68
+ },
69
+ };
70
+
8
71
  module.exports = [
9
72
  {
10
73
  zigbeeModel: ['RES005'],
@@ -47,4 +110,38 @@ module.exports = [
47
110
  await endpoint.configureReporting('genBinaryOutput', payloadBinaryOutput);
48
111
  },
49
112
  },
113
+ {
114
+ zigbeeModel: ['tagv1'],
115
+ model: 'KMPCIL-tag-001',
116
+ vendor: 'KMPCIL',
117
+ description: 'Arrival sensor',
118
+ fromZigbee: [kmpcilConverters.presence_binary_input, kmpcilConverters.presence_power, fz.temperature],
119
+ exposes: [e.battery(), e.presence(), exposes.binary('power_state', exposes.access.STATE, true, false),
120
+ e.occupancy(), e.vibration(), e.temperature()],
121
+ toZigbee: [],
122
+ meta: {battery: {voltageToPercentage: '3V_1500_2800'}},
123
+ configure: async (device, coordinatorEndpoint, logger) => {
124
+ const endpoint = device.getEndpoint(1);
125
+ for (const cluster of ['msTemperatureMeasurement', 'genPowerCfg', 'genBinaryInput']) {
126
+ // This sleep here(and the sleep) after is to allow the command to be
127
+ // fully sent to coordinator. In case repeater involved and the repeater
128
+ // is litted in resources, we may want to give some time so that the sequence of
129
+ // commands does not overwhelm the repeater.
130
+ await utils.sleep(2000);
131
+ await endpoint.bind(cluster, coordinatorEndpoint);
132
+ }
133
+
134
+ await utils.sleep(1000);
135
+ const p = reporting.payload('batteryVoltage', 0, 10, 1);
136
+ await endpoint.configureReporting('genPowerCfg', p);
137
+
138
+ await utils.sleep(1000);
139
+ const p2 = reporting.payload('presentValue', 0, 300, 1);
140
+ await endpoint.configureReporting('genBinaryInput', p2);
141
+
142
+ await utils.sleep(1000);
143
+ await reporting.temperature(endpoint);
144
+ await endpoint.read('genBinaryInput', ['presentValue']);
145
+ },
146
+ },
50
147
  ];
@@ -32,8 +32,8 @@ module.exports = [
32
32
  {
33
33
  zigbeeModel: [' Contactor\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000'+
34
34
  '\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000'],
35
- model: 'FC80CC',
36
- description: 'Legrand (or Bticino) DIN contactor module',
35
+ model: '412171',
36
+ description: 'DIN contactor module ( Bticino FC80CC )',
37
37
  vendor: 'Legrand',
38
38
  extend: extend.switch(),
39
39
  fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement, fz.legrand_cluster_fc01, fz.ignore_basic_report, fz.ignore_genOta],
@@ -52,8 +52,8 @@ module.exports = [
52
52
  {
53
53
  zigbeeModel: [' Teleruptor\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000'+
54
54
  '\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000'],
55
- model: 'FC80RC',
56
- description: 'Legrand (or Bticino) DIN smart relay for light control (note: Legrand 412170 may be similar to Bticino FC80RC)',
55
+ model: '412170',
56
+ description: 'DIN smart relay for light control ( Bticino FC80RC ) ',
57
57
  vendor: 'Legrand',
58
58
  extend: extend.switch(),
59
59
  fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement, fz.legrand_cluster_fc01, fz.ignore_basic_report, fz.ignore_genOta],
@@ -14,6 +14,7 @@ module.exports = [
14
14
  description: 'Water leak switch',
15
15
  fromZigbee: [fz.ias_water_leak_alarm_1, fz.battery],
16
16
  toZigbee: [],
17
+ meta: {battery: {dontDividePercentage: true}},
17
18
  exposes: [e.water_leak(), e.battery_low(), e.tamper(), e.battery()],
18
19
  },
19
20
  {
@@ -82,6 +83,7 @@ module.exports = [
82
83
  description: 'Air sensor',
83
84
  fromZigbee: [fz.lifecontrolVoc, fz.battery],
84
85
  toZigbee: [],
86
+ meta: {battery: {dontDividePercentage: true}},
85
87
  exposes: [e.temperature(), e.humidity(), e.voc(), e.eco2(), e.battery()],
86
88
  },
87
89
  ];
@@ -98,4 +98,20 @@ module.exports = [
98
98
  await reporting.onOff(endpoint);
99
99
  },
100
100
  },
101
+ {
102
+ zigbeeModel: ['3RSB015BZ'],
103
+ model: '3RSB015BZ',
104
+ vendor: 'Third Reality',
105
+ description: 'Roller shade',
106
+ fromZigbee: [fz.cover_position_tilt, fz.battery],
107
+ toZigbee: [tz.cover_state, tz.cover_position_tilt],
108
+ meta: {battery: {dontDividePercentage: false}},
109
+ configure: async (device, coordinatorEndpoint, logger) => {
110
+ const endpoint = device.getEndpoint(1);
111
+ await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'closuresWindowCovering']);
112
+ await reporting.batteryPercentageRemaining(endpoint);
113
+ await reporting.currentPositionLiftPercentage(endpoint);
114
+ },
115
+ exposes: [e.cover_position(), e.battery()],
116
+ },
101
117
  ];
package/devices/tuya.js CHANGED
@@ -214,7 +214,8 @@ module.exports = [
214
214
  {modelID: 'TS0001', manufacturerName: '_TZ3000_5ng23zjs'},
215
215
  {modelID: 'TS0001', manufacturerName: '_TZ3000_rmjr4ufz'},
216
216
  {modelID: 'TS0001', manufacturerName: '_TZ3000_v7gnj3ad'},
217
- {modelID: 'TS0001', manufacturerName: '_TZ3000_mx3vgyea'}],
217
+ {modelID: 'TS0001', manufacturerName: '_TZ3000_mx3vgyea'},
218
+ {modelID: 'TS0001', manufacturerName: '_TZ3000_qsp2pwtf'}],
218
219
  model: 'WHD02',
219
220
  vendor: 'TuYa',
220
221
  description: 'Wall switch module',
package/devices/xiaomi.js CHANGED
@@ -891,7 +891,7 @@ module.exports = [
891
891
  exposes: [e.occupancy(), e.illuminance_lux().withProperty('illuminance'),
892
892
  e.illuminance().withUnit('lx').withDescription('Measured illuminance in lux'),
893
893
  exposes.numeric('detection_interval', ea.ALL).withValueMin(2).withValueMax(65535).withUnit('s')
894
- .withDescription('Time interval for detecting actions'), e.temperature(), e.battery()],
894
+ .withDescription('Time interval for detecting actions'), e.temperature(), e.battery(), e.battery_voltage()],
895
895
  meta: {battery: {voltageToPercentage: '3V_2850_3000_log'}},
896
896
  configure: async (device, coordinatorEndpoint, logger) => {
897
897
  const endpoint = device.getEndpoint(1);
@@ -909,7 +909,7 @@ module.exports = [
909
909
  toZigbee: [tz.aqara_detection_interval, tz.aqara_motion_sensitivity],
910
910
  exposes: [e.occupancy(), exposes.enum('motion_sensitivity', ea.ALL, ['low', 'medium', 'high']),
911
911
  exposes.numeric('detection_interval', ea.ALL).withValueMin(2).withValueMax(65535).withUnit('s')
912
- .withDescription('Time interval for detecting actions'), e.temperature(), e.battery()],
912
+ .withDescription('Time interval for detecting actions'), e.temperature(), e.battery(), e.battery_voltage()],
913
913
  meta: {battery: {voltageToPercentage: '3V_2850_3000_log'}},
914
914
  configure: async (device, coordinatorEndpoint, logger) => {
915
915
  const endpoint = device.getEndpoint(1);
@@ -1259,7 +1259,7 @@ module.exports = [
1259
1259
  'the normal monitoring state, the green indicator light flashes every 60 seconds'),
1260
1260
  exposes.binary('linkage_alarm', ea.ALL, true, false).withDescription('When this option is enabled and a smoke ' +
1261
1261
  'is detected, other detectors with this option enabled will also sound the alarm buzzer'),
1262
- e.temperature(), e.battery()],
1262
+ e.temperature(), e.battery(), e.battery_voltage()],
1263
1263
  meta: {battery: {voltageToPercentage: '3V_2850_3000_log'}},
1264
1264
  configure: async (device, coordinatorEndpoint, logger) => {
1265
1265
  const endpoint = device.getEndpoint(1);
@@ -1470,7 +1470,7 @@ module.exports = [
1470
1470
  vendor: 'Xiaomi',
1471
1471
  description: 'Aqara Opple switch 1 band',
1472
1472
  fromZigbee: [fz.aqara_opple_on, fz.aqara_opple_off, fz.battery, fz.aqara_opple_multistate, fz.aqara_opple],
1473
- exposes: [e.battery(), e.action([
1473
+ exposes: [e.battery(), e.battery_voltage(), e.action([
1474
1474
  'button_1_hold', 'button_1_release', 'button_1_single', 'button_1_double', 'button_1_triple',
1475
1475
  'button_2_hold', 'button_2_release', 'button_2_single', 'button_2_double', 'button_2_triple',
1476
1476
  ]), exposes.enum('operation_mode', ea.ALL, ['command', 'event'])
@@ -1490,7 +1490,7 @@ module.exports = [
1490
1490
  description: 'Aqara Opple switch 2 bands',
1491
1491
  fromZigbee: [fz.aqara_opple_on, fz.aqara_opple_off, fz.aqara_opple_step, fz.aqara_opple_step_color_temp, fz.battery,
1492
1492
  fz.aqara_opple_multistate, fz.aqara_opple],
1493
- exposes: [e.battery(), e.action([
1493
+ exposes: [e.battery(), e.battery_voltage(), e.action([
1494
1494
  'button_1_hold', 'button_1_release', 'button_1_single', 'button_1_double', 'button_1_triple',
1495
1495
  'button_2_hold', 'button_2_release', 'button_2_single', 'button_2_double', 'button_2_triple',
1496
1496
  'button_3_hold', 'button_3_release', 'button_3_single', 'button_3_double', 'button_3_triple',
@@ -1514,7 +1514,7 @@ module.exports = [
1514
1514
  description: 'Aqara Opple switch 3 bands',
1515
1515
  fromZigbee: [fz.aqara_opple_on, fz.aqara_opple_off, fz.aqara_opple_step, fz.aqara_opple_move, fz.aqara_opple_stop,
1516
1516
  fz.aqara_opple_step_color_temp, fz.aqara_opple_move_color_temp, fz.battery, fz.aqara_opple_multistate, fz.aqara_opple],
1517
- exposes: [e.battery(), e.action([
1517
+ exposes: [e.battery(), e.battery_voltage(), e.action([
1518
1518
  'button_1_hold', 'button_1_release', 'button_1_single', 'button_1_double', 'button_1_triple',
1519
1519
  'button_2_hold', 'button_2_release', 'button_2_single', 'button_2_double', 'button_2_triple',
1520
1520
  'button_3_hold', 'button_3_release', 'button_3_single', 'button_3_double', 'button_3_triple',
@@ -1782,7 +1782,7 @@ module.exports = [
1782
1782
  fromZigbee: [fz.xiaomi_tvoc, fz.battery, fz.temperature, fz.humidity],
1783
1783
  toZigbee: [],
1784
1784
  meta: {battery: {voltageToPercentage: '3V_2850_3000_log'}},
1785
- exposes: [e.battery(), e.temperature(), e.humidity(), e.voc()],
1785
+ exposes: [e.temperature(), e.humidity(), e.voc(), e.battery(), e.battery_voltage()],
1786
1786
  configure: async (device, coordinatorEndpoint, logger) => {
1787
1787
  const endpoint = device.getEndpoint(1);
1788
1788
  const binds = ['msTemperatureMeasurement', 'msRelativeHumidity', 'genPowerCfg', 'genAnalogInput'];
@@ -2006,6 +2006,7 @@ module.exports = [
2006
2006
  'multi: supports more events like double and hold'),
2007
2007
  exposes.enum('operation_mode', ea.ALL, ['command', 'event'])
2008
2008
  .withDescription('Operation mode, select "command" to enable bindings (wake up the device before changing modes!)')],
2009
+ meta: {battery: {voltageToPercentage: '3V_2850_3000_log'}},
2009
2010
  configure: async (device, coordinatorEndpoint, logger) => {
2010
2011
  const endpoint1 = device.getEndpoint(1);
2011
2012
  await endpoint1.write('aqaraOpple', {'mode': 1}, {manufacturerCode: 0x115f, disableResponse: true});
package/lib/legacy.js CHANGED
@@ -2107,7 +2107,7 @@ const fromZigbee = {
2107
2107
  hue_dimmer_switch: {
2108
2108
  cluster: 'manuSpecificPhilips',
2109
2109
  type: 'commandHueNotification',
2110
- options: [exposes.options.legacy()],
2110
+ options: [exposes.options.legacy(), exposes.options.simulated_brightness('Only works when legacy is false.')],
2111
2111
  convert: (model, msg, publish, options, meta) => {
2112
2112
  if (!isLegacyEnabled(options)) {
2113
2113
  return fromZigbeeConverters.hue_dimmer_switch.convert(model, msg, publish, options, meta);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-herdsman-converters",
3
- "version": "14.0.521",
3
+ "version": "14.0.522",
4
4
  "description": "Collection of device converters to be used with zigbee-herdsman",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -38,7 +38,7 @@
38
38
  "buffer-crc32": "^0.2.13",
39
39
  "https-proxy-agent": "^5.0.1",
40
40
  "tar-stream": "^2.2.0",
41
- "zigbee-herdsman": "^0.14.30"
41
+ "zigbee-herdsman": "^0.14.32"
42
42
  },
43
43
  "devDependencies": {
44
44
  "eslint": "*",