zigbee-herdsman-converters 14.0.443 → 14.0.446

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.
@@ -20,6 +20,7 @@ const constants = require('../lib/constants');
20
20
  const libColor = require('../lib/color');
21
21
  const utils = require('../lib/utils');
22
22
  const exposes = require('../lib/exposes');
23
+ const xiaomi = require('../lib/xiaomi');
23
24
 
24
25
  const converters = {
25
26
  // #region Generic/recommended converters
@@ -427,7 +428,7 @@ const converters = {
427
428
  convert: (model, msg, publish, options, meta) => {
428
429
  if (msg.data.hasOwnProperty('occupancy')) {
429
430
  const payload = {occupancy: (msg.data.occupancy % 2) > 0};
430
- utils.noOccupancySince(msg.endpoint, payload, options, publish, payload.occupancy ? 'stop' : 'start');
431
+ utils.noOccupancySince(msg.endpoint, options, publish, payload.occupancy ? 'stop' : 'start');
431
432
  return payload;
432
433
  }
433
434
  },
@@ -463,7 +464,7 @@ const converters = {
463
464
  }
464
465
 
465
466
  const payload = {occupancy: true};
466
- utils.noOccupancySince(msg.endpoint, payload, options, publish, 'start');
467
+ utils.noOccupancySince(msg.endpoint, options, publish, 'start');
467
468
  return payload;
468
469
  },
469
470
  },
@@ -2789,6 +2790,33 @@ const converters = {
2789
2790
  }
2790
2791
  },
2791
2792
  },
2793
+ livolo_new_switch_state_4gang: {
2794
+ cluster: 'genPowerCfg',
2795
+ type: ['raw'],
2796
+ convert: (model, msg, publish, options, meta) => {
2797
+ const stateHeader = Buffer.from([122, 209]);
2798
+ if (msg.data.indexOf(stateHeader) === 0) {
2799
+ if (msg.data[10] === 7) {
2800
+ const status = msg.data[14];
2801
+ return {
2802
+ state_left: status & 1 ? 'ON' : 'OFF',
2803
+ state_right: status & 2 ? 'ON' : 'OFF',
2804
+ state_bottom_left: status & 4 ? 'ON' : 'OFF',
2805
+ state_bottom_right: status & 8 ? 'ON' : 'OFF',
2806
+ };
2807
+ }
2808
+ if (msg.data[10] === 13) {
2809
+ const status = msg.data[13];
2810
+ return {
2811
+ state_left: status & 1 ? 'ON' : 'OFF',
2812
+ state_right: status & 2 ? 'ON' : 'OFF',
2813
+ state_bottom_left: status & 4 ? 'ON' : 'OFF',
2814
+ state_bottom_right: status & 8 ? 'ON' : 'OFF',
2815
+ };
2816
+ }
2817
+ }
2818
+ },
2819
+ },
2792
2820
  livolo_curtain_switch_state: {
2793
2821
  cluster: 'genPowerCfg',
2794
2822
  type: ['raw'],
@@ -2948,7 +2976,8 @@ const converters = {
2948
2976
  meta.device.modelID = 'TI0001-socket';
2949
2977
  meta.device.save();
2950
2978
  }
2951
- if (msg.data.includes(Buffer.from([19, 1, 0]), 13)) {
2979
+ // No need to detect this switches, will be done by universal procedure
2980
+ /* if (msg.data.includes(Buffer.from([19, 1, 0]), 13)) {
2952
2981
  // new switch, hack
2953
2982
  meta.device.modelID = 'TI0001-switch';
2954
2983
  meta.device.save();
@@ -2957,7 +2986,7 @@ const converters = {
2957
2986
  // new switch, hack
2958
2987
  meta.device.modelID = 'TI0001-switch-2gang';
2959
2988
  meta.device.save();
2960
- }
2989
+ }*/
2961
2990
  if (msg.data.includes(Buffer.from([19, 5, 0]), 13)) {
2962
2991
  if (meta.logger) meta.logger.debug('Detected Livolo Curtain Switch');
2963
2992
  // curtain switch, hack
@@ -5230,40 +5259,27 @@ const converters = {
5230
5259
  type: ['attributeReport', 'readResponse'],
5231
5260
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature')],
5232
5261
  convert: (model, msg, publish, options, meta) => {
5233
- if (msg.data['65281']) {
5234
- const data = msg.data['65281'];
5235
- const payload = {};
5236
-
5237
- if (data.hasOwnProperty('100')) {
5238
- if (['QBKG03LM', 'QBKG12LM', 'LLKZMK11LM'].includes(model.model)) {
5239
- const mapping = model.model === 'LLKZMK11LM' ? ['l1', 'l2'] : ['left', 'right'];
5240
- payload[`state_${mapping[0]}`] = data['100'] === 1 ? 'ON' : 'OFF';
5241
- payload[`state_${mapping[1]}`] = data['101'] === 1 ? 'ON' : 'OFF';
5242
- } else {
5243
- payload.state = data['100'] === 1 ? 'ON' : 'OFF';
5244
- }
5245
- }
5246
-
5247
- if (data.hasOwnProperty('152')) {
5248
- payload.power = precisionRound(data['152'], 2);
5249
- }
5250
-
5251
- if (data.hasOwnProperty('149')) {
5252
- // Consumption is deprecated
5253
- payload.consumption = precisionRound(data['149'], 2);
5254
- payload.energy = precisionRound(data['149'], 2);
5255
- }
5256
-
5257
- if (data.hasOwnProperty('3')) {
5258
- payload.temperature = calibrateAndPrecisionRoundOptions(data['3'], options, 'temperature');
5259
- }
5260
-
5261
- if (data.hasOwnProperty('150')) {
5262
- payload.voltage = precisionRound(data['150'] * 0.1, 1);
5263
- }
5264
-
5265
- return payload;
5262
+ const payload = xiaomi.numericAttributes2Payload(msg, meta, model, options, msg.data);
5263
+ return payload;
5264
+ },
5265
+ },
5266
+ xiaomi_basic_raw: {
5267
+ cluster: 'genBasic',
5268
+ type: ['raw'],
5269
+ options: (definition) => {
5270
+ const result = [];
5271
+ if (definition.exposes.find((e) => e.name === 'temperature')) {
5272
+ result.push(exposes.options.precision('temperature'), exposes.options.calibration('temperature'));
5266
5273
  }
5274
+ return result;
5275
+ },
5276
+ convert: (model, msg, publish, options, meta) => {
5277
+ let payload = {};
5278
+ if (Buffer.isBuffer(msg.data)) {
5279
+ const dataObject = xiaomi.buffer2DataObject(meta, model, msg.data);
5280
+ payload = xiaomi.numericAttributes2Payload(msg, meta, model, options, dataObject);
5281
+ }
5282
+ return payload;
5267
5283
  },
5268
5284
  },
5269
5285
  aqara_opple: {
@@ -5280,226 +5296,7 @@ const converters = {
5280
5296
  return result;
5281
5297
  },
5282
5298
  convert: (model, msg, publish, options, meta) => {
5283
- const payload = {};
5284
- if (msg.data.hasOwnProperty('247')) {
5285
- const data = msg.data['247'];
5286
- // Xiaomi struct parsing
5287
- const length = data.length;
5288
- for (let i=0; i < length; i++) {
5289
- const index = data[i];
5290
- let value = null;
5291
- switch (data[i+1]) {
5292
- case 16:
5293
- // 0x10 ZclBoolean
5294
- value = data.readUInt8(i+2);
5295
- i += 2;
5296
- break;
5297
- case 32:
5298
- // 0x20 Zcl8BitUint
5299
- value = data.readUInt8(i+2);
5300
- i += 2;
5301
- break;
5302
- case 33:
5303
- // 0x21 Zcl16BitUint
5304
- value = data.readUInt16LE(i+2);
5305
- i += 3;
5306
- break;
5307
- case 34:
5308
- // 0x22 Zcl24BitUint
5309
- value = data.readUIntLE(i+2, 3);
5310
- i += 4;
5311
- break;
5312
- case 35:
5313
- // 0x23 Zcl32BitUint
5314
- value = data.readUInt32LE(i+2);
5315
- i += 5;
5316
- break;
5317
- case 36:
5318
- // 0x24 Zcl40BitUint
5319
- value = data.readUIntLE(i+2, 5);
5320
- i += 6;
5321
- break;
5322
- case 37:
5323
- // 0x25 Zcl48BitUint
5324
- value = data.readUIntLE(i+2, 6);
5325
- i += 7;
5326
- break;
5327
- case 38:
5328
- // 0x26 Zcl56BitUint
5329
- value = data.readUIntLE(i+2, 7);
5330
- i += 8;
5331
- break;
5332
- case 39:
5333
- // 0x27 Zcl64BitUint
5334
- value = data.readBigUInt64BE(i+2);
5335
- i += 9;
5336
- break;
5337
- case 40:
5338
- // 0x28 Zcl8BitInt
5339
- value = data.readInt8(i+2);
5340
- i += 2;
5341
- break;
5342
- case 41:
5343
- // 0x29 Zcl16BitInt
5344
- value = data.readInt16LE(i+2);
5345
- i += 3;
5346
- break;
5347
- case 42:
5348
- // 0x2A Zcl24BitInt
5349
- value = data.readIntLE(i+2, 3);
5350
- i += 4;
5351
- break;
5352
- case 43:
5353
- // 0x2B Zcl32BitInt
5354
- value = data.readInt32LE(i+2);
5355
- i += 5;
5356
- break;
5357
- case 44:
5358
- // 0x2C Zcl40BitInt
5359
- value = data.readIntLE(i+2, 5);
5360
- i += 6;
5361
- break;
5362
- case 45:
5363
- // 0x2D Zcl48BitInt
5364
- value = data.readIntLE(i+2, 6);
5365
- i += 7;
5366
- break;
5367
- case 46:
5368
- // 0x2E Zcl56BitInt
5369
- value = data.readIntLE(i+2, 7);
5370
- i += 8;
5371
- break;
5372
- case 47:
5373
- // 0x2F Zcl64BitInt
5374
- value = data.readBigInt64BE(i+2);
5375
- i += 9;
5376
- break;
5377
- case 57:
5378
- // 0x39 ZclSingleFloat
5379
- value = data.readFloatLE(i+2);
5380
- i += 5;
5381
- break;
5382
- case 58:
5383
- // 0x3a ZclDoubleFloat
5384
- value = data.readDoubleLE(i+2);
5385
- i += 5;
5386
- break;
5387
- default:
5388
- if (meta.logger) meta.logger.debug(`${model.zigbeeModel}: unknown vtype=${data[i+1]}, pos=${i+1}`);
5389
- }
5390
-
5391
- if (index == 1) {
5392
- payload.voltage = value;
5393
- payload.battery = batteryVoltageToPercentage(value, '3V_2100');
5394
- } else if (index === 3) {
5395
- if (!['WXCJKG11LM', 'WXCJKG12LM', 'WXCJKG13LM'].includes(model.model)) {
5396
- payload.temperature = calibrateAndPrecisionRoundOptions(value, options, 'temperature'); // 0x03
5397
- }
5398
- } else if (index === 5) {
5399
- if (['JT-BZ-01AQ/A', 'RTCZCGQ11LM'].includes(model.model)) payload.power_outage_count = value;
5400
- } else if (index === 100) {
5401
- if (['QBKG20LM', 'QBKG31LM', 'QBKG39LM', 'QBKG41LM', 'QBCZ15LM'].includes(model.model)) {
5402
- const mapping = model.model === 'QBCZ15LM' ? 'relay' : 'left';
5403
- payload[`state_${mapping}`] = value === 1 ? 'ON' : 'OFF';
5404
- } else if (['WXKG14LM', 'WXKG16LM', 'WXKG17LM'].includes(model.model)) {
5405
- payload.click_mode = {1: 'fast', 2: 'multi'}[value];
5406
- } else if (['WXCJKG11LM', 'WXCJKG12LM', 'WXCJKG13LM'].includes(model.model)) {
5407
- // We don't know what the value means for these devices.
5408
- // https://github.com/Koenkk/zigbee2mqtt/issues/11126
5409
- } else {
5410
- payload.state = value === 1 ? 'ON' : 'OFF';
5411
- }
5412
- } else if (index === 101) {
5413
- if (['QBKG20LM', 'QBKG31LM', 'QBKG39LM', 'QBKG41LM', 'QBCZ15LM'].includes(model.model)) {
5414
- const mapping = model.model === 'QBCZ15LM' ? 'usb' : 'right';
5415
- payload[`state_${mapping}`] = value === 1 ? 'ON' : 'OFF';
5416
- } else if (['QBKG25LM', 'QBKG34LM'].includes(model.model)) {
5417
- payload.state_center = value === 1 ? 'ON' : 'OFF';
5418
- } else if (['RTCGQ12LM'].includes(model.model)) {
5419
- payload.illuminance = calibrateAndPrecisionRoundOptions(value, options, 'illuminance');
5420
- } else if (['ZNJLBL01LM'].includes(model.model)) {
5421
- payload.battery = value;
5422
- }
5423
- } else if (index ===102 ) {
5424
- if (['QBKG25LM', 'QBKG34LM'].includes(model.model)) {
5425
- payload.state_right = value === 1 ? 'ON' : 'OFF';
5426
- } else if (['RTCZCGQ11LM'].includes(model.model)) {
5427
- payload.presence_event = {0: 'enter', 1: 'leave', 2: 'left_enter', 3: 'right_leave', 4: 'right_enter',
5428
- 5: 'left_leave', 6: 'approach', 7: 'away', 255: null}[value];
5429
- }
5430
- } else if (index === 103) {
5431
- if (['RTCZCGQ11LM'].includes(model.model)) payload.monitoring_mode = value === 1 ? 'left_right' : 'undirected';
5432
- } else if (index === 105) {
5433
- if (['RTCGQ13LM'].includes(model.model)) {
5434
- payload.motion_sensitivity = {1: 'low', 2: 'medium', 3: 'high'}[value];
5435
- } else if (['RTCZCGQ11LM'].includes(model.model)) {
5436
- payload.approach_distance = {0: 'far', 1: 'medium', 2: 'near'}[value];
5437
- }
5438
- } else if (index === 149) {
5439
- payload.energy = precisionRound(value, 2); // 0x95
5440
- // Consumption is deprecated
5441
- payload.consumption = payload.energy;
5442
- } else if (index === 150) payload.voltage = precisionRound(value * 0.1, 1); // 0x96
5443
- else if (index === 151) payload.current = precisionRound(value * 0.001, 4); // 0x97
5444
- else if (index === 152) payload.power = precisionRound(value, 2); // 0x98
5445
- else if (index === 159) payload.gas_sensitivity = {1: '15%LEL', 2: '10%LEL'}[value]; // JT-BZ-01AQ/A
5446
- else if (index === 160) payload.gas = value === 1; // JT-BZ-01AQ/A
5447
- else if (index === 161) payload.gas_density = value; // JT-BZ-01AQ/A
5448
- else if (index === 162) payload.test = value === 1; // JT-BZ-01AQ/A
5449
- else if (index === 163) payload.mute = value === 1; // JT-BZ-01AQ/A
5450
- else if (index === 164) payload.state = value === 1 ? 'preparation' : 'work'; // JT-BZ-01AQ/A
5451
- else if (index === 166) payload.linkage_alarm = value === 1; // JT-BZ-01AQ/A
5452
- else if (meta.logger) meta.logger.debug(`${model.zigbeeModel}: unknown index ${index} with value ${value}`);
5453
- }
5454
- }
5455
-
5456
- if (msg.data.hasOwnProperty('0')) payload.detection_period = msg.data['0'];
5457
- if (msg.data.hasOwnProperty('2')) {
5458
- if (['JT-BZ-01AQ/A'].includes(model.model)) payload.power_outage_count = msg.data['2'];
5459
- }
5460
- if (msg.data.hasOwnProperty('4')) payload.mode_switch = {4: 'anti_flicker_mode', 1: 'quick_mode'}[msg.data['4']];
5461
- if (msg.data.hasOwnProperty('10')) payload.switch_type = {1: 'toggle', 2: 'momentary'}[msg.data['10']];
5462
- if (msg.data.hasOwnProperty('240')) payload.flip_indicator_light = msg.data['240'] === 1 ? 'ON' : 'OFF';
5463
- if (msg.data.hasOwnProperty('258')) payload.detection_interval = msg.data['258'];
5464
- if (msg.data.hasOwnProperty('268')) {
5465
- if (['RTCGQ13LM'].includes(model.model)) {
5466
- payload.motion_sensitivity = {1: 'low', 2: 'medium', 3: 'high'}[msg.data['268']];
5467
- } else if (['JT-BZ-01AQ/A'].includes(model.model)) {
5468
- payload.gas_sensitivity = {1: '15%LEL', 2: '10%LEL'}[msg.data['268']];
5469
- }
5470
- }
5471
- if (msg.data.hasOwnProperty('293')) payload.click_mode = {1: 'fast', 2: 'multi'}[msg.data['293']];
5472
- if (msg.data.hasOwnProperty('294')) payload.mute = msg.data['294'] === 1; // JT-BZ-01AQ/A
5473
- if (msg.data.hasOwnProperty('295')) payload.test = msg.data['295'] === 1; // JT-BZ-01AQ/A
5474
- if (msg.data.hasOwnProperty('313')) payload.state = msg.data['313'] === 1 ? 'preparation' : 'work'; // JT-BZ-01AQ/A
5475
- if (msg.data.hasOwnProperty('314')) payload.gas = msg.data['314'] === 1; // JT-BZ-01AQ/A
5476
- if (msg.data.hasOwnProperty('315')) payload.gas_density = msg.data['315']; // JT-BZ-01AQ/A
5477
- if (msg.data.hasOwnProperty('322')) payload.presence = msg.data['322'] === 1; // RTCZCGQ11LM
5478
- if (msg.data.hasOwnProperty('323')) {
5479
- payload.presence_event = {0: 'enter', 1: 'leave', 2: 'left_enter', 3: 'right_leave', 4: 'right_enter',
5480
- 5: 'left_leave', 6: 'approach', 7: 'away'}[msg.data['323']]; // RTCZCGQ11LM
5481
- }
5482
- // RTCZCGQ11LM
5483
- if (msg.data.hasOwnProperty('324')) payload.monitoring_mode = msg.data['324'] === 1 ? 'left_right' : 'undirected';
5484
- // RTCZCGQ11LM
5485
- if (msg.data.hasOwnProperty('326')) payload.approach_distance = {0: 'far', 1: 'medium', 2: 'near'}[msg.data['326']];
5486
- if (msg.data.hasOwnProperty('331')) payload.linkage_alarm = msg.data['331'] === 1; // JT-BZ-01AQ/A
5487
- if (msg.data.hasOwnProperty('512')) {
5488
- if (['ZNCZ15LM', 'QBCZ14LM', 'QBCZ15LM'].includes(model.model)) {
5489
- payload.button_lock = msg.data['512'] === 1 ? 'OFF' : 'ON';
5490
- } else {
5491
- const mode = {0x01: 'control_relay', 0x00: 'decoupled'}[msg.data['512']];
5492
- payload[postfixWithEndpointName('operation_mode', msg, model)] = mode;
5493
- }
5494
- }
5495
- if (msg.data.hasOwnProperty('513')) payload.power_outage_memory = msg.data['513'] === 1;
5496
- if (msg.data.hasOwnProperty('514')) payload.auto_off = msg.data['514'] === 1;
5497
- if (msg.data.hasOwnProperty('515')) payload.led_disabled_night = msg.data['515'] === 1;
5498
- if (msg.data.hasOwnProperty('519')) payload.consumer_connected = msg.data['519'] === 1;
5499
- if (msg.data.hasOwnProperty('523')) payload.overload_protection = precisionRound(msg.data['523'], 2);
5500
- if (msg.data.hasOwnProperty('550')) payload.button_switch_mode = msg.data['550'] === 1 ? 'relay_and_usb' : 'relay';
5501
- if (msg.data['mode'] !== undefined) payload.operation_mode = ['command', 'event'][msg.data['mode']];
5502
- if (msg.data.hasOwnProperty('1289')) payload.dimmer_mode = {3: 'rgbw', 1: 'dual_ct'}[msg.data['1289']];
5299
+ const payload = xiaomi.numericAttributes2Payload(msg, meta, model, options, msg.data);
5503
5300
  return payload;
5504
5301
  },
5505
5302
  },
@@ -7929,6 +7726,8 @@ const converters = {
7929
7726
  case tuya.dataPoints.trsIlluminanceLux:
7930
7727
  result = {illuminance_lux: value};
7931
7728
  break;
7729
+ case tuya.dataPoints.trsDetectionData: // Ignore this, function of this DP is unknown at the moment!
7730
+ break;
7932
7731
  default:
7933
7732
  meta.logger.warn(`fromZigbee.tuya_radar_sensor: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(dpValue)}`);
7934
7733
  }
@@ -1599,13 +1599,23 @@ const converters = {
1599
1599
  }
1600
1600
 
1601
1601
  const state = value.toLowerCase();
1602
+ let oldstate = 1;
1603
+ if (state === 'on') {
1604
+ oldstate = 108;
1605
+ }
1606
+ let channel = 1.0;
1602
1607
  const postfix = meta.endpoint_name || 'left';
1603
1608
  await entity.command('genOnOff', 'toggle', {}, {transactionSequenceNumber: 0});
1604
1609
  const payloadOn = {0x0001: {value: Buffer.from([1, 0, 0, 0, 0, 0, 0, 0]), type: 1}};
1605
1610
  const payloadOff = {0x0001: {value: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), type: 1}};
1606
1611
  const payloadOnRight = {0x0001: {value: Buffer.from([2, 0, 0, 0, 0, 0, 0, 0]), type: 2}};
1607
1612
  const payloadOffRight = {0x0001: {value: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), type: 2}};
1613
+ const payloadOnBottomLeft = {0x0001: {value: Buffer.from([4, 0, 0, 0, 0, 0, 0, 0]), type: 4}};
1614
+ const payloadOffBottomLeft = {0x0001: {value: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), type: 4}};
1615
+ const payloadOnBottomRight = {0x0001: {value: Buffer.from([8, 0, 0, 0, 0, 0, 0, 0]), type: 136}};
1616
+ const payloadOffBottomRight = {0x0001: {value: Buffer.from([0, 0, 0, 0, 0, 0, 0, 0]), type: 136}};
1608
1617
  if (postfix === 'left') {
1618
+ await entity.command('genLevelCtrl', 'moveToLevelWithOnOff', {level: oldstate, transtime: channel});
1609
1619
  await entity.write('genPowerCfg', (state === 'on') ? payloadOn : payloadOff,
1610
1620
  {
1611
1621
  manufacturerCode: 0x1ad2, disableDefaultResponse: true, disableResponse: true,
@@ -1613,12 +1623,28 @@ const converters = {
1613
1623
  });
1614
1624
  return {state: {state_left: value.toUpperCase()}, readAfterWriteTime: 250};
1615
1625
  } else if (postfix === 'right') {
1626
+ channel = 2.0;
1627
+ await entity.command('genLevelCtrl', 'moveToLevelWithOnOff', {level: oldstate, transtime: channel});
1616
1628
  await entity.write('genPowerCfg', (state === 'on') ? payloadOnRight : payloadOffRight,
1617
1629
  {
1618
1630
  manufacturerCode: 0x1ad2, disableDefaultResponse: true, disableResponse: true,
1619
1631
  reservedBits: 3, direction: 1, transactionSequenceNumber: 0xe9,
1620
1632
  });
1621
1633
  return {state: {state_right: value.toUpperCase()}, readAfterWriteTime: 250};
1634
+ } else if (postfix === 'bottom_right') {
1635
+ await entity.write('genPowerCfg', (state === 'on') ? payloadOnBottomRight : payloadOffBottomRight,
1636
+ {
1637
+ manufacturerCode: 0x1ad2, disableDefaultResponse: true, disableResponse: true,
1638
+ reservedBits: 3, direction: 1, transactionSequenceNumber: 0xe9,
1639
+ });
1640
+ return {state: {state_bottom_right: value.toUpperCase()}, readAfterWriteTime: 250};
1641
+ } else if (postfix === 'bottom_left') {
1642
+ await entity.write('genPowerCfg', (state === 'on') ? payloadOnBottomLeft : payloadOffBottomLeft,
1643
+ {
1644
+ manufacturerCode: 0x1ad2, disableDefaultResponse: true, disableResponse: true,
1645
+ reservedBits: 3, direction: 1, transactionSequenceNumber: 0xe9,
1646
+ });
1647
+ return {state: {state_bottom_left: value.toUpperCase()}, readAfterWriteTime: 250};
1622
1648
  }
1623
1649
  return {state: {state: value.toUpperCase()}, readAfterWriteTime: 250};
1624
1650
  },
@@ -13,7 +13,7 @@ const tzLocal = {
13
13
  convertSet: async (entity, key, value, meta) => {
14
14
  const state = value.toLowerCase();
15
15
  utils.validateValue(state, ['toggle', 'off', 'on']);
16
- const endpoint = meta.mapped.model === 'AU-A1ZBDSS' ? meta.device.getEndpoint(3) : meta.device.getEndpoint(2);
16
+ const endpoint = meta.mapped.model === 'AU-A1ZBDSS' ? meta.device.getEndpoint(2) : meta.device.getEndpoint(3);
17
17
  await endpoint.command('genOnOff', state, {});
18
18
  return {state: {backlight_led: state.toUpperCase()}};
19
19
  },
package/devices/hive.js CHANGED
@@ -291,7 +291,7 @@ module.exports = [
291
291
  .withDescription('Period in minutes for which the setpoint hold will be active. 65535 = attribute not' +
292
292
  ' used. 0 to 360 to match the remote display').withEndpoint('heat'),
293
293
  exposes.climate().withSetpoint('occupied_heating_setpoint', 22, 22, 1).withLocalTemperature()
294
- .withSystemMode(['off', 'auto', 'heat']).withRunningState(['idle', 'heat']).withEndpoint('water'),
294
+ .withSystemMode(['off', 'auto', 'heat', 'emergency_heating']).withRunningState(['idle', 'heat']).withEndpoint('water'),
295
295
  exposes.binary('temperature_setpoint_hold', ea.ALL, true, false)
296
296
  .withDescription('Prevent changes. `false` = run normally. `true` = prevent from making changes.' +
297
297
  ' Must be set to `false` when system_mode = off or `true` for heat').withEndpoint('water'),
@@ -342,7 +342,7 @@ module.exports = [
342
342
  .withDescription('Period in minutes for which the setpoint hold will be active. 65535 = attribute not' +
343
343
  ' used. 0 to 360 to match the remote display').withEndpoint('heat'),
344
344
  exposes.climate().withSetpoint('occupied_heating_setpoint', 22, 22, 1).withLocalTemperature()
345
- .withSystemMode(['off', 'auto', 'heat']).withRunningState(['idle', 'heat']).withEndpoint('water'),
345
+ .withSystemMode(['off', 'auto', 'heat', 'emergency_heating']).withRunningState(['idle', 'heat']).withEndpoint('water'),
346
346
  exposes.binary('temperature_setpoint_hold', ea.ALL, true, false)
347
347
  .withDescription('Prevent changes. `false` = run normally. `true` = prevent from making changes.' +
348
348
  ' Must be set to `false` when system_mode = off or `true` for heat').withEndpoint('water'),
@@ -393,7 +393,7 @@ module.exports = [
393
393
  .withDescription('Period in minutes for which the setpoint hold will be active. 65535 = attribute not' +
394
394
  ' used. 0 to 360 to match the remote display').withEndpoint('heat'),
395
395
  exposes.climate().withSetpoint('occupied_heating_setpoint', 22, 22, 1).withLocalTemperature()
396
- .withSystemMode(['off', 'auto', 'heat']).withRunningState(['idle', 'heat']).withEndpoint('water'),
396
+ .withSystemMode(['off', 'auto', 'heat', 'emergency_heating']).withRunningState(['idle', 'heat']).withEndpoint('water'),
397
397
  exposes.binary('temperature_setpoint_hold', ea.ALL, true, false)
398
398
  .withDescription('Prevent changes. `false` = run normally. `true` = prevent from making changes.' +
399
399
  ' Must be set to `false` when system_mode = off or `true` for heat').withEndpoint('water'),
package/devices/lidl.js CHANGED
@@ -446,6 +446,8 @@ module.exports = [
446
446
  extend: extend.switch(),
447
447
  meta: {multiEndpoint: true},
448
448
  configure: async (device, coordinatorEndpoint, logger) => {
449
+ const endpoint = device.getEndpoint(1);
450
+ await endpoint.read('genBasic', ['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 0xfffe]);
449
451
  for (const ID of [1, 2, 3]) {
450
452
  await reporting.bind(device.getEndpoint(ID), coordinatorEndpoint, ['genOnOff']);
451
453
  }
package/devices/livolo.js CHANGED
@@ -20,13 +20,18 @@ module.exports = [
20
20
  {
21
21
  zigbeeModel: ['TI0001 '],
22
22
  model: 'TI0001',
23
- description: 'Zigbee switch (1 and 2 gang)',
23
+ description: 'Zigbee switch (1, 2, 3, 4 gang)',
24
24
  vendor: 'Livolo',
25
- exposes: [e.switch().withEndpoint('left'), e.switch().withEndpoint('right')],
26
- fromZigbee: [fz.livolo_switch_state, fz.livolo_switch_state_raw],
27
- toZigbee: [tz.livolo_switch_on_off],
25
+ exposes: [
26
+ e.switch().withEndpoint('left'),
27
+ e.switch().withEndpoint('right'),
28
+ e.switch().withEndpoint('bottom_left'),
29
+ e.switch().withEndpoint('bottom_right'),
30
+ ],
31
+ fromZigbee: [fz.livolo_switch_state, fz.livolo_switch_state_raw, fz.livolo_new_switch_state_4gang],
32
+ toZigbee: [tz.livolo_socket_switch_on_off],
28
33
  endpoint: (device) => {
29
- return {'left': 6, 'right': 6};
34
+ return {'left': 6, 'right': 6, 'bottom_left': 6, 'bottom_right': 6};
30
35
  },
31
36
  configure: poll,
32
37
  onEvent: async (type, data, device) => {
@@ -41,6 +46,18 @@ module.exports = [
41
46
  globalStore.putValue(device, 'interval', interval);
42
47
  }
43
48
  }
49
+ if (data.cluster === 'genPowerCfg' && data.type === 'raw') {
50
+ const dp = data.data[10];
51
+ if (data.data[0] === 0x7a && data.data[1] === 0xd1) {
52
+ const endpoint = device.getEndpoint(6);
53
+ if (dp === 0x01) {
54
+ const options = {manufacturerCode: 0x1ad2, disableDefaultResponse: true, disableResponse: true,
55
+ reservedBits: 3, direction: 1, writeUndiv: true};
56
+ const payload = {0x2002: {value: [0, 0, 0, 0, 0, 0, 0], type: 0x0e}};
57
+ await endpoint.readResponse('genPowerCfg', 0xe9, payload, options);
58
+ }
59
+ }
60
+ }
44
61
  },
45
62
  },
46
63
  {
@@ -3,6 +3,7 @@ const fz = {...require('../converters/fromZigbee'), legacy: require('../lib/lega
3
3
  const tz = require('../converters/toZigbee');
4
4
  const e = exposes.presets;
5
5
  const ea = exposes.access;
6
+ const reporting = require('../lib/reporting');
6
7
 
7
8
  module.exports = [
8
9
  {
@@ -19,8 +20,14 @@ module.exports = [
19
20
  model: 'HDM40PV620',
20
21
  vendor: 'Qmotion',
21
22
  description: 'Motorized roller blind',
22
- fromZigbee: [fz.identify],
23
+ fromZigbee: [fz.identify, fz.cover_position_tilt, fz.battery],
23
24
  toZigbee: [tz.cover_state, tz.cover_position_tilt],
24
- exposes: [e.cover_position()],
25
+ exposes: [e.cover_position(), e.battery()],
26
+ configure: async (device, coordinatorEndpoint, logger) => {
27
+ const endpoint = device.getEndpoint(1);
28
+ await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'closuresWindowCovering']);
29
+ await reporting.batteryPercentageRemaining(endpoint);
30
+ await reporting.currentPositionLiftPercentage(endpoint);
31
+ },
25
32
  },
26
33
  ];
@@ -157,7 +157,10 @@ module.exports = [
157
157
  const endpoint = device.getEndpoint(1);
158
158
  await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement']);
159
159
  await reporting.onOff(endpoint);
160
- await reporting.readEletricalMeasurementMultiplierDivisors(endpoint);
160
+ try {
161
+ // https://github.com/Koenkk/zigbee2mqtt/issues/11706
162
+ await reporting.readEletricalMeasurementMultiplierDivisors(endpoint);
163
+ } catch (error) {/* Fails for some*/}
161
164
  await reporting.activePower(endpoint);
162
165
  await reporting.rmsCurrent(endpoint);
163
166
  await reporting.rmsVoltage(endpoint, {change: 10});
package/devices/woox.js CHANGED
@@ -13,10 +13,10 @@ module.exports = [
13
13
  model: 'R7060',
14
14
  vendor: 'Woox',
15
15
  description: 'Smart garden irrigation control',
16
- fromZigbee: [fz.on_off, fz.ignore_tuya_set_time, fz.ignore_basic_report, fz.woox_R7060],
16
+ fromZigbee: [fz.on_off, fz.ignore_tuya_set_time, fz.ignore_basic_report, fz.woox_R7060, fz.battery],
17
17
  toZigbee: [tz.on_off],
18
18
  onEvent: tuya.onEventSetTime,
19
- exposes: [e.switch()],
19
+ exposes: [e.switch(), e.battery(), e.battery_voltage()],
20
20
  meta: {disableDefaultResponse: true},
21
21
  },
22
22
  {
package/devices/xiaomi.js CHANGED
@@ -1292,13 +1292,13 @@ module.exports = [
1292
1292
  model: 'LLKZMK11LM',
1293
1293
  vendor: 'Xiaomi',
1294
1294
  description: 'Aqara wireless relay controller',
1295
- fromZigbee: [fz.xiaomi_switch_basic, fz.xiaomi_power, fz.ignore_multistate_report, fz.on_off, fz.aqara_opple],
1295
+ fromZigbee: [fz.xiaomi_switch_basic, fz.xiaomi_power, fz.ignore_multistate_report, fz.on_off, fz.xiaomi_basic_raw],
1296
1296
  meta: {multiEndpoint: true},
1297
1297
  toZigbee: [tz.on_off, tz.LLKZMK11LM_interlock, tz.xiaomi_power],
1298
1298
  endpoint: (device) => {
1299
1299
  return {'l1': 1, 'l2': 2};
1300
1300
  },
1301
- exposes: [e.power().withAccess(ea.STATE_GET), e.energy(), e.temperature(), e.voltage().withAccess(ea.STATE),
1301
+ exposes: [e.power().withAccess(ea.STATE_GET), e.energy(), e.temperature(), e.voltage().withAccess(ea.STATE), e.current(),
1302
1302
  e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'),
1303
1303
  exposes.binary('interlock', ea.STATE_SET, true, false)
1304
1304
  .withDescription('Enabling prevents both relais being on at the same time')],
package/devices/yale.js CHANGED
@@ -42,6 +42,13 @@ module.exports = [
42
42
  description: 'Assure lock SL',
43
43
  extend: lockExtend(),
44
44
  },
45
+ {
46
+ zigbeeModel: ['0600000001'],
47
+ model: 'YMF30',
48
+ vendor: 'Yale',
49
+ description: 'Digital lock',
50
+ extend: lockExtend(),
51
+ },
45
52
  {
46
53
  zigbeeModel: ['iZBModule01', '0700000001'],
47
54
  model: 'YMF40/YDM4109+',
@@ -125,7 +125,10 @@ module.exports = [
125
125
  },
126
126
  },
127
127
  {
128
- fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_iossyxra'}],
128
+ fingerprint: [
129
+ {modelID: 'TS0601', manufacturerName: '_TZE200_iossyxra'},
130
+ {modelID: 'TS0601', manufacturerName: '_TZE200_gubdgai2'},
131
+ ],
129
132
  model: 'ZM-AM02_cover',
130
133
  vendor: 'Zemismart',
131
134
  description: 'Zigbee/RF curtain converter',
@@ -1,5 +1,4 @@
1
1
  const url = 'https://raw.githubusercontent.com/Koenkk/zigbee-OTA/master/index.json';
2
- const assert = require('assert');
3
2
  const common = require('./common');
4
3
  const axios = common.getAxios();
5
4
  const fs = require('fs');
@@ -110,7 +109,10 @@ async function getImageMeta(current, logger, device) {
110
109
  (!i.minFileVersion || current.fileVersion >= i.minFileVersion) && (!i.maxFileVersion || current.fileVersion <= i.maxFileVersion) &&
111
110
  (!i.modelId || i.modelId === modelId) && (!i.manufacturerName || i.manufacturerName.includes(manufacturerName)));
112
111
 
113
- assert(image !== undefined, `No image available for imageType '${imageType}'`);
112
+ if (!image) {
113
+ throw new Error(`No image available for imageType '${imageType}'`);
114
+ }
115
+
114
116
  return {
115
117
  fileVersion: image.fileVersion,
116
118
  fileSize: image.fileSize,
package/lib/tuya.js CHANGED
@@ -435,6 +435,7 @@ const dataPoints = {
435
435
  trsSensitivity: 2,
436
436
  trsMotionState: 102,
437
437
  trsIlluminanceLux: 103,
438
+ trsDetectionData: 104,
438
439
  trsScene: 112,
439
440
  trsMotionDirection: 114,
440
441
  trsMotionSpeed: 115,
package/lib/utils.js CHANGED
@@ -397,13 +397,12 @@ function extendDevice(deviceConfigs, modelName, adjustments) {
397
397
  return {...baseDevice, ...adjustments};
398
398
  }
399
399
 
400
- function noOccupancySince(endpoint, newPayload, options, publish, action) {
400
+ function noOccupancySince(endpoint, options, publish, action) {
401
401
  if (options && options.no_occupancy_since) {
402
402
  if (action == 'start') {
403
403
  globalStore.getValue(endpoint, 'no_occupancy_since_timers', []).forEach((t) => clearTimeout(t));
404
404
  globalStore.putValue(endpoint, 'no_occupancy_since_timers', []);
405
405
 
406
- newPayload.no_occupancy_since = 0;
407
406
  options.no_occupancy_since.forEach((since) => {
408
407
  const timer = setTimeout(() => {
409
408
  publish({no_occupancy_since: since});
package/lib/xiaomi.js ADDED
@@ -0,0 +1,384 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ batteryVoltageToPercentage,
5
+ calibrateAndPrecisionRoundOptions,
6
+ postfixWithEndpointName,
7
+ precisionRound,
8
+ } = require('./utils');
9
+
10
+ const buffer2DataObject = (meta, model, buffer) => {
11
+ const dataObject = {};
12
+
13
+ if (buffer !== null && Buffer.isBuffer(buffer)) {
14
+ // Xiaomi struct parsing
15
+ for (let i = 0; i < buffer.length - 1; i++) {
16
+ const index = buffer[i];
17
+ let value = null;
18
+
19
+ switch (buffer[i + 1]) {
20
+ case 16:
21
+ case 32:
22
+ // 0x10 ZclBoolean
23
+ // 0x20 Zcl8BitUint
24
+ value = buffer.readUInt8(i + 2);
25
+ i += 2;
26
+ break;
27
+ case 33:
28
+ // 0x21 Zcl16BitUint
29
+ value = buffer.readUInt16LE(i + 2);
30
+ i += 3;
31
+ break;
32
+ case 34:
33
+ // 0x22 Zcl24BitUint
34
+ value = buffer.readUIntLE(i + 2, 3);
35
+ i += 4;
36
+ break;
37
+ case 35:
38
+ // 0x23 Zcl32BitUint
39
+ value = buffer.readUInt32LE(i + 2);
40
+ i += 5;
41
+ break;
42
+ case 36:
43
+ // 0x24 Zcl40BitUint
44
+ value = buffer.readUIntLE(i + 2, 5);
45
+ i += 6;
46
+ break;
47
+ case 37:
48
+ // 0x25 Zcl48BitUint
49
+ value = buffer.readUIntLE(i + 2, 6);
50
+ i += 7;
51
+ break;
52
+ case 38:
53
+ // 0x26 Zcl56BitUint
54
+ value = buffer.readUIntLE(i + 2, 7);
55
+ i += 8;
56
+ break;
57
+ case 39:
58
+ // 0x27 Zcl64BitUint
59
+ value = buffer.readBigUInt64BE(i + 2);
60
+ i += 9;
61
+ break;
62
+ case 40:
63
+ // 0x28 Zcl8BitInt
64
+ value = buffer.readInt8(i + 2);
65
+ i += 2;
66
+ break;
67
+ case 41:
68
+ // 0x29 Zcl16BitInt
69
+ value = buffer.readInt16LE(i + 2);
70
+ i += 3;
71
+ break;
72
+ case 42:
73
+ // 0x2A Zcl24BitInt
74
+ value = buffer.readIntLE(i + 2, 3);
75
+ i += 4;
76
+ break;
77
+ case 43:
78
+ // 0x2B Zcl32BitInt
79
+ value = buffer.readInt32LE(i+2);
80
+ i += 5;
81
+ break;
82
+ case 44:
83
+ // 0x2C Zcl40BitInt
84
+ value = buffer.readIntLE(i + 2, 5);
85
+ i += 6;
86
+ break;
87
+ case 45:
88
+ // 0x2D Zcl48BitInt
89
+ value = buffer.readIntLE(i + 2, 6);
90
+ i += 7;
91
+ break;
92
+ case 46:
93
+ // 0x2E Zcl56BitInt
94
+ value = buffer.readIntLE(i + 2, 7);
95
+ i += 8;
96
+ break;
97
+ case 47:
98
+ // 0x2F Zcl64BitInt
99
+ value = buffer.readBigInt64BE(i + 2);
100
+ i += 9;
101
+ break;
102
+ case 57:
103
+ // 0x39 ZclSingleFloat
104
+ value = buffer.readFloatLE(i + 2);
105
+ i += 5;
106
+ break;
107
+ case 58:
108
+ // 0x3a ZclDoubleFloat
109
+ value = buffer.readDoubleLE(i + 2);
110
+ i += 5;
111
+ break;
112
+ case 66:
113
+ // 0x42 unknown, length taken from what seems correct in the logs, maybe is wrong
114
+ if (meta.logger) meta.logger.debug(`${model.zigbeeModel}: unknown vtype=${buffer[i+1]}, pos=${i+1}, moving length 1`);
115
+ i += 2;
116
+ break;
117
+ case 95:
118
+ // 0x5f unknown, length taken from what seems correct in the logs, maybe is wrong
119
+ if (meta.logger) meta.logger.debug(`${model.zigbeeModel}: unknown vtype=${buffer[i+1]}, pos=${i+1}, moving length 4`);
120
+ i += 5;
121
+ break;
122
+ default:
123
+ if (meta.logger) meta.logger.debug(`${model.zigbeeModel}: unknown vtype=${buffer[i + 1]}, pos=${i + 1}`);
124
+ }
125
+
126
+ if (value != null) {
127
+ dataObject[index] = value;
128
+ }
129
+ }
130
+ }
131
+
132
+ if (meta.logger) meta.logger.debug(`${model.zigbeeModel}: Processed buffer into data ${JSON.stringify(dataObject)}`);
133
+
134
+ return dataObject;
135
+ };
136
+
137
+ const numericAttributes2Payload = (msg, meta, model, options, dataObject) => {
138
+ let payload = {};
139
+
140
+ Object.entries(dataObject).forEach(([key, value]) => {
141
+ switch (key) {
142
+ case '0':
143
+ payload.detection_period = value;
144
+ break;
145
+ case '1':
146
+ payload.voltage = value;
147
+ payload.battery = batteryVoltageToPercentage(value, '3V_2100');
148
+ break;
149
+ case '2':
150
+ if (['JT-BZ-01AQ/A'].includes(model.model)) {
151
+ payload.power_outage_count = value;
152
+ }
153
+ break;
154
+ case '3':
155
+ if (!['WXCJKG11LM', 'WXCJKG12LM', 'WXCJKG13LM'].includes(model.model)) {
156
+ payload.temperature = calibrateAndPrecisionRoundOptions(value, options, 'temperature'); // 0x03
157
+ }
158
+ break;
159
+ case '4':
160
+ payload.mode_switch = {4: 'anti_flicker_mode', 1: 'quick_mode'}[value];
161
+ break;
162
+ case '5':
163
+ if (['JT-BZ-01AQ/A', 'RTCZCGQ11LM'].includes(model.model)) {
164
+ payload.power_outage_count = value;
165
+ }
166
+ break;
167
+ case '10':
168
+ payload.switch_type = {1: 'toggle', 2: 'momentary'}[value];
169
+ break;
170
+ case '100':
171
+ if (['QBKG20LM', 'QBKG31LM', 'QBKG39LM', 'QBKG41LM', 'QBCZ15LM', 'LLKZMK11LM', 'QBKG12LM', 'QBKG03LM'].includes(model.model)) {
172
+ let mapping;
173
+ switch (model.model) {
174
+ case 'QBCZ15LM':
175
+ mapping = 'relay';
176
+ break;
177
+ case 'LLKZMK11LM':
178
+ mapping = 'l1';
179
+ break;
180
+ default:
181
+ mapping = 'left';
182
+ }
183
+ payload[`state_${mapping}`] = value === 1 ? 'ON' : 'OFF';
184
+ } else if (['WXKG14LM', 'WXKG16LM', 'WXKG17LM'].includes(model.model)) {
185
+ payload.click_mode = {1: 'fast', 2: 'multi'}[value];
186
+ } else if (['WXCJKG11LM', 'WXCJKG12LM', 'WXCJKG13LM'].includes(model.model)) {
187
+ // We don't know what the value means for these devices.
188
+ // https://github.com/Koenkk/zigbee2mqtt/issues/11126
189
+ } else {
190
+ payload.state = value === 1 ? 'ON' : 'OFF';
191
+ }
192
+ break;
193
+ case '101':
194
+ if (['QBKG20LM', 'QBKG31LM', 'QBKG39LM', 'QBKG41LM', 'QBCZ15LM', 'QBKG25LM', 'QBKG34LM', 'LLKZMK11LM', 'QBKG12LM', 'QBKG03LM']
195
+ .includes(model.model)) {
196
+ let mapping;
197
+ switch (model.model) {
198
+ case 'QBCZ15LM':
199
+ mapping = 'usb';
200
+ break;
201
+ case 'QBKG25LM':
202
+ case 'QBKG34LM':
203
+ mapping = 'center';
204
+ break;
205
+ case 'LLKZMK11LM':
206
+ mapping = 'l2';
207
+ break;
208
+ default:
209
+ mapping = 'right';
210
+ }
211
+ payload[`state_${mapping}`] = value === 1 ? 'ON' : 'OFF';
212
+ } else if (['RTCGQ12LM'].includes(model.model)) {
213
+ payload.illuminance = calibrateAndPrecisionRoundOptions(value, options, 'illuminance');
214
+ } else if (['ZNJLBL01LM'].includes(model.model)) {
215
+ payload.battery = value;
216
+ }
217
+ break;
218
+ case '102':
219
+ if (['QBKG25LM', 'QBKG34LM'].includes(model.model)) {
220
+ payload.state_right = value === 1 ? 'ON' : 'OFF';
221
+ } else if (['RTCZCGQ11LM'].includes(model.model)) {
222
+ payload.presence_event = {0: 'enter', 1: 'leave', 2: 'left_enter', 3: 'right_leave', 4: 'right_enter',
223
+ 5: 'left_leave', 6: 'approach', 7: 'away', 255: null}[value];
224
+ }
225
+ break;
226
+ case '103':
227
+ if (['RTCZCGQ11LM'].includes(model.model)) {
228
+ payload.monitoring_mode = value === 1 ? 'left_right' : 'undirected';
229
+ }
230
+ break;
231
+ case '105':
232
+ if (['RTCGQ13LM'].includes(model.model)) {
233
+ payload.motion_sensitivity = {1: 'low', 2: 'medium', 3: 'high'}[value];
234
+ } else if (['RTCZCGQ11LM'].includes(model.model)) {
235
+ payload.approach_distance = {0: 'far', 1: 'medium', 2: 'near'}[value];
236
+ }
237
+ break;
238
+ case '149':
239
+ payload.energy = precisionRound(value, 2); // 0x95
240
+ // Consumption is deprecated
241
+ payload.consumption = payload.energy;
242
+ break;
243
+ case '150':
244
+ payload.voltage = precisionRound(value * 0.1, 1); // 0x96
245
+ break;
246
+ case '151':
247
+ if (['LLKZMK11LM'].includes(model.model)) {
248
+ payload.current = precisionRound(value, 4);
249
+ } else {
250
+ payload.current = precisionRound(value * 0.001, 4);
251
+ }
252
+ break;
253
+ case '152':
254
+ payload.power = precisionRound(value, 2); // 0x98
255
+ break;
256
+ case '159':
257
+ payload.gas_sensitivity = {1: '15%LEL', 2: '10%LEL'}[value]; // JT-BZ-01AQ/A
258
+ break;
259
+ case '160':
260
+ payload.gas = value === 1; // JT-BZ-01AQ/A
261
+ break;
262
+ case '161':
263
+ payload.gas_density = value; // JT-BZ-01AQ/A
264
+ break;
265
+ case '162':
266
+ payload.test = value === 1; // JT-BZ-01AQ/A
267
+ break;
268
+ case '163':
269
+ payload.mute = value === 1; // JT-BZ-01AQ/A
270
+ break;
271
+ case '164':
272
+ payload.state = value === 1 ? 'preparation' : 'work'; // JT-BZ-01AQ/A
273
+ break;
274
+ case '166':
275
+ payload.linkage_alarm = value === 1; // JT-BZ-01AQ/A
276
+ break;
277
+ case '240':
278
+ payload.flip_indicator_light = value === 1 ? 'ON' : 'OFF';
279
+ break;
280
+ case '247':
281
+ {
282
+ const dataObject247 = buffer2DataObject(meta, model, value);
283
+ const payload247 = numericAttributes2Payload(msg, meta, model, options, dataObject247);
284
+ payload = {...payload, ...payload247};
285
+ }
286
+ break;
287
+ case '258':
288
+ payload.detection_interval = value;
289
+ break;
290
+ case '268':
291
+ if (['RTCGQ13LM'].includes(model.model)) {
292
+ payload.motion_sensitivity = {1: 'low', 2: 'medium', 3: 'high'}[value];
293
+ } else if (['JT-BZ-01AQ/A'].includes(model.model)) {
294
+ payload.gas_sensitivity = {1: '15%LEL', 2: '10%LEL'}[value];
295
+ }
296
+ break;
297
+ case '293':
298
+ payload.click_mode = {1: 'fast', 2: 'multi'}[value];
299
+ break;
300
+ case '294':
301
+ payload.mute = value === 1; // JT-BZ-01AQ/A
302
+ break;
303
+ case '295':
304
+ payload.test = value === 1; // JT-BZ-01AQ/A
305
+ break;
306
+ case '313':
307
+ payload.state = value === 1 ? 'preparation' : 'work'; // JT-BZ-01AQ/A
308
+ break;
309
+ case '314':
310
+ payload.gas = value === 1; // JT-BZ-01AQ/A
311
+ break;
312
+ case '315':
313
+ payload.gas_density = value; // JT-BZ-01AQ/A
314
+ break;
315
+ case '322':
316
+ payload.presence = value === 1; // RTCZCGQ11LM
317
+ break;
318
+ case '323':
319
+ payload.presence_event = {0: 'enter', 1: 'leave', 2: 'left_enter', 3: 'right_leave', 4: 'right_enter',
320
+ 5: 'left_leave', 6: 'approach', 7: 'away'}[value]; // RTCZCGQ11LM
321
+ break;
322
+ case '324':
323
+ // RTCZCGQ11LM
324
+ payload.monitoring_mode = value === 1 ? 'left_right' : 'undirected';
325
+ break;
326
+ case '326':
327
+ // RTCZCGQ11LM
328
+ payload.approach_distance = {0: 'far', 1: 'medium', 2: 'near'}[value];
329
+ break;
330
+ case '331':
331
+ payload.linkage_alarm = value === 1; // JT-BZ-01AQ/A
332
+ break;
333
+ case '512':
334
+ if (['ZNCZ15LM', 'QBCZ14LM', 'QBCZ15LM'].includes(model.model)) {
335
+ payload.button_lock = value === 1 ? 'OFF' : 'ON';
336
+ } else {
337
+ const mode = {0x01: 'control_relay', 0x00: 'decoupled'}[value];
338
+ payload[postfixWithEndpointName('operation_mode', msg, model)] = mode;
339
+ }
340
+ break;
341
+ case '513':
342
+ payload.power_outage_memory = value === 1;
343
+ break;
344
+ case '514':
345
+ payload.auto_off = value === 1;
346
+ break;
347
+ case '515':
348
+ payload.led_disabled_night = value === 1;
349
+ break;
350
+ case '519':
351
+ payload.consumer_connected = value === 1;
352
+ break;
353
+ case '523':
354
+ payload.overload_protection = precisionRound(value, 2);
355
+ break;
356
+ case '550':
357
+ payload.button_switch_mode = value === 1 ? 'relay_and_usb' : 'relay';
358
+ break;
359
+ case '1289':
360
+ payload.dimmer_mode = {3: 'rgbw', 1: 'dual_ct'}[value];
361
+ break;
362
+ case '65281':
363
+ {
364
+ const payload65281 = numericAttributes2Payload(msg, meta, model, options, value);
365
+ payload = {...payload, ...payload65281};
366
+ }
367
+ break;
368
+ case 'mode':
369
+ payload.operation_mode = ['command', 'event'][value];
370
+ break;
371
+ default:
372
+ if (meta.logger) meta.logger.debug(`${model.zigbeeModel}: unknown key ${key} with value ${value}`);
373
+ }
374
+ });
375
+
376
+ if (meta.logger) meta.logger.debug(`${model.zigbeeModel}: Processed data into payload ${JSON.stringify(payload)}`);
377
+
378
+ return payload;
379
+ };
380
+
381
+ module.exports = {
382
+ buffer2DataObject,
383
+ numericAttributes2Payload,
384
+ };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-herdsman-converters",
3
- "version": "14.0.443",
3
+ "version": "14.0.446",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -912,35 +912,35 @@
912
912
  }
913
913
  },
914
914
  "@types/yargs-parser": {
915
- "version": "20.2.1",
916
- "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz",
917
- "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==",
915
+ "version": "21.0.0",
916
+ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz",
917
+ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==",
918
918
  "dev": true
919
919
  },
920
920
  "@typescript-eslint/scope-manager": {
921
- "version": "5.12.1",
922
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.1.tgz",
923
- "integrity": "sha512-J0Wrh5xS6XNkd4TkOosxdpObzlYfXjAFIm9QxYLCPOcHVv1FyyFCPom66uIh8uBr0sZCrtS+n19tzufhwab8ZQ==",
921
+ "version": "5.13.0",
922
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz",
923
+ "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==",
924
924
  "dev": true,
925
925
  "requires": {
926
- "@typescript-eslint/types": "5.12.1",
927
- "@typescript-eslint/visitor-keys": "5.12.1"
926
+ "@typescript-eslint/types": "5.13.0",
927
+ "@typescript-eslint/visitor-keys": "5.13.0"
928
928
  }
929
929
  },
930
930
  "@typescript-eslint/types": {
931
- "version": "5.12.1",
932
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.1.tgz",
933
- "integrity": "sha512-hfcbq4qVOHV1YRdhkDldhV9NpmmAu2vp6wuFODL71Y0Ixak+FLeEU4rnPxgmZMnGreGEghlEucs9UZn5KOfHJA==",
931
+ "version": "5.13.0",
932
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz",
933
+ "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==",
934
934
  "dev": true
935
935
  },
936
936
  "@typescript-eslint/typescript-estree": {
937
- "version": "5.12.1",
938
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.1.tgz",
939
- "integrity": "sha512-ahOdkIY9Mgbza7L9sIi205Pe1inCkZWAHE1TV1bpxlU4RZNPtXaDZfiiFWcL9jdxvW1hDYZJXrFm+vlMkXRbBw==",
937
+ "version": "5.13.0",
938
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz",
939
+ "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==",
940
940
  "dev": true,
941
941
  "requires": {
942
- "@typescript-eslint/types": "5.12.1",
943
- "@typescript-eslint/visitor-keys": "5.12.1",
942
+ "@typescript-eslint/types": "5.13.0",
943
+ "@typescript-eslint/visitor-keys": "5.13.0",
944
944
  "debug": "^4.3.2",
945
945
  "globby": "^11.0.4",
946
946
  "is-glob": "^4.0.3",
@@ -949,15 +949,15 @@
949
949
  }
950
950
  },
951
951
  "@typescript-eslint/utils": {
952
- "version": "5.12.1",
953
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.1.tgz",
954
- "integrity": "sha512-Qq9FIuU0EVEsi8fS6pG+uurbhNTtoYr4fq8tKjBupsK5Bgbk2I32UGm0Sh+WOyjOPgo/5URbxxSNV6HYsxV4MQ==",
952
+ "version": "5.13.0",
953
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz",
954
+ "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==",
955
955
  "dev": true,
956
956
  "requires": {
957
957
  "@types/json-schema": "^7.0.9",
958
- "@typescript-eslint/scope-manager": "5.12.1",
959
- "@typescript-eslint/types": "5.12.1",
960
- "@typescript-eslint/typescript-estree": "5.12.1",
958
+ "@typescript-eslint/scope-manager": "5.13.0",
959
+ "@typescript-eslint/types": "5.13.0",
960
+ "@typescript-eslint/typescript-estree": "5.13.0",
961
961
  "eslint-scope": "^5.1.1",
962
962
  "eslint-utils": "^3.0.0"
963
963
  },
@@ -981,12 +981,12 @@
981
981
  }
982
982
  },
983
983
  "@typescript-eslint/visitor-keys": {
984
- "version": "5.12.1",
985
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.1.tgz",
986
- "integrity": "sha512-l1KSLfupuwrXx6wc0AuOmC7Ko5g14ZOQ86wJJqRbdLbXLK02pK/DPiDDqCc7BqqiiA04/eAA6ayL0bgOrAkH7A==",
984
+ "version": "5.13.0",
985
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz",
986
+ "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==",
987
987
  "dev": true,
988
988
  "requires": {
989
- "@typescript-eslint/types": "5.12.1",
989
+ "@typescript-eslint/types": "5.13.0",
990
990
  "eslint-visitor-keys": "^3.0.0"
991
991
  }
992
992
  },
@@ -1292,9 +1292,9 @@
1292
1292
  "dev": true
1293
1293
  },
1294
1294
  "caniuse-lite": {
1295
- "version": "1.0.30001312",
1296
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz",
1297
- "integrity": "sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ==",
1295
+ "version": "1.0.30001313",
1296
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001313.tgz",
1297
+ "integrity": "sha512-rI1UN0koZUiKINjysQDuRi2VeSCce3bYJNmDcj3PIKREiAmjakugBul1QSkg/fPrlULYl6oWfGg3PbgOSY9X4Q==",
1298
1298
  "dev": true
1299
1299
  },
1300
1300
  "chalk": {
@@ -1526,9 +1526,9 @@
1526
1526
  }
1527
1527
  },
1528
1528
  "electron-to-chromium": {
1529
- "version": "1.4.73",
1530
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.73.tgz",
1531
- "integrity": "sha512-RlCffXkE/LliqfA5m29+dVDPB2r72y2D2egMMfIy3Le8ODrxjuZNVo4NIC2yPL01N4xb4nZQLwzi6Z5tGIGLnA==",
1529
+ "version": "1.4.76",
1530
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.76.tgz",
1531
+ "integrity": "sha512-3Vftv7cenJtQb+k00McEBZ2vVmZ/x+HEF7pcZONZIkOsESqAqVuACmBxMv0JhzX7u0YltU0vSqRqgBSTAhFUjA==",
1532
1532
  "dev": true
1533
1533
  },
1534
1534
  "emittery": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-herdsman-converters",
3
- "version": "14.0.443",
3
+ "version": "14.0.446",
4
4
  "description": "Collection of device converters to be used with zigbee-herdsman",
5
5
  "main": "index.js",
6
6
  "files": [