zigbee-herdsman-converters 14.0.294 → 14.0.295
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 +23 -4
- package/converters/toZigbee.js +16 -0
- package/devices/ikea.js +3 -1
- package/devices/tuya.js +15 -9
- package/lib/exposes.js +1 -0
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
package/converters/fromZigbee.js
CHANGED
|
@@ -5366,22 +5366,30 @@ const converters = {
|
|
|
5366
5366
|
tradfri_occupancy: {
|
|
5367
5367
|
cluster: 'genOnOff',
|
|
5368
5368
|
type: 'commandOnWithTimedOff',
|
|
5369
|
-
options: [exposes.options.occupancy_timeout()],
|
|
5369
|
+
options: [exposes.options.occupancy_timeout(), exposes.options.illuminance_below_threshold_check()],
|
|
5370
5370
|
convert: (model, msg, publish, options, meta) => {
|
|
5371
|
-
|
|
5371
|
+
const onlyWhenOnFlag = (msg.data.ctrlbits & 1) != 0;
|
|
5372
|
+
if (onlyWhenOnFlag &&
|
|
5373
|
+
(!options || !options.hasOwnProperty('illuminance_below_threshold_check') ||
|
|
5374
|
+
options.illuminance_below_threshold_check) &&
|
|
5375
|
+
!globalStore.hasValue(msg.endpoint, 'timer')) return;
|
|
5372
5376
|
|
|
5373
5377
|
const timeout = options && options.hasOwnProperty('occupancy_timeout') ?
|
|
5374
5378
|
options.occupancy_timeout : msg.data.ontime / 10;
|
|
5375
5379
|
|
|
5376
5380
|
// Stop existing timer because motion is detected and set a new one.
|
|
5377
5381
|
clearTimeout(globalStore.getValue(msg.endpoint, 'timer'));
|
|
5382
|
+
globalStore.clearValue(msg.endpoint, 'timer');
|
|
5378
5383
|
|
|
5379
5384
|
if (timeout !== 0) {
|
|
5380
|
-
const timer = setTimeout(() =>
|
|
5385
|
+
const timer = setTimeout(() => {
|
|
5386
|
+
publish({occupancy: false});
|
|
5387
|
+
globalStore.clearValue(msg.endpoint, 'timer');
|
|
5388
|
+
}, timeout * 1000);
|
|
5381
5389
|
globalStore.putValue(msg.endpoint, 'timer', timer);
|
|
5382
5390
|
}
|
|
5383
5391
|
|
|
5384
|
-
return {occupancy: true};
|
|
5392
|
+
return {occupancy: true, illuminance_above_threshold: onlyWhenOnFlag};
|
|
5385
5393
|
},
|
|
5386
5394
|
},
|
|
5387
5395
|
almond_click: {
|
|
@@ -7048,6 +7056,17 @@ const converters = {
|
|
|
7048
7056
|
return result;
|
|
7049
7057
|
},
|
|
7050
7058
|
},
|
|
7059
|
+
tuya_operation_mode: {
|
|
7060
|
+
cluster: 'genOnOff',
|
|
7061
|
+
type: ['attributeReport', 'readResponse'],
|
|
7062
|
+
convert: (model, msg, publish, options, meta) => {
|
|
7063
|
+
if (msg.data.hasOwnProperty('tuyaOperationMode')) {
|
|
7064
|
+
const value = msg.data['tuyaOperationMode'];
|
|
7065
|
+
const lookup = {0: 'command', 1: 'event'};
|
|
7066
|
+
return {operation_mode: lookup[value]};
|
|
7067
|
+
}
|
|
7068
|
+
},
|
|
7069
|
+
},
|
|
7051
7070
|
// #endregion
|
|
7052
7071
|
|
|
7053
7072
|
// #region Ignore converters (these message dont need parsing).
|
package/converters/toZigbee.js
CHANGED
|
@@ -5954,6 +5954,22 @@ const converters = {
|
|
|
5954
5954
|
await endpoint.read('genAnalogInput', ['presentValue']);
|
|
5955
5955
|
},
|
|
5956
5956
|
},
|
|
5957
|
+
tuya_operation_mode: {
|
|
5958
|
+
key: ['operation_mode'],
|
|
5959
|
+
convertSet: async (entity, key, value, meta) => {
|
|
5960
|
+
// modes:
|
|
5961
|
+
// 0 - 'command' mode. keys send commands. useful for group control
|
|
5962
|
+
// 1 - 'event' mode. keys send events. useful for handling
|
|
5963
|
+
const lookup = {command: 0, event: 1};
|
|
5964
|
+
const endpoint = meta.device.getEndpoint(1);
|
|
5965
|
+
await endpoint.write('genOnOff', {'tuyaOperationMode': lookup[value.toLowerCase()]});
|
|
5966
|
+
return {state: {operation_mode: value.toLowerCase()}};
|
|
5967
|
+
},
|
|
5968
|
+
convertGet: async (entity, key, meta) => {
|
|
5969
|
+
const endpoint = meta.device.getEndpoint(1);
|
|
5970
|
+
await endpoint.read('genOnOff', ['tuyaOperationMode']);
|
|
5971
|
+
},
|
|
5972
|
+
},
|
|
5957
5973
|
// #endregion
|
|
5958
5974
|
|
|
5959
5975
|
// #region Ignore converters
|
package/devices/ikea.js
CHANGED
|
@@ -486,7 +486,9 @@ module.exports = [
|
|
|
486
486
|
toZigbee: [],
|
|
487
487
|
exposes: [e.battery(), e.occupancy(),
|
|
488
488
|
exposes.numeric('requested_brightness_level', ea.STATE).withValueMin(76).withValueMax(254),
|
|
489
|
-
exposes.numeric('requested_brightness_percent', ea.STATE).withValueMin(30).withValueMax(100)
|
|
489
|
+
exposes.numeric('requested_brightness_percent', ea.STATE).withValueMin(30).withValueMax(100),
|
|
490
|
+
exposes.binary('illuminance_above_threshold', ea.STATE, true, false)
|
|
491
|
+
.withDescription('Indicates whether the device detected bright light (works only in night mode)')],
|
|
490
492
|
ota: ota.tradfri,
|
|
491
493
|
meta: {battery: {dontDividePercentage: true}},
|
|
492
494
|
configure: async (device, coordinatorEndpoint, logger) => {
|
package/devices/tuya.js
CHANGED
|
@@ -1413,20 +1413,26 @@ module.exports = [
|
|
|
1413
1413
|
model: 'YSR-MINI-Z',
|
|
1414
1414
|
vendor: 'TuYa',
|
|
1415
1415
|
description: '2 in 1 dimming remote control and scene control',
|
|
1416
|
-
exposes: [
|
|
1417
|
-
|
|
1418
|
-
'
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1416
|
+
exposes: [
|
|
1417
|
+
e.battery(),
|
|
1418
|
+
e.action(['on', 'off',
|
|
1419
|
+
'brightness_move_up', 'brightness_step_up', 'brightness_step_down', 'brightness_move_down', 'brightness_stop',
|
|
1420
|
+
'color_temperature_step_down', 'color_temperature_step_up',
|
|
1421
|
+
'1_single', '1_double', '1_hold', '2_single', '2_double', '2_hold',
|
|
1422
|
+
'3_single', '3_double', '3_hold', '4_single', '4_double', '4_hold',
|
|
1423
|
+
]),
|
|
1424
|
+
exposes.enum('operation_mode', ea.ALL, ['command', 'event']).withDescription(
|
|
1425
|
+
'Operation mode: "command" - for group control, "event" - for clicks'),
|
|
1426
|
+
],
|
|
1423
1427
|
fromZigbee: [fz.battery, fz.command_on, fz.command_off, fz.command_step, fz.command_move, fz.command_stop,
|
|
1424
|
-
fz.command_step_color_temperature, fz.tuya_on_off_action],
|
|
1425
|
-
toZigbee: [],
|
|
1428
|
+
fz.command_step_color_temperature, fz.tuya_on_off_action, fz.tuya_operation_mode],
|
|
1429
|
+
toZigbee: [tz.tuya_operation_mode],
|
|
1430
|
+
onEvent: tuya.onEventSetLocalTime,
|
|
1426
1431
|
configure: async (device, coordinatorEndpoint, logger) => {
|
|
1427
1432
|
const endpoint = device.getEndpoint(1);
|
|
1428
1433
|
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg']);
|
|
1429
1434
|
await reporting.batteryPercentageRemaining(endpoint);
|
|
1435
|
+
await endpoint.read('genOnOff', ['tuyaOperationMode']);
|
|
1430
1436
|
},
|
|
1431
1437
|
},
|
|
1432
1438
|
{
|
package/lib/exposes.js
CHANGED
|
@@ -486,6 +486,7 @@ module.exports = {
|
|
|
486
486
|
transition: () => new Numeric(`transition`, access.SET).withValueMin(0).withDescription('Controls the transition time (in seconds) of on/off, brightness, color temperature (if applicable) and color (if applicable) changes. Defaults to `0` (no transition).'),
|
|
487
487
|
legacy: () => new Binary(`legacy`, access.SET, true, false).withDescription(`Set to false to disable the legacy integration (highly recommended), will change structure of the published payload (default true).`),
|
|
488
488
|
measurement_poll_interval: () => new Numeric(`measurement_poll_interval`, access.SET).withValueMin(0).withDescription(`This device does not support reporting electric measurements so it is polled instead. The default poll interval is 60 seconds.`),
|
|
489
|
+
illuminance_below_threshold_check: () => new Binary(`illuminance_below_threshold_check`, access.SET, true, false).withDescription(`Set to false to also send messages when illuminance is above threshold in night mode (default true).`),
|
|
489
490
|
},
|
|
490
491
|
presets: {
|
|
491
492
|
action: (values) => new Enum('action', access.STATE, values).withDescription('Triggered action (e.g. a button click)'),
|
package/npm-shrinkwrap.json
CHANGED