zigbee-herdsman-converters 14.0.456 → 14.0.457
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/converters/fromZigbee.js +24 -11
- package/devices/xiaomi.js +2 -2
- package/lib/exposes.js +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/converters/fromZigbee.js
CHANGED
|
@@ -5409,29 +5409,37 @@ const converters = {
|
|
|
5409
5409
|
},
|
|
5410
5410
|
},
|
|
5411
5411
|
RTCGQ12LM_occupancy_illuminance: {
|
|
5412
|
+
// This is for occupancy sensor that only send a message when motion detected,
|
|
5413
|
+
// but do not send a motion stop.
|
|
5414
|
+
// Therefore we need to publish the no_motion detected by ourselves.
|
|
5412
5415
|
cluster: 'aqaraOpple',
|
|
5413
5416
|
type: ['attributeReport', 'readResponse'],
|
|
5414
|
-
options: [exposes.options.
|
|
5417
|
+
options: [exposes.options.occupancy_timeout_2(), exposes.options.no_occupancy_since_true(),
|
|
5418
|
+
exposes.options.precision('illuminance'), exposes.options.calibration('illuminance', 'percentual')],
|
|
5415
5419
|
convert: (model, msg, publish, options, meta) => {
|
|
5416
5420
|
if (msg.data.hasOwnProperty('illuminance')) {
|
|
5417
5421
|
// The occupancy sensor only sends a message when motion detected.
|
|
5418
5422
|
// Therefore we need to publish the no_motion detected by ourselves.
|
|
5419
|
-
|
|
5423
|
+
let timeout = meta && meta.state && meta.state.hasOwnProperty('detection_interval') ?
|
|
5424
|
+
meta.state.detection_interval : 60;
|
|
5425
|
+
timeout = options && options.hasOwnProperty('occupancy_timeout') && options.occupancy_timeout >= timeout ?
|
|
5426
|
+
options.occupancy_timeout : timeout + 2;
|
|
5420
5427
|
|
|
5421
5428
|
// Stop existing timers because motion is detected and set a new one.
|
|
5422
|
-
globalStore.getValue(msg.endpoint, '
|
|
5423
|
-
globalStore.putValue(msg.endpoint, 'timers', []);
|
|
5429
|
+
clearTimeout(globalStore.getValue(msg.endpoint, 'occupancy_timer', null));
|
|
5424
5430
|
|
|
5425
5431
|
if (timeout !== 0) {
|
|
5426
5432
|
const timer = setTimeout(() => {
|
|
5427
5433
|
publish({occupancy: false});
|
|
5428
5434
|
}, timeout * 1000);
|
|
5429
5435
|
|
|
5430
|
-
globalStore.
|
|
5436
|
+
globalStore.putValue(msg.endpoint, 'occupancy_timer', timer);
|
|
5431
5437
|
}
|
|
5432
5438
|
|
|
5433
5439
|
const illuminance = msg.data['illuminance'] - 65536;
|
|
5434
|
-
|
|
5440
|
+
const payload = {occupancy: true, illuminance: calibrateAndPrecisionRoundOptions(illuminance, options, 'illuminance')};
|
|
5441
|
+
utils.noOccupancySince(msg.endpoint, options, publish, 'start');
|
|
5442
|
+
return payload;
|
|
5435
5443
|
}
|
|
5436
5444
|
},
|
|
5437
5445
|
},
|
|
@@ -5441,6 +5449,7 @@ const converters = {
|
|
|
5441
5449
|
// Therefore we need to publish the no_motion detected by ourselves.
|
|
5442
5450
|
cluster: 'msOccupancySensing',
|
|
5443
5451
|
type: ['attributeReport', 'readResponse'],
|
|
5452
|
+
options: [exposes.options.occupancy_timeout_2(), exposes.options.no_occupancy_since_true()],
|
|
5444
5453
|
convert: (model, msg, publish, options, meta) => {
|
|
5445
5454
|
if (msg.data.occupancy !== 1) {
|
|
5446
5455
|
// In case of 0 no occupancy is reported.
|
|
@@ -5450,21 +5459,25 @@ const converters = {
|
|
|
5450
5459
|
|
|
5451
5460
|
// The occupancy sensor only sends a message when motion detected.
|
|
5452
5461
|
// Therefore we need to publish the no_motion detected by ourselves.
|
|
5453
|
-
|
|
5462
|
+
let timeout = meta && meta.state && meta.state.hasOwnProperty('detection_interval') ?
|
|
5463
|
+
meta.state.detection_interval : 60;
|
|
5464
|
+
timeout = options && options.hasOwnProperty('occupancy_timeout') && options.occupancy_timeout >= timeout ?
|
|
5465
|
+
options.occupancy_timeout : timeout + 2;
|
|
5454
5466
|
|
|
5455
5467
|
// Stop existing timers because motion is detected and set a new one.
|
|
5456
|
-
globalStore.getValue(msg.endpoint, '
|
|
5457
|
-
globalStore.putValue(msg.endpoint, 'timers', []);
|
|
5468
|
+
clearTimeout(globalStore.getValue(msg.endpoint, 'occupancy_timer', null));
|
|
5458
5469
|
|
|
5459
5470
|
if (timeout !== 0) {
|
|
5460
5471
|
const timer = setTimeout(() => {
|
|
5461
5472
|
publish({occupancy: false});
|
|
5462
5473
|
}, timeout * 1000);
|
|
5463
5474
|
|
|
5464
|
-
globalStore.
|
|
5475
|
+
globalStore.putValue(msg.endpoint, 'occupancy_timer', timer);
|
|
5465
5476
|
}
|
|
5466
5477
|
|
|
5467
|
-
|
|
5478
|
+
const payload = {occupancy: true};
|
|
5479
|
+
utils.noOccupancySince(msg.endpoint, options, publish, 'start');
|
|
5480
|
+
return payload;
|
|
5468
5481
|
},
|
|
5469
5482
|
},
|
|
5470
5483
|
xiaomi_WXKG01LM_action: {
|
package/devices/xiaomi.js
CHANGED
|
@@ -878,7 +878,7 @@ module.exports = [
|
|
|
878
878
|
toZigbee: [tz.aqara_detection_interval],
|
|
879
879
|
exposes: [e.occupancy(), e.illuminance().withUnit('lx').withDescription('Measured illuminance in lux'),
|
|
880
880
|
exposes.numeric('detection_interval', ea.ALL).withValueMin(2).withValueMax(65535).withUnit('s')
|
|
881
|
-
.withDescription('Time interval for detecting actions'), e.battery()],
|
|
881
|
+
.withDescription('Time interval for detecting actions'), e.temperature(), e.battery()],
|
|
882
882
|
meta: {battery: {voltageToPercentage: '3V_2850_3000_log'}},
|
|
883
883
|
configure: async (device, coordinatorEndpoint, logger) => {
|
|
884
884
|
const endpoint = device.getEndpoint(1);
|
|
@@ -896,7 +896,7 @@ module.exports = [
|
|
|
896
896
|
toZigbee: [tz.aqara_detection_interval, tz.aqara_motion_sensitivity],
|
|
897
897
|
exposes: [e.occupancy(), exposes.enum('motion_sensitivity', ea.ALL, ['low', 'medium', 'high']),
|
|
898
898
|
exposes.numeric('detection_interval', ea.ALL).withValueMin(2).withValueMax(65535).withUnit('s')
|
|
899
|
-
.withDescription('Time interval for detecting actions'), e.battery()],
|
|
899
|
+
.withDescription('Time interval for detecting actions'), e.temperature(), e.battery()],
|
|
900
900
|
meta: {battery: {voltageToPercentage: '3V_2850_3000_log'}},
|
|
901
901
|
configure: async (device, coordinatorEndpoint, logger) => {
|
|
902
902
|
const endpoint = device.getEndpoint(1);
|
package/lib/exposes.js
CHANGED
|
@@ -487,6 +487,7 @@ module.exports = {
|
|
|
487
487
|
thermostat_unit: () => new Enum('thermostat_unit', access.SET, ['celsius', 'fahrenheit']).withDescription('Controls the temperature unit of the thermostat (default celsius).'),
|
|
488
488
|
expose_pin: () => new Binary(`expose_pin`, access.SET, true, false).withDescription(`Expose pin of this lock in the published payload (default false).`),
|
|
489
489
|
occupancy_timeout: () => new Numeric(`occupancy_timeout`, access.SET).withValueMin(0).withDescription('Time in seconds after which occupancy is cleared after detecting it (default 90 seconds).'),
|
|
490
|
+
occupancy_timeout_2: () => new Numeric(`occupancy_timeout`, access.SET).withValueMin(0).withValueStep(0.1).withUnit('s').withDescription('Time in seconds after which occupancy is cleared after detecting it (default is "detection_interval" + 2 seconds). The value must be equal to or greater than "detection_interval", and it can also be a fraction.'),
|
|
490
491
|
vibration_timeout: () => new Numeric(`vibration_timeout`, access.SET).withValueMin(0).withDescription('Time in seconds after which vibration is cleared after detecting it (default 90 seconds).'),
|
|
491
492
|
simulated_brightness: (extraNote='') => new Composite('simulated_brightness', 'simulated_brightness')
|
|
492
493
|
.withDescription(`Simulate a brightness value. If this device provides a brightness_move_up or brightness_move_down action it is possible to specify the update interval and delta.${extraNote}`)
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zigbee-herdsman-converters",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.457",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "zigbee-herdsman-converters",
|
|
9
|
-
"version": "14.0.
|
|
9
|
+
"version": "14.0.457",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^0.26.1",
|