zigbee-herdsman-converters 14.0.364 → 14.0.368

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.
@@ -1073,7 +1073,6 @@ const converters = {
1073
1073
  cluster: 'ssIasAce',
1074
1074
  type: 'commandArm',
1075
1075
  convert: (model, msg, publish, options, meta) => {
1076
- if (hasAlreadyProcessedMessage(msg)) return;
1077
1076
  const payload = converters.command_arm.convert(model, msg, publish, options, meta);
1078
1077
  if (!payload) return;
1079
1078
  payload.action_transaction = msg.meta.zclTransactionSequenceNumber;
@@ -1690,10 +1689,11 @@ const converters = {
1690
1689
  type: ['commandDataResponse', 'commandDataReport'],
1691
1690
  convert: (model, msg, publish, options, meta) => {
1692
1691
  const multiEndpoint = model.meta && model.meta.multiEndpoint;
1693
- const dp = msg.data.dp;
1694
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1692
+ const dpValue = tuya.firstDpValue(msg, meta, 'moes_105_dimmer');
1693
+ const dp = dpValue.dp;
1694
+ const value = tuya.getDataValue(dpValue);
1695
1695
 
1696
- meta.logger.debug(`from moes_105_dimmer, msg.data.dp=[${dp}], msg.data.datatype=[${msg.data.datatype}], value=[${value}]`);
1696
+ meta.logger.debug(`from moes_105_dimmer, dp=[${dp}], datatype=[${dpValue.datatype}], value=[${value}]`);
1697
1697
 
1698
1698
  const state = value ? 'ON': 'OFF';
1699
1699
  const brightness = mapNumberRange(value, 0, 1000, 0, 254);
@@ -1709,7 +1709,7 @@ const converters = {
1709
1709
  return {brightness_l2: brightness};
1710
1710
  default:
1711
1711
  meta.logger.debug(`zigbee-herdsman-converters:moes_105_dimmer:` +
1712
- `NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(msg.data)}`);
1712
+ `NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(dpValue)}`);
1713
1713
  }
1714
1714
  },
1715
1715
  },
@@ -1785,8 +1785,9 @@ const converters = {
1785
1785
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
1786
1786
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
1787
1787
  convert: (model, msg, publish, options, meta) => {
1788
- const dp = msg.data.dp;
1789
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1788
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_temperature_humidity_sensor');
1789
+ const dp = dpValue.dp;
1790
+ const value = tuya.getDataValue(dpValue);
1790
1791
  switch (dp) {
1791
1792
  case 1:
1792
1793
  return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
@@ -1796,7 +1797,7 @@ const converters = {
1796
1797
  return {battery: value};
1797
1798
  default:
1798
1799
  meta.logger.warn(`zigbee-herdsman-converters:maa_tuya_temp_sensor: NOT RECOGNIZED ` +
1799
- `DP #${dp} with data ${JSON.stringify(msg.data)}`);
1800
+ `DP #${dp} with data ${JSON.stringify(dpValue)}`);
1800
1801
  }
1801
1802
  },
1802
1803
  },
@@ -1806,8 +1807,9 @@ const converters = {
1806
1807
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
1807
1808
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
1808
1809
  convert: (model, msg, publish, options, meta) => {
1809
- const dp = msg.data.dp;
1810
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1810
+ const dpValue = tuya.firstDpValue(msg, meta, 'nous_lcd_temperature_humidity_sensor');
1811
+ const dp = dpValue.dp;
1812
+ const value = tuya.getDataValue(dpValue);
1811
1813
  switch (dp) {
1812
1814
  case tuya.dataPoints.nousTemperature:
1813
1815
  return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
@@ -1827,7 +1829,7 @@ const converters = {
1827
1829
  return {temperature_sensitivity: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
1828
1830
  default:
1829
1831
  meta.logger.warn(`zigbee-herdsman-converters:nous_lcd_temperature_humidity_sensor: NOT RECOGNIZED ` +
1830
- `DP #${dp} with data ${JSON.stringify(msg.data)}`);
1832
+ `DP #${dp} with data ${JSON.stringify(dpValue)}`);
1831
1833
  }
1832
1834
  },
1833
1835
  },
@@ -1837,8 +1839,9 @@ const converters = {
1837
1839
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
1838
1840
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
1839
1841
  convert: (model, msg, publish, options, meta) => {
1840
- const dp = msg.data.dp;
1841
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1842
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_illuminance_temperature_humidity_sensor');
1843
+ const dp = dpValue.dp;
1844
+ const value = tuya.getDataValue(dpValue);
1842
1845
  switch (dp) {
1843
1846
  case tuya.dataPoints.thitTemperature:
1844
1847
  return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
@@ -1850,7 +1853,7 @@ const converters = {
1850
1853
  return {illuminance_lux: value};
1851
1854
  default:
1852
1855
  meta.logger.warn(`zigbee-herdsman-converters:tuya_illuminance_temperature_humidity_sensor: NOT RECOGNIZED ` +
1853
- `DP #${dp} with data ${JSON.stringify(msg.data)}`);
1856
+ `DP #${dp} with data ${JSON.stringify(dpValue)}`);
1854
1857
  }
1855
1858
  },
1856
1859
  },
@@ -1887,8 +1890,9 @@ const converters = {
1887
1890
  cluster: 'manuSpecificTuya',
1888
1891
  type: ['commandDataResponse', 'commandDataReport'],
1889
1892
  convert: (model, msg, publish, options, meta) => {
1890
- const dp = msg.data.dp;
1891
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1893
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_thermostat_weekly_schedule');
1894
+ const dp = dpValue.dp;
1895
+ const value = tuya.getDataValue(dpValue);
1892
1896
 
1893
1897
  const thermostatMeta = getMetaValue(msg.endpoint, model, 'thermostat');
1894
1898
  const firstDayDpId = thermostatMeta.weeklyScheduleFirstDayDpId;
@@ -1936,8 +1940,9 @@ const converters = {
1936
1940
  cluster: 'manuSpecificTuya',
1937
1941
  type: ['commandDataReport', 'commandDataResponse'],
1938
1942
  convert: (model, msg, publish, options, meta) => {
1939
- const dp = msg.data.dp;
1940
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1943
+ const dpValue = tuya.firstDpValue(msg, meta, 'hy_thermostat');
1944
+ const dp = dpValue.dp;
1945
+ const value = tuya.getDataValue(dpValue);
1941
1946
 
1942
1947
  switch (dp) {
1943
1948
  case tuya.dataPoints.hyWorkdaySchedule1: // schedule for workdays [5,9,12,8,0,15,10,0,15]
@@ -2010,7 +2015,7 @@ const converters = {
2010
2015
  return {alarm: (value > 0) ? true : false};
2011
2016
  default: // The purpose of the codes 17 & 19 are still unknown
2012
2017
  meta.logger.warn(`zigbee-herdsman-converters:hy_thermostat: Unrecognized DP #${
2013
- dp} with data ${JSON.stringify(msg.data)}`);
2018
+ dp} with data ${JSON.stringify(dpValue)}`);
2014
2019
  }
2015
2020
  },
2016
2021
  },
@@ -2070,8 +2075,9 @@ const converters = {
2070
2075
  // Protocol description
2071
2076
  // https://github.com/Koenkk/zigbee-herdsman-converters/issues/1159#issuecomment-614659802
2072
2077
 
2073
- const dp = msg.data.dp;
2074
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
2078
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_cover');
2079
+ const dp = dpValue.dp;
2080
+ const value = tuya.getDataValue(dpValue);
2075
2081
 
2076
2082
  switch (dp) {
2077
2083
  case tuya.dataPoints.coverPosition: // Started moving to position (triggered from Zigbee)
@@ -2097,7 +2103,7 @@ const converters = {
2097
2103
  break;
2098
2104
  default: // Unknown code
2099
2105
  meta.logger.warn(`TuYa_cover_control: Unhandled DP #${dp} for ${meta.device.manufacturerName}:
2100
- ${JSON.stringify(msg.data)}`);
2106
+ ${JSON.stringify(dpValue)}`);
2101
2107
  }
2102
2108
  },
2103
2109
  },
@@ -2391,8 +2397,9 @@ const converters = {
2391
2397
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
2392
2398
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
2393
2399
  convert: (model, msg, publish, options, meta) => {
2394
- const dp = msg.data.dp;
2395
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
2400
+ const dpValue = tuya.firstDpValue(msg, meta, 'neo_nas_pd07');
2401
+ const dp = dpValue.dp;
2402
+ const value = tuya.getDataValue(dpValue);
2396
2403
 
2397
2404
  if (dp === 101) return {occupancy: value > 0 ? true : false};
2398
2405
  else if (dp === 102) {
@@ -2407,7 +2414,7 @@ const converters = {
2407
2414
  } else if (dp === 105) {
2408
2415
  return {humidity: calibrateAndPrecisionRoundOptions(value, options, 'humidity')};
2409
2416
  } else {
2410
- meta.logger.warn(`zigbee-herdsman-converters:NEO-PD07: NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(msg.data)}`);
2417
+ meta.logger.warn(`zigbee-herdsman-converters:NEO-PD07: NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(dpValue)}`);
2411
2418
  }
2412
2419
  },
2413
2420
  },
@@ -2415,8 +2422,9 @@ const converters = {
2415
2422
  cluster: 'manuSpecificTuya',
2416
2423
  type: ['commandDataReport', 'commandDataResponse'],
2417
2424
  convert: (model, msg, publish, options, meta) => {
2418
- const dp = msg.data.dp;
2419
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
2425
+ const dpValue = tuya.firstDpValue(msg, meta, 'neo_t_h_alarm');
2426
+ const dp = dpValue.dp;
2427
+ const value = tuya.getDataValue(dpValue);
2420
2428
 
2421
2429
  switch (dp) {
2422
2430
  case tuya.dataPoints.neoAlarm:
@@ -2453,7 +2461,7 @@ const converters = {
2453
2461
  case tuya.dataPoints.neoVolume: // 0x0474 [0]/[1]/[2] Volume 0-max, 2-low
2454
2462
  return {volume: {2: 'low', 1: 'medium', 0: 'high'}[value]};
2455
2463
  default: // Unknown code
2456
- meta.logger.warn(`Unhandled DP #${dp}: ${JSON.stringify(msg.data)}`);
2464
+ meta.logger.warn(`Unhandled DP #${dp}: ${JSON.stringify(dpValue)}`);
2457
2465
  }
2458
2466
  },
2459
2467
  },
@@ -2560,8 +2568,9 @@ const converters = {
2560
2568
  cluster: 'manuSpecificTuya',
2561
2569
  type: 'commandDataReport',
2562
2570
  convert: (model, msg, publish, options, meta) => {
2563
- if (msg.data.dp === tuya.dataPoints.waterLeak) {
2564
- return {water_leak: tuya.getDataValue(msg.data.datatype, msg.data.data)};
2571
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_water_leak');
2572
+ if (dpValue.dp === tuya.dataPoints.waterLeak) {
2573
+ return {water_leak: tuya.getDataValue(dpValue)};
2565
2574
  }
2566
2575
  },
2567
2576
  },
@@ -2924,8 +2933,9 @@ const converters = {
2924
2933
  cluster: 'manuSpecificTuya',
2925
2934
  type: ['commandDataResponse', 'commandDataReport'],
2926
2935
  convert: (model, msg, publish, options, meta) => {
2927
- const dp = msg.data.dp;
2928
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
2936
+ const dpValue = tuya.firstDpValue(msg, meta, 'silvercrest_smart_led_string');
2937
+ const dp = dpValue.dp;
2938
+ const value = tuya.getDataValue(dpValue);
2929
2939
  const result = {};
2930
2940
 
2931
2941
  if (dp === tuya.dataPoints.silvercrestChangeMode) {
@@ -3547,8 +3557,9 @@ const converters = {
3547
3557
  cluster: 'manuSpecificTuya',
3548
3558
  type: ['commandDataResponse', 'commandDataReport'],
3549
3559
  convert: (model, msg, publish, options, meta) => {
3550
- const dp = msg.data.dp;
3551
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3560
+ const dpValue = tuya.firstDpValue(msg, meta, 'moes_thermostat');
3561
+ const dp = dpValue.dp;
3562
+ const value = tuya.getDataValue(dpValue);
3552
3563
  let temperature;
3553
3564
  /* See tuyaThermostat above for message structure comment */
3554
3565
  switch (dp) {
@@ -3612,7 +3623,7 @@ const converters = {
3612
3623
  }
3613
3624
  default: // DataPoint 17 is unknown
3614
3625
  meta.logger.warn(`zigbee-herdsman-converters:Moes BHT-002: Unrecognized DP #${
3615
- dp} with data ${JSON.stringify(msg.data)}`);
3626
+ dp} with data ${JSON.stringify(dpValue)}`);
3616
3627
  }
3617
3628
  },
3618
3629
  },
@@ -3620,8 +3631,9 @@ const converters = {
3620
3631
  cluster: 'manuSpecificTuya',
3621
3632
  type: ['commandDataResponse', 'commandDataReport'],
3622
3633
  convert: (model, msg, publish, options, meta) => {
3623
- const dp = msg.data.dp; // First we get the data point ID
3624
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3634
+ const dpValue = tuya.firstDpValue(msg, meta, 'moesS_thermostat');
3635
+ const dp = dpValue.dp; // First we get the data point ID
3636
+ const value = tuya.getDataValue(dpValue);
3625
3637
  const presetLookup = {0: 'programming', 1: 'manual', 2: 'temporary_manual', 3: 'holiday'};
3626
3638
  switch (dp) {
3627
3639
  case tuya.dataPoints.moesSsystemMode:
@@ -3672,7 +3684,7 @@ const converters = {
3672
3684
  }
3673
3685
  default:
3674
3686
  meta.logger.warn(`zigbee-herdsman-converters:moesS_thermostat: NOT RECOGNIZED DP #${
3675
- dp} with data ${JSON.stringify(msg.data)}`);
3687
+ dp} with data ${JSON.stringify(dpValue)}`);
3676
3688
  }
3677
3689
  },
3678
3690
  },
@@ -3680,8 +3692,9 @@ const converters = {
3680
3692
  cluster: 'manuSpecificTuya',
3681
3693
  type: ['commandDataResponse', 'commandDataReport'],
3682
3694
  convert: (model, msg, publish, options, meta) => {
3683
- const dp = msg.data.dp;
3684
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3695
+ const dpValue = tuya.firstDpValue(msg, meta, 'tvtwo_thermostat');
3696
+ const dp = dpValue.dp;
3697
+ const value = tuya.getDataValue(dpValue);
3685
3698
  const presetLookup = {0: 'auto', 1: 'manual', 2: 'holiday'};
3686
3699
  switch (dp) {
3687
3700
  case tuya.dataPoints.tvMode:
@@ -3823,7 +3836,7 @@ const converters = {
3823
3836
 
3824
3837
  default:
3825
3838
  meta.logger.warn(`zigbee-herdsman-converters:tvtwo_thermostat: NOT RECOGNIZED DP #${
3826
- dp} with data ${JSON.stringify(msg.data)}`);
3839
+ dp} with data ${JSON.stringify(dpValue)}`);
3827
3840
  }
3828
3841
  },
3829
3842
  },
@@ -3831,8 +3844,9 @@ const converters = {
3831
3844
  cluster: 'manuSpecificTuya',
3832
3845
  type: ['commandDataResponse', 'commandDataReport'],
3833
3846
  convert: (model, msg, publish, options, meta) => {
3834
- const dp = msg.data.dp; // First we get the data point ID
3835
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3847
+ const dpValue = tuya.firstDpValue(msg, meta, 'haozee_thermostat');
3848
+ const dp = dpValue.dp; // First we get the data point ID
3849
+ const value = tuya.getDataValue(dpValue);
3836
3850
  const presetLookup = {0: 'auto', 1: 'manual', 2: 'off', 3: 'on'};
3837
3851
  switch (dp) {
3838
3852
  case tuya.dataPoints.haozeeSystemMode:
@@ -3938,7 +3952,7 @@ const converters = {
3938
3952
  break;
3939
3953
  default:
3940
3954
  meta.logger.warn(`zigbee-herdsman-converters:haozee: NOT RECOGNIZED DP #${
3941
- dp} with data ${JSON.stringify(msg.data)}`);
3955
+ dp} with data ${JSON.stringify(dpValue)}`);
3942
3956
  }
3943
3957
  },
3944
3958
  },
@@ -3951,8 +3965,9 @@ const converters = {
3951
3965
  exposes.options.precision('voc'), exposes.options.calibration('voc'),
3952
3966
  exposes.options.precision('formaldehyd'), exposes.options.calibration('formaldehyd')],
3953
3967
  convert: (model, msg, publish, options, meta) => {
3954
- const dp = msg.data.dp;
3955
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3968
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_air_quality');
3969
+ const dp = dpValue.dp;
3970
+ const value = tuya.getDataValue(dpValue);
3956
3971
  switch (dp) {
3957
3972
  case tuya.dataPoints.tuyaSabTemp:
3958
3973
  return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
@@ -3967,7 +3982,7 @@ const converters = {
3967
3982
  return {formaldehyd: calibrateAndPrecisionRoundOptions(value, options, 'formaldehyd')};
3968
3983
  default:
3969
3984
  meta.logger.warn(`zigbee-herdsman-converters:TuyaSmartAirBox: Unrecognized DP #${
3970
- dp} with data ${JSON.stringify(msg.data)}`);
3985
+ dp} with data ${JSON.stringify(dpValue)}`);
3971
3986
  }
3972
3987
  },
3973
3988
  },
@@ -3975,10 +3990,14 @@ const converters = {
3975
3990
  cluster: 'manuSpecificTuya',
3976
3991
  type: ['commandDataResponse', 'commandDataReport'],
3977
3992
  convert: (model, msg, publish, options, meta) => {
3978
- const dp = msg.data.dp;
3979
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3993
+ const dpValue = tuya.firstDpValue(msg, meta, 'saswell_thermostat');
3994
+ const dp = dpValue.dp;
3995
+ const value = tuya.getDataValue(dpValue);
3980
3996
 
3981
3997
  switch (dp) {
3998
+ case tuya.dataPoints.saswellHeating:
3999
+ // heating status 1 - heating
4000
+ return {'heating': value ? 'ON' : 'OFF'};
3982
4001
  case tuya.dataPoints.saswellWindowDetection:
3983
4002
  return {window_detection: value ? 'ON' : 'OFF'};
3984
4003
  case tuya.dataPoints.saswellFrostDetection:
@@ -4088,7 +4107,7 @@ const converters = {
4088
4107
  return {anti_scaling: value ? 'ON' : 'OFF'};
4089
4108
  default:
4090
4109
  meta.logger.warn(`zigbee-herdsman-converters:SaswellThermostat: Unrecognized DP #${
4091
- dp} with data ${JSON.stringify(msg.data)}`);
4110
+ dp} with data ${JSON.stringify(dpValue)}`);
4092
4111
  }
4093
4112
  },
4094
4113
  },
@@ -4096,8 +4115,9 @@ const converters = {
4096
4115
  cluster: 'manuSpecificTuya',
4097
4116
  type: ['commandDataResponse', 'commandDataReport'],
4098
4117
  convert: (model, msg, publish, options, meta) => {
4099
- const dp = msg.data.dp;
4100
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4118
+ const dpValue = tuya.firstDpValue(msg, meta, 'etop_thermostat');
4119
+ const dp = dpValue.dp;
4120
+ const value = tuya.getDataValue(dpValue);
4101
4121
 
4102
4122
  if (dp >= 101 && dp <=107) return; // handled by tuya_thermostat_weekly_schedule
4103
4123
 
@@ -4137,7 +4157,7 @@ const converters = {
4137
4157
  return {running_state: value ? 'heat' : 'idle'};
4138
4158
  default:
4139
4159
  meta.logger.warn(`zigbee-herdsman-converters:eTopThermostat: Unrecognized DP #${
4140
- dp} with data ${JSON.stringify(msg.data)}`);
4160
+ dp} with data ${JSON.stringify(dpValue)}`);
4141
4161
  }
4142
4162
  },
4143
4163
  },
@@ -4145,8 +4165,9 @@ const converters = {
4145
4165
  cluster: 'manuSpecificTuya',
4146
4166
  type: ['commandDataResponse', 'commandDataReport'],
4147
4167
  convert: (model, msg, publish, options, meta) => {
4148
- const dp = msg.data.dp;
4149
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4168
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_thermostat');
4169
+ const dp = dpValue.dp;
4170
+ const value = tuya.getDataValue(dpValue);
4150
4171
 
4151
4172
  switch (dp) {
4152
4173
  case tuya.dataPoints.windowDetection:
@@ -4243,7 +4264,7 @@ const converters = {
4243
4264
  return {week: tuya.thermostatWeekFormat[value]};
4244
4265
  default: // The purpose of the dps 17 & 19 is still unknown
4245
4266
  console.log(`zigbee-herdsman-converters:tuyaThermostat: Unrecognized DP #${
4246
- dp} with data ${JSON.stringify(msg.data)}`);
4267
+ dp} with data ${JSON.stringify(dpValue)}`);
4247
4268
  }
4248
4269
  },
4249
4270
  },
@@ -4251,12 +4272,13 @@ const converters = {
4251
4272
  cluster: 'manuSpecificTuya',
4252
4273
  type: ['commandDataResponse', 'commandDataReport'],
4253
4274
  convert: (model, msg, publish, options, meta) => {
4254
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4255
- if (msg.data.dp === tuya.dataPoints.state) {
4275
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_dimmer');
4276
+ const value = tuya.getDataValue(dpValue);
4277
+ if (dpValue.dp === tuya.dataPoints.state) {
4256
4278
  return {state: value ? 'ON': 'OFF'};
4257
4279
  } else if (meta.device.manufacturerName === '_TZE200_swaamsoy') {
4258
4280
  // https://github.com/Koenkk/zigbee-herdsman-converters/pull/3004
4259
- if (msg.data.dp === 2) {
4281
+ if (dpValue.dp === 2) {
4260
4282
  return {brightness: mapNumberRange(value, 10, 1000, 0, 254)};
4261
4283
  }
4262
4284
  } else { // TODO: Unknown dp, assumed value type
@@ -4277,18 +4299,22 @@ const converters = {
4277
4299
  }
4278
4300
  return hex;
4279
4301
  };
4280
- let dataStr =
4281
- Date.now().toString() + ' ' +
4282
- meta.device.ieeeAddr + ' ' +
4283
- getHex(msg.data.seq) + ' ' +
4284
- getHex(msg.data.dp) + ' ' +
4285
- getHex(msg.data.datatype) + ' ' +
4286
- getHex(msg.data.fn);
4287
-
4288
- msg.data.data.forEach((elem) => {
4289
- dataStr += ' ' + getHex(elem);
4290
- });
4291
- dataStr += '\n';
4302
+ const now = Date.now().toString();
4303
+ let dataStr = '';
4304
+ for (const [i, dpValue] of msg.data.dpValues.entries()) {
4305
+ dataStr +=
4306
+ now + ' ' +
4307
+ meta.device.ieeeAddr + ' ' +
4308
+ getHex(msg.data.seq) + ' ' +
4309
+ getHex(i) + ' ' +
4310
+ getHex(dpValue.dp) + ' ' +
4311
+ getHex(dpValue.datatype);
4312
+
4313
+ dpValue.data.forEach((elem) => {
4314
+ dataStr += ' ' + getHex(elem);
4315
+ });
4316
+ dataStr += '\n';
4317
+ }
4292
4318
  const fs = require('fs');
4293
4319
  fs.appendFile('data/tuya.dump.txt', dataStr, (err) => {
4294
4320
  if (err) throw err;
@@ -4333,7 +4359,8 @@ const converters = {
4333
4359
  cluster: 'manuSpecificTuya',
4334
4360
  type: 'commandDataResponse',
4335
4361
  convert: (model, msg, publish, options, meta) => {
4336
- msg.data.occupancy = msg.data.dp === tuya.dataPoints.occupancy ? 1 : 0;
4362
+ const dpValue = tuya.firstDpValue(msg, meta, 'blitzwolf_occupancy_with_timeout');
4363
+ msg.data.occupancy = dpValue.dp === tuya.dataPoints.occupancy ? 1 : 0;
4337
4364
  return converters.occupancy_with_timeout.convert(model, msg, publish, options, meta);
4338
4365
  },
4339
4366
  },
@@ -4630,8 +4657,9 @@ const converters = {
4630
4657
  cluster: 'manuSpecificTuya',
4631
4658
  type: ['commandDataResponse', 'commandDataReport', 'commandActiveStatusReport'],
4632
4659
  convert: (model, msg, publish, options, meta) => {
4633
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4634
- const dp = msg.data.dp;
4660
+ const dpValue = tuya.firstDpValue(msg, meta, 'frankever_valve');
4661
+ const value = tuya.getDataValue(dpValue);
4662
+ const dp = dpValue.dp;
4635
4663
  switch (dp) {
4636
4664
  case tuya.dataPoints.state: {
4637
4665
  return {state: value ? 'ON': 'OFF'};
@@ -4644,7 +4672,7 @@ const converters = {
4644
4672
  }
4645
4673
  default: {
4646
4674
  meta.logger.warn(`zigbee-herdsman-converters:FrankeverValve: NOT RECOGNIZED DP ` +
4647
- `#${dp} with data ${JSON.stringify(msg.data)}`);
4675
+ `#${dp} with data ${JSON.stringify(dpValue)}`);
4648
4676
  }
4649
4677
  }
4650
4678
  },
@@ -4653,13 +4681,14 @@ const converters = {
4653
4681
  cluster: 'manuSpecificTuya',
4654
4682
  type: ['commandDataResponse'],
4655
4683
  convert: (model, msg, publish, options, meta) => {
4656
- const dp = msg.data.dp;
4657
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4684
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_smoke');
4685
+ const dp = dpValue.dp;
4686
+ const value = tuya.getDataValue(dpValue);
4658
4687
  switch (dp) {
4659
4688
  case tuya.dataPoints.state:
4660
4689
  return {smoke: value === 0};
4661
4690
  default:
4662
- meta.logger.warn(`zigbee-herdsman-converters:tuya_smoke: Unrecognized DP #${ dp} with data ${JSON.stringify(msg.data)}`);
4691
+ meta.logger.warn(`zigbee-herdsman-converters:tuya_smoke: Unrecognized DP #${ dp} with data ${JSON.stringify(dpValue)}`);
4663
4692
  }
4664
4693
  },
4665
4694
  },
@@ -4667,8 +4696,9 @@ const converters = {
4667
4696
  cluster: 'manuSpecificTuya',
4668
4697
  type: ['commandDataResponse'],
4669
4698
  convert: (model, msg, publish, options, meta) => {
4670
- const dp = msg.data.dp;
4671
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4699
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_woox_smoke');
4700
+ const dp = dpValue.dp;
4701
+ const value = tuya.getDataValue(dpValue);
4672
4702
  switch (dp) {
4673
4703
  case tuya.dataPoints.wooxBattery:
4674
4704
  return {battery_low: value === 0};
@@ -4677,7 +4707,7 @@ const converters = {
4677
4707
  case tuya.dataPoints.wooxSmokeTest:
4678
4708
  return {smoke: value};
4679
4709
  default:
4680
- meta.logger.warn(`zigbee-herdsman-converters:tuya_smoke: Unrecognized DP #${ dp} with data ${JSON.stringify(msg.data)}`);
4710
+ meta.logger.warn(`zigbee-herdsman-converters:tuya_smoke: Unrecognized DP #${ dp} with data ${JSON.stringify(dpValue)}`);
4681
4711
  }
4682
4712
  },
4683
4713
  },
@@ -4686,8 +4716,9 @@ const converters = {
4686
4716
  type: ['commandDataReport', 'commandDataResponse', 'commandActiveStatusReport'],
4687
4717
  convert: (model, msg, publish, options, meta) => {
4688
4718
  const multiEndpoint = model.meta && model.meta.multiEndpoint;
4689
- const dp = msg.data.dp;
4690
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4719
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_switch');
4720
+ const dp = dpValue.dp;
4721
+ const value = tuya.getDataValue(dpValue);
4691
4722
  const state = value ? 'ON' : 'OFF';
4692
4723
  if (multiEndpoint) {
4693
4724
  const lookup = {1: 'l1', 2: 'l2', 3: 'l3', 4: 'l4'};
@@ -4705,8 +4736,9 @@ const converters = {
4705
4736
  cluster: 'manuSpecificTuya',
4706
4737
  type: ['commandDataReport', 'commandDataResponse', 'commandActiveStatusReport'],
4707
4738
  convert: (model, msg, publish, options, meta) => {
4708
- const dp = msg.data.dp;
4709
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4739
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_dinrail_switch');
4740
+ const dp = dpValue.dp;
4741
+ const value = tuya.getDataValue(dpValue);
4710
4742
  const state = value ? 'ON' : 'OFF';
4711
4743
 
4712
4744
  switch (dp) {
@@ -4722,7 +4754,7 @@ const converters = {
4722
4754
  return {voltage: value/10};
4723
4755
  default:
4724
4756
  meta.logger.warn(`zigbee-herdsman-converters:TuyaDinRailSwitch: NOT RECOGNIZED DP ` +
4725
- `#${dp} with data ${JSON.stringify(msg.data)}`);
4757
+ `#${dp} with data ${JSON.stringify(dpValue)}`);
4726
4758
  }
4727
4759
 
4728
4760
  return null;
@@ -4982,6 +5014,11 @@ const converters = {
4982
5014
  value = data.readUInt16LE(i+2);
4983
5015
  i += 3;
4984
5016
  break;
5017
+ case 34:
5018
+ // 0x22 Zcl24BitUint
5019
+ value = data.readUIntLE(i+2, 3);
5020
+ i += 4;
5021
+ break;
4985
5022
  case 35:
4986
5023
  // 0x23 Zcl32BitUint
4987
5024
  value = data.readUInt32LE(i+2);
@@ -4989,9 +5026,19 @@ const converters = {
4989
5026
  break;
4990
5027
  case 36:
4991
5028
  // 0x24 Zcl40BitUint
4992
- value = [data.readUInt32LE(i+2), data.readUInt8(i+6)];
5029
+ value = data.readUIntLE(i+2, 5);
4993
5030
  i += 6;
4994
5031
  break;
5032
+ case 37:
5033
+ // 0x25 Zcl48BitUint
5034
+ value = data.readUIntLE(i+2, 6);
5035
+ i += 7;
5036
+ break;
5037
+ case 38:
5038
+ // 0x26 Zcl56BitUint
5039
+ value = data.readUIntLE(i+2, 7);
5040
+ i += 8;
5041
+ break;
4995
5042
  case 39:
4996
5043
  // 0x27 Zcl64BitUint
4997
5044
  value = data.readBigUInt64BE(i+2);
@@ -5007,11 +5054,31 @@ const converters = {
5007
5054
  value = data.readInt16LE(i+2);
5008
5055
  i += 3;
5009
5056
  break;
5057
+ case 42:
5058
+ // 0x2A Zcl24BitInt
5059
+ value = data.readIntLE(i+2, 3);
5060
+ i += 4;
5061
+ break;
5010
5062
  case 43:
5011
5063
  // 0x2B Zcl32BitInt
5012
5064
  value = data.readInt32LE(i+2);
5013
5065
  i += 5;
5014
5066
  break;
5067
+ case 44:
5068
+ // 0x2C Zcl40BitInt
5069
+ value = data.readIntLE(i+2, 5);
5070
+ i += 6;
5071
+ break;
5072
+ case 45:
5073
+ // 0x2D Zcl48BitInt
5074
+ value = data.readIntLE(i+2, 6);
5075
+ i += 7;
5076
+ break;
5077
+ case 46:
5078
+ // 0x2E Zcl56BitInt
5079
+ value = data.readIntLE(i+2, 7);
5080
+ i += 8;
5081
+ break;
5015
5082
  case 47:
5016
5083
  // 0x2F Zcl64BitInt
5017
5084
  value = data.readBigInt64BE(i+2);
@@ -5061,6 +5128,7 @@ const converters = {
5061
5128
  if (msg.data.hasOwnProperty('0')) payload.detection_period = msg.data['0'];
5062
5129
  if (msg.data.hasOwnProperty('4')) payload.mode_switch = {4: 'anti_flicker_mode', 1: 'quick_mode'}[msg.data['4']];
5063
5130
  if (msg.data.hasOwnProperty('10')) payload.switch_type = {1: 'toggle', 2: 'momentary'}[msg.data['10']];
5131
+ if (msg.data.hasOwnProperty('258')) payload.detection_interval = msg.data['258'];
5064
5132
  if (msg.data.hasOwnProperty('268')) payload.motion_sensitivity = {1: 'low', 2: 'medium', 3: 'high'}[msg.data['268']];
5065
5133
  if (msg.data.hasOwnProperty('512')) {
5066
5134
  if (['ZNCZ15LM', 'QBCZ14LM', 'QBCZ15LM'].includes(model.model)) {
@@ -6069,8 +6137,9 @@ const converters = {
6069
6137
  cluster: 'manuSpecificTuya',
6070
6138
  type: ['commandDataReport', 'commandDataResponse'],
6071
6139
  convert: (model, msg, publish, options, meta) => {
6072
- const dp = msg.data.dp;
6073
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
6140
+ const dpValue = tuya.firstDpValue(msg, meta, 'javis_microwave_sensor');
6141
+ const dp = dpValue.dp;
6142
+ const value = tuya.getDataValue(dpValue);
6074
6143
  const lookup = {
6075
6144
  0: 'no_motion',
6076
6145
  1: 'big_motion',
@@ -6132,7 +6201,7 @@ const converters = {
6132
6201
  }
6133
6202
  default:
6134
6203
  meta.logger.warn(`zigbee-herdsman-converters:javis_microwave_sensor: NOT RECOGNIZED ` +
6135
- `DP #${dp} with data ${JSON.stringify(msg.data)}`);
6204
+ `DP #${dp} with data ${JSON.stringify(dpValue)}`);
6136
6205
  }
6137
6206
  },
6138
6207
  },
@@ -6276,8 +6345,9 @@ const converters = {
6276
6345
  cluster: 'manuSpecificTuya',
6277
6346
  type: 'commandDataResponse',
6278
6347
  convert: (model, msg, publish, options, meta) => {
6279
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
6280
- const dp = msg.data.dp;
6348
+ const dpValue = tuya.firstDpValue(msg, meta, 'ZVG1');
6349
+ const value = tuya.getDataValue(dpValue);
6350
+ const dp = dpValue.dp;
6281
6351
  switch (dp) {
6282
6352
  case tuya.dataPoints.state: {
6283
6353
  return {state: value ? 'ON': 'OFF'};
@@ -6304,7 +6374,7 @@ const converters = {
6304
6374
  }
6305
6375
  default: {
6306
6376
  meta.logger.warn(`zigbee-herdsman-converters:RTXZVG1Valve: NOT RECOGNIZED DP ` +
6307
- `#${dp} with data ${JSON.stringify(msg.data)}`);
6377
+ `#${dp} with data ${JSON.stringify(dpValue)}`);
6308
6378
  }
6309
6379
  }
6310
6380
  },
@@ -6840,8 +6910,9 @@ const converters = {
6840
6910
  cluster: 'manuSpecificTuya',
6841
6911
  type: ['commandDataResponse', 'commandDataReport'],
6842
6912
  convert: (model, msg, publish, options, meta) => {
6843
- const dp = msg.data.dp;
6844
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
6913
+ const dpValue = tuya.firstDpValue(msg, meta, 'SLUXZB');
6914
+ const dp = dpValue.dp;
6915
+ const value = tuya.getDataValue(dpValue);
6845
6916
  switch (dp) {
6846
6917
  case 2:
6847
6918
  return {illuminance_lux: value.toFixed(0)};
@@ -6850,7 +6921,7 @@ const converters = {
6850
6921
  case 1:
6851
6922
  return {battery_low: value.toFixed(1)};
6852
6923
  default:
6853
- meta.logger.warn(`s_lux_zb_illuminance: NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(msg.data)}`);
6924
+ meta.logger.warn(`s_lux_zb_illuminance: NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(dpValue)}`);
6854
6925
  }
6855
6926
  },
6856
6927
  },
@@ -6860,8 +6931,9 @@ const converters = {
6860
6931
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
6861
6932
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
6862
6933
  convert: (model, msg, publish, options, meta) => {
6863
- const dp = msg.data.dp;
6864
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
6934
+ const dpValue = tuya.firstDpValue(msg, meta, 'ZB003X');
6935
+ const dp = dpValue.dp;
6936
+ const value = tuya.getDataValue(dpValue);
6865
6937
 
6866
6938
  switch (dp) {
6867
6939
  case tuya.dataPoints.fantemTemp:
@@ -6890,7 +6962,7 @@ const converters = {
6890
6962
  return {reporting_enable: value};
6891
6963
  default:
6892
6964
  meta.logger.warn(`zigbee-herdsman-converters:FantemZB003X: Unrecognized DP #${
6893
- dp} with data ${JSON.stringify(msg.data)}`);
6965
+ dp} with data ${JSON.stringify(dpValue)}`);
6894
6966
  }
6895
6967
  },
6896
6968
  },
@@ -6923,15 +6995,16 @@ const converters = {
6923
6995
  cluster: 'manuSpecificTuya',
6924
6996
  type: ['commandDataResponse'],
6925
6997
  convert: (model, msg, publish, options, meta) => {
6926
- const dp = msg.data.dp;
6927
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
6998
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_gas');
6999
+ const dp = dpValue.dp;
7000
+ const value = tuya.getDataValue(dpValue);
6928
7001
 
6929
7002
  switch (dp) {
6930
7003
  case tuya.dataPoints.state:
6931
7004
  return {gas: value === 0 ? true : false};
6932
7005
  default:
6933
7006
  meta.logger.warn(`zigbee-herdsman-converters:tuya_gas: Unrecognized DP #${
6934
- dp} with data ${JSON.stringify(msg.data)}`);
7007
+ dp} with data ${JSON.stringify(dpValue)}`);
6935
7008
  }
6936
7009
  },
6937
7010
  },
@@ -6939,15 +7012,16 @@ const converters = {
6939
7012
  cluster: 'manuSpecificTuya',
6940
7013
  type: ['commandActiveStatusReport'],
6941
7014
  convert: (model, msg, publish, options, meta) => {
6942
- const dp = msg.data.dp;
6943
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7015
+ const dpValue = tuya.firstDpValue(msg, meta, 'woox_R7060');
7016
+ const dp = dpValue.dp;
7017
+ const value = tuya.getDataValue(dpValue);
6944
7018
 
6945
7019
  switch (dp) {
6946
7020
  case tuya.dataPoints.wooxSwitch:
6947
7021
  return {state: value === 2 ? 'OFF' : 'ON'};
6948
7022
  default:
6949
7023
  meta.logger.warn(`zigbee-herdsman-converters:WooxR7060: Unrecognized DP #${
6950
- dp} with data ${JSON.stringify(msg.data)}`);
7024
+ dp} with data ${JSON.stringify(dpValue)}`);
6951
7025
  }
6952
7026
  },
6953
7027
  },
@@ -7293,8 +7367,9 @@ const converters = {
7293
7367
  cluster: 'manuSpecificTuya',
7294
7368
  type: ['commandDataResponse'],
7295
7369
  convert: (model, msg, publish, options, meta) => {
7296
- const dp = msg.data.dp;
7297
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7370
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_motion_sensor');
7371
+ const dp = dpValue.dp;
7372
+ const value = tuya.getDataValue(dpValue);
7298
7373
  let result = null;
7299
7374
  switch (dp) {
7300
7375
  case tuya.dataPoints.state:
@@ -7331,7 +7406,7 @@ const converters = {
7331
7406
  result = {luminance_level: value};
7332
7407
  break;
7333
7408
  default:
7334
- meta.logger.warn(`fromZigbee.tuya_motion_sensor: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(msg.data)}`);
7409
+ meta.logger.warn(`fromZigbee.tuya_motion_sensor: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(dpValue)}`);
7335
7410
  }
7336
7411
 
7337
7412
  return result;
@@ -7341,8 +7416,9 @@ const converters = {
7341
7416
  cluster: 'manuSpecificTuya',
7342
7417
  type: ['commandDataResponse', 'commandDataReport'],
7343
7418
  convert: (model, msg, publish, options, meta) => {
7344
- const dp = msg.data.dp;
7345
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7419
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_radar_sensor');
7420
+ const dp = dpValue.dp;
7421
+ const value = tuya.getDataValue(dpValue);
7346
7422
  switch (dp) {
7347
7423
  case tuya.dataPoints.trsPresenceState:
7348
7424
  return {presence: {0: false, 1: true}[value]};
@@ -7365,8 +7441,9 @@ const converters = {
7365
7441
  cluster: 'manuSpecificTuya',
7366
7442
  type: ['commandDataResponse', 'commandDataReport', 'raw'],
7367
7443
  convert: (model, msg, publish, options, meta) => {
7368
- const dp = msg.data.dp;
7369
- let value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7444
+ const dpValue = tuya.firstDpValue(msg, meta, 'moes_thermostat_tv');
7445
+ const dp = dpValue.dp;
7446
+ let value = tuya.getDataValue(dpValue);
7370
7447
  let result = null;
7371
7448
  switch (dp) {
7372
7449
  case tuya.dataPoints.tvMode:
@@ -7440,7 +7517,7 @@ const converters = {
7440
7517
  }
7441
7518
  break;
7442
7519
  default:
7443
- meta.logger.warn(`fromZigbee.moes_thermostat_tv: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(msg.data)}`);
7520
+ meta.logger.warn(`fromZigbee.moes_thermostat_tv: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(dpValue)}`);
7444
7521
  }
7445
7522
 
7446
7523
  return result;
@@ -7474,10 +7551,11 @@ const converters = {
7474
7551
  cluster: 'manuSpecificTuya',
7475
7552
  type: ['commandDataResponse', 'commandDataReport'],
7476
7553
  convert: (model, msg, publish, options, meta) => {
7477
- const dp = msg.data.dp;
7478
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7554
+ const dpValue = tuya.firstDpValue(msg, meta, 'hoch_din');
7555
+ const dp = dpValue.dp;
7556
+ const value = tuya.getDataValue(dpValue);
7479
7557
  const result = {};
7480
- meta.logger.debug(`from hoch_din, msg.data.dp=[${dp}], msg.data.datatype=[${msg.data.datatype}], value=[${value}]`);
7558
+ meta.logger.debug(`from hoch_din, dp=[${dp}], datatype=[${dpValue.datatype}], value=[${value}]`);
7481
7559
 
7482
7560
  if (dp === tuya.dataPoints.state) {
7483
7561
  result.state = value ? 'ON' : 'OFF';