zigbee-herdsman-converters 14.0.366 → 14.0.370

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;
@@ -1165,7 +1164,8 @@ const converters = {
1165
1164
 
1166
1165
  if (options.simulated_brightness) {
1167
1166
  globalStore.putValue(msg.endpoint, 'simulated_brightness_brightness', msg.data.level);
1168
- payload.brightness = msg.data.level;
1167
+ const property = postfixWithEndpointName('brightness', msg, model);
1168
+ payload[property] = msg.data.level;
1169
1169
  }
1170
1170
 
1171
1171
  return payload;
@@ -1196,7 +1196,8 @@ const converters = {
1196
1196
  brightness += delta;
1197
1197
  brightness = numberWithinRange(brightness, 0, 255);
1198
1198
  globalStore.putValue(msg.endpoint, 'simulated_brightness_brightness', brightness);
1199
- publish({brightness});
1199
+ const property = postfixWithEndpointName('brightness', msg, model);
1200
+ publish({[property]: brightness});
1200
1201
  }, intervalOpts);
1201
1202
 
1202
1203
  globalStore.putValue(msg.endpoint, 'simulated_brightness_timer', timer);
@@ -1226,7 +1227,8 @@ const converters = {
1226
1227
  brightness += delta;
1227
1228
  brightness = numberWithinRange(brightness, 0, 255);
1228
1229
  globalStore.putValue(msg.endpoint, 'simulated_brightness_brightness', brightness);
1229
- payload.brightness = brightness;
1230
+ const property = postfixWithEndpointName('brightness', msg, model);
1231
+ payload[property] = brightness;
1230
1232
  }
1231
1233
 
1232
1234
  return payload;
@@ -1690,10 +1692,11 @@ const converters = {
1690
1692
  type: ['commandDataResponse', 'commandDataReport'],
1691
1693
  convert: (model, msg, publish, options, meta) => {
1692
1694
  const multiEndpoint = model.meta && model.meta.multiEndpoint;
1693
- const dp = msg.data.dp;
1694
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1695
+ const dpValue = tuya.firstDpValue(msg, meta, 'moes_105_dimmer');
1696
+ const dp = dpValue.dp;
1697
+ const value = tuya.getDataValue(dpValue);
1695
1698
 
1696
- meta.logger.debug(`from moes_105_dimmer, msg.data.dp=[${dp}], msg.data.datatype=[${msg.data.datatype}], value=[${value}]`);
1699
+ meta.logger.debug(`from moes_105_dimmer, dp=[${dp}], datatype=[${dpValue.datatype}], value=[${value}]`);
1697
1700
 
1698
1701
  const state = value ? 'ON': 'OFF';
1699
1702
  const brightness = mapNumberRange(value, 0, 1000, 0, 254);
@@ -1709,7 +1712,7 @@ const converters = {
1709
1712
  return {brightness_l2: brightness};
1710
1713
  default:
1711
1714
  meta.logger.debug(`zigbee-herdsman-converters:moes_105_dimmer:` +
1712
- `NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(msg.data)}`);
1715
+ `NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(dpValue)}`);
1713
1716
  }
1714
1717
  },
1715
1718
  },
@@ -1785,8 +1788,9 @@ const converters = {
1785
1788
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
1786
1789
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
1787
1790
  convert: (model, msg, publish, options, meta) => {
1788
- const dp = msg.data.dp;
1789
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1791
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_temperature_humidity_sensor');
1792
+ const dp = dpValue.dp;
1793
+ const value = tuya.getDataValue(dpValue);
1790
1794
  switch (dp) {
1791
1795
  case 1:
1792
1796
  return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
@@ -1796,7 +1800,7 @@ const converters = {
1796
1800
  return {battery: value};
1797
1801
  default:
1798
1802
  meta.logger.warn(`zigbee-herdsman-converters:maa_tuya_temp_sensor: NOT RECOGNIZED ` +
1799
- `DP #${dp} with data ${JSON.stringify(msg.data)}`);
1803
+ `DP #${dp} with data ${JSON.stringify(dpValue)}`);
1800
1804
  }
1801
1805
  },
1802
1806
  },
@@ -1806,8 +1810,9 @@ const converters = {
1806
1810
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
1807
1811
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
1808
1812
  convert: (model, msg, publish, options, meta) => {
1809
- const dp = msg.data.dp;
1810
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1813
+ const dpValue = tuya.firstDpValue(msg, meta, 'nous_lcd_temperature_humidity_sensor');
1814
+ const dp = dpValue.dp;
1815
+ const value = tuya.getDataValue(dpValue);
1811
1816
  switch (dp) {
1812
1817
  case tuya.dataPoints.nousTemperature:
1813
1818
  return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
@@ -1827,7 +1832,7 @@ const converters = {
1827
1832
  return {temperature_sensitivity: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
1828
1833
  default:
1829
1834
  meta.logger.warn(`zigbee-herdsman-converters:nous_lcd_temperature_humidity_sensor: NOT RECOGNIZED ` +
1830
- `DP #${dp} with data ${JSON.stringify(msg.data)}`);
1835
+ `DP #${dp} with data ${JSON.stringify(dpValue)}`);
1831
1836
  }
1832
1837
  },
1833
1838
  },
@@ -1837,8 +1842,9 @@ const converters = {
1837
1842
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
1838
1843
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
1839
1844
  convert: (model, msg, publish, options, meta) => {
1840
- const dp = msg.data.dp;
1841
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1845
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_illuminance_temperature_humidity_sensor');
1846
+ const dp = dpValue.dp;
1847
+ const value = tuya.getDataValue(dpValue);
1842
1848
  switch (dp) {
1843
1849
  case tuya.dataPoints.thitTemperature:
1844
1850
  return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
@@ -1850,7 +1856,7 @@ const converters = {
1850
1856
  return {illuminance_lux: value};
1851
1857
  default:
1852
1858
  meta.logger.warn(`zigbee-herdsman-converters:tuya_illuminance_temperature_humidity_sensor: NOT RECOGNIZED ` +
1853
- `DP #${dp} with data ${JSON.stringify(msg.data)}`);
1859
+ `DP #${dp} with data ${JSON.stringify(dpValue)}`);
1854
1860
  }
1855
1861
  },
1856
1862
  },
@@ -1887,8 +1893,9 @@ const converters = {
1887
1893
  cluster: 'manuSpecificTuya',
1888
1894
  type: ['commandDataResponse', 'commandDataReport'],
1889
1895
  convert: (model, msg, publish, options, meta) => {
1890
- const dp = msg.data.dp;
1891
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1896
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_thermostat_weekly_schedule');
1897
+ const dp = dpValue.dp;
1898
+ const value = tuya.getDataValue(dpValue);
1892
1899
 
1893
1900
  const thermostatMeta = getMetaValue(msg.endpoint, model, 'thermostat');
1894
1901
  const firstDayDpId = thermostatMeta.weeklyScheduleFirstDayDpId;
@@ -1936,8 +1943,9 @@ const converters = {
1936
1943
  cluster: 'manuSpecificTuya',
1937
1944
  type: ['commandDataReport', 'commandDataResponse'],
1938
1945
  convert: (model, msg, publish, options, meta) => {
1939
- const dp = msg.data.dp;
1940
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
1946
+ const dpValue = tuya.firstDpValue(msg, meta, 'hy_thermostat');
1947
+ const dp = dpValue.dp;
1948
+ const value = tuya.getDataValue(dpValue);
1941
1949
 
1942
1950
  switch (dp) {
1943
1951
  case tuya.dataPoints.hyWorkdaySchedule1: // schedule for workdays [5,9,12,8,0,15,10,0,15]
@@ -2010,7 +2018,7 @@ const converters = {
2010
2018
  return {alarm: (value > 0) ? true : false};
2011
2019
  default: // The purpose of the codes 17 & 19 are still unknown
2012
2020
  meta.logger.warn(`zigbee-herdsman-converters:hy_thermostat: Unrecognized DP #${
2013
- dp} with data ${JSON.stringify(msg.data)}`);
2021
+ dp} with data ${JSON.stringify(dpValue)}`);
2014
2022
  }
2015
2023
  },
2016
2024
  },
@@ -2070,8 +2078,9 @@ const converters = {
2070
2078
  // Protocol description
2071
2079
  // https://github.com/Koenkk/zigbee-herdsman-converters/issues/1159#issuecomment-614659802
2072
2080
 
2073
- const dp = msg.data.dp;
2074
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
2081
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_cover');
2082
+ const dp = dpValue.dp;
2083
+ const value = tuya.getDataValue(dpValue);
2075
2084
 
2076
2085
  switch (dp) {
2077
2086
  case tuya.dataPoints.coverPosition: // Started moving to position (triggered from Zigbee)
@@ -2097,7 +2106,7 @@ const converters = {
2097
2106
  break;
2098
2107
  default: // Unknown code
2099
2108
  meta.logger.warn(`TuYa_cover_control: Unhandled DP #${dp} for ${meta.device.manufacturerName}:
2100
- ${JSON.stringify(msg.data)}`);
2109
+ ${JSON.stringify(dpValue)}`);
2101
2110
  }
2102
2111
  },
2103
2112
  },
@@ -2391,8 +2400,9 @@ const converters = {
2391
2400
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
2392
2401
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
2393
2402
  convert: (model, msg, publish, options, meta) => {
2394
- const dp = msg.data.dp;
2395
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
2403
+ const dpValue = tuya.firstDpValue(msg, meta, 'neo_nas_pd07');
2404
+ const dp = dpValue.dp;
2405
+ const value = tuya.getDataValue(dpValue);
2396
2406
 
2397
2407
  if (dp === 101) return {occupancy: value > 0 ? true : false};
2398
2408
  else if (dp === 102) {
@@ -2407,7 +2417,7 @@ const converters = {
2407
2417
  } else if (dp === 105) {
2408
2418
  return {humidity: calibrateAndPrecisionRoundOptions(value, options, 'humidity')};
2409
2419
  } else {
2410
- meta.logger.warn(`zigbee-herdsman-converters:NEO-PD07: NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(msg.data)}`);
2420
+ meta.logger.warn(`zigbee-herdsman-converters:NEO-PD07: NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(dpValue)}`);
2411
2421
  }
2412
2422
  },
2413
2423
  },
@@ -2415,8 +2425,9 @@ const converters = {
2415
2425
  cluster: 'manuSpecificTuya',
2416
2426
  type: ['commandDataReport', 'commandDataResponse'],
2417
2427
  convert: (model, msg, publish, options, meta) => {
2418
- const dp = msg.data.dp;
2419
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
2428
+ const dpValue = tuya.firstDpValue(msg, meta, 'neo_t_h_alarm');
2429
+ const dp = dpValue.dp;
2430
+ const value = tuya.getDataValue(dpValue);
2420
2431
 
2421
2432
  switch (dp) {
2422
2433
  case tuya.dataPoints.neoAlarm:
@@ -2453,7 +2464,7 @@ const converters = {
2453
2464
  case tuya.dataPoints.neoVolume: // 0x0474 [0]/[1]/[2] Volume 0-max, 2-low
2454
2465
  return {volume: {2: 'low', 1: 'medium', 0: 'high'}[value]};
2455
2466
  default: // Unknown code
2456
- meta.logger.warn(`Unhandled DP #${dp}: ${JSON.stringify(msg.data)}`);
2467
+ meta.logger.warn(`Unhandled DP #${dp}: ${JSON.stringify(dpValue)}`);
2457
2468
  }
2458
2469
  },
2459
2470
  },
@@ -2560,8 +2571,9 @@ const converters = {
2560
2571
  cluster: 'manuSpecificTuya',
2561
2572
  type: 'commandDataReport',
2562
2573
  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)};
2574
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_water_leak');
2575
+ if (dpValue.dp === tuya.dataPoints.waterLeak) {
2576
+ return {water_leak: tuya.getDataValue(dpValue)};
2565
2577
  }
2566
2578
  },
2567
2579
  },
@@ -2924,8 +2936,9 @@ const converters = {
2924
2936
  cluster: 'manuSpecificTuya',
2925
2937
  type: ['commandDataResponse', 'commandDataReport'],
2926
2938
  convert: (model, msg, publish, options, meta) => {
2927
- const dp = msg.data.dp;
2928
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
2939
+ const dpValue = tuya.firstDpValue(msg, meta, 'silvercrest_smart_led_string');
2940
+ const dp = dpValue.dp;
2941
+ const value = tuya.getDataValue(dpValue);
2929
2942
  const result = {};
2930
2943
 
2931
2944
  if (dp === tuya.dataPoints.silvercrestChangeMode) {
@@ -3547,8 +3560,9 @@ const converters = {
3547
3560
  cluster: 'manuSpecificTuya',
3548
3561
  type: ['commandDataResponse', 'commandDataReport'],
3549
3562
  convert: (model, msg, publish, options, meta) => {
3550
- const dp = msg.data.dp;
3551
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3563
+ const dpValue = tuya.firstDpValue(msg, meta, 'moes_thermostat');
3564
+ const dp = dpValue.dp;
3565
+ const value = tuya.getDataValue(dpValue);
3552
3566
  let temperature;
3553
3567
  /* See tuyaThermostat above for message structure comment */
3554
3568
  switch (dp) {
@@ -3612,7 +3626,7 @@ const converters = {
3612
3626
  }
3613
3627
  default: // DataPoint 17 is unknown
3614
3628
  meta.logger.warn(`zigbee-herdsman-converters:Moes BHT-002: Unrecognized DP #${
3615
- dp} with data ${JSON.stringify(msg.data)}`);
3629
+ dp} with data ${JSON.stringify(dpValue)}`);
3616
3630
  }
3617
3631
  },
3618
3632
  },
@@ -3620,8 +3634,9 @@ const converters = {
3620
3634
  cluster: 'manuSpecificTuya',
3621
3635
  type: ['commandDataResponse', 'commandDataReport'],
3622
3636
  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);
3637
+ const dpValue = tuya.firstDpValue(msg, meta, 'moesS_thermostat');
3638
+ const dp = dpValue.dp; // First we get the data point ID
3639
+ const value = tuya.getDataValue(dpValue);
3625
3640
  const presetLookup = {0: 'programming', 1: 'manual', 2: 'temporary_manual', 3: 'holiday'};
3626
3641
  switch (dp) {
3627
3642
  case tuya.dataPoints.moesSsystemMode:
@@ -3672,7 +3687,7 @@ const converters = {
3672
3687
  }
3673
3688
  default:
3674
3689
  meta.logger.warn(`zigbee-herdsman-converters:moesS_thermostat: NOT RECOGNIZED DP #${
3675
- dp} with data ${JSON.stringify(msg.data)}`);
3690
+ dp} with data ${JSON.stringify(dpValue)}`);
3676
3691
  }
3677
3692
  },
3678
3693
  },
@@ -3680,8 +3695,9 @@ const converters = {
3680
3695
  cluster: 'manuSpecificTuya',
3681
3696
  type: ['commandDataResponse', 'commandDataReport'],
3682
3697
  convert: (model, msg, publish, options, meta) => {
3683
- const dp = msg.data.dp;
3684
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3698
+ const dpValue = tuya.firstDpValue(msg, meta, 'tvtwo_thermostat');
3699
+ const dp = dpValue.dp;
3700
+ const value = tuya.getDataValue(dpValue);
3685
3701
  const presetLookup = {0: 'auto', 1: 'manual', 2: 'holiday'};
3686
3702
  switch (dp) {
3687
3703
  case tuya.dataPoints.tvMode:
@@ -3823,7 +3839,7 @@ const converters = {
3823
3839
 
3824
3840
  default:
3825
3841
  meta.logger.warn(`zigbee-herdsman-converters:tvtwo_thermostat: NOT RECOGNIZED DP #${
3826
- dp} with data ${JSON.stringify(msg.data)}`);
3842
+ dp} with data ${JSON.stringify(dpValue)}`);
3827
3843
  }
3828
3844
  },
3829
3845
  },
@@ -3831,8 +3847,9 @@ const converters = {
3831
3847
  cluster: 'manuSpecificTuya',
3832
3848
  type: ['commandDataResponse', 'commandDataReport'],
3833
3849
  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);
3850
+ const dpValue = tuya.firstDpValue(msg, meta, 'haozee_thermostat');
3851
+ const dp = dpValue.dp; // First we get the data point ID
3852
+ const value = tuya.getDataValue(dpValue);
3836
3853
  const presetLookup = {0: 'auto', 1: 'manual', 2: 'off', 3: 'on'};
3837
3854
  switch (dp) {
3838
3855
  case tuya.dataPoints.haozeeSystemMode:
@@ -3938,7 +3955,7 @@ const converters = {
3938
3955
  break;
3939
3956
  default:
3940
3957
  meta.logger.warn(`zigbee-herdsman-converters:haozee: NOT RECOGNIZED DP #${
3941
- dp} with data ${JSON.stringify(msg.data)}`);
3958
+ dp} with data ${JSON.stringify(dpValue)}`);
3942
3959
  }
3943
3960
  },
3944
3961
  },
@@ -3951,8 +3968,9 @@ const converters = {
3951
3968
  exposes.options.precision('voc'), exposes.options.calibration('voc'),
3952
3969
  exposes.options.precision('formaldehyd'), exposes.options.calibration('formaldehyd')],
3953
3970
  convert: (model, msg, publish, options, meta) => {
3954
- const dp = msg.data.dp;
3955
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3971
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_air_quality');
3972
+ const dp = dpValue.dp;
3973
+ const value = tuya.getDataValue(dpValue);
3956
3974
  switch (dp) {
3957
3975
  case tuya.dataPoints.tuyaSabTemp:
3958
3976
  return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
@@ -3967,7 +3985,7 @@ const converters = {
3967
3985
  return {formaldehyd: calibrateAndPrecisionRoundOptions(value, options, 'formaldehyd')};
3968
3986
  default:
3969
3987
  meta.logger.warn(`zigbee-herdsman-converters:TuyaSmartAirBox: Unrecognized DP #${
3970
- dp} with data ${JSON.stringify(msg.data)}`);
3988
+ dp} with data ${JSON.stringify(dpValue)}`);
3971
3989
  }
3972
3990
  },
3973
3991
  },
@@ -3975,8 +3993,9 @@ const converters = {
3975
3993
  cluster: 'manuSpecificTuya',
3976
3994
  type: ['commandDataResponse', 'commandDataReport'],
3977
3995
  convert: (model, msg, publish, options, meta) => {
3978
- const dp = msg.data.dp;
3979
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
3996
+ const dpValue = tuya.firstDpValue(msg, meta, 'saswell_thermostat');
3997
+ const dp = dpValue.dp;
3998
+ const value = tuya.getDataValue(dpValue);
3980
3999
 
3981
4000
  switch (dp) {
3982
4001
  case tuya.dataPoints.saswellHeating:
@@ -4091,7 +4110,7 @@ const converters = {
4091
4110
  return {anti_scaling: value ? 'ON' : 'OFF'};
4092
4111
  default:
4093
4112
  meta.logger.warn(`zigbee-herdsman-converters:SaswellThermostat: Unrecognized DP #${
4094
- dp} with data ${JSON.stringify(msg.data)}`);
4113
+ dp} with data ${JSON.stringify(dpValue)}`);
4095
4114
  }
4096
4115
  },
4097
4116
  },
@@ -4099,8 +4118,9 @@ const converters = {
4099
4118
  cluster: 'manuSpecificTuya',
4100
4119
  type: ['commandDataResponse', 'commandDataReport'],
4101
4120
  convert: (model, msg, publish, options, meta) => {
4102
- const dp = msg.data.dp;
4103
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4121
+ const dpValue = tuya.firstDpValue(msg, meta, 'etop_thermostat');
4122
+ const dp = dpValue.dp;
4123
+ const value = tuya.getDataValue(dpValue);
4104
4124
 
4105
4125
  if (dp >= 101 && dp <=107) return; // handled by tuya_thermostat_weekly_schedule
4106
4126
 
@@ -4140,7 +4160,7 @@ const converters = {
4140
4160
  return {running_state: value ? 'heat' : 'idle'};
4141
4161
  default:
4142
4162
  meta.logger.warn(`zigbee-herdsman-converters:eTopThermostat: Unrecognized DP #${
4143
- dp} with data ${JSON.stringify(msg.data)}`);
4163
+ dp} with data ${JSON.stringify(dpValue)}`);
4144
4164
  }
4145
4165
  },
4146
4166
  },
@@ -4148,8 +4168,9 @@ const converters = {
4148
4168
  cluster: 'manuSpecificTuya',
4149
4169
  type: ['commandDataResponse', 'commandDataReport'],
4150
4170
  convert: (model, msg, publish, options, meta) => {
4151
- const dp = msg.data.dp;
4152
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4171
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_thermostat');
4172
+ const dp = dpValue.dp;
4173
+ const value = tuya.getDataValue(dpValue);
4153
4174
 
4154
4175
  switch (dp) {
4155
4176
  case tuya.dataPoints.windowDetection:
@@ -4246,7 +4267,7 @@ const converters = {
4246
4267
  return {week: tuya.thermostatWeekFormat[value]};
4247
4268
  default: // The purpose of the dps 17 & 19 is still unknown
4248
4269
  console.log(`zigbee-herdsman-converters:tuyaThermostat: Unrecognized DP #${
4249
- dp} with data ${JSON.stringify(msg.data)}`);
4270
+ dp} with data ${JSON.stringify(dpValue)}`);
4250
4271
  }
4251
4272
  },
4252
4273
  },
@@ -4254,12 +4275,13 @@ const converters = {
4254
4275
  cluster: 'manuSpecificTuya',
4255
4276
  type: ['commandDataResponse', 'commandDataReport'],
4256
4277
  convert: (model, msg, publish, options, meta) => {
4257
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4258
- if (msg.data.dp === tuya.dataPoints.state) {
4278
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_dimmer');
4279
+ const value = tuya.getDataValue(dpValue);
4280
+ if (dpValue.dp === tuya.dataPoints.state) {
4259
4281
  return {state: value ? 'ON': 'OFF'};
4260
4282
  } else if (meta.device.manufacturerName === '_TZE200_swaamsoy') {
4261
4283
  // https://github.com/Koenkk/zigbee-herdsman-converters/pull/3004
4262
- if (msg.data.dp === 2) {
4284
+ if (dpValue.dp === 2) {
4263
4285
  return {brightness: mapNumberRange(value, 10, 1000, 0, 254)};
4264
4286
  }
4265
4287
  } else { // TODO: Unknown dp, assumed value type
@@ -4280,18 +4302,22 @@ const converters = {
4280
4302
  }
4281
4303
  return hex;
4282
4304
  };
4283
- let dataStr =
4284
- Date.now().toString() + ' ' +
4285
- meta.device.ieeeAddr + ' ' +
4286
- getHex(msg.data.seq) + ' ' +
4287
- getHex(msg.data.dp) + ' ' +
4288
- getHex(msg.data.datatype) + ' ' +
4289
- getHex(msg.data.fn);
4290
-
4291
- msg.data.data.forEach((elem) => {
4292
- dataStr += ' ' + getHex(elem);
4293
- });
4294
- dataStr += '\n';
4305
+ const now = Date.now().toString();
4306
+ let dataStr = '';
4307
+ for (const [i, dpValue] of msg.data.dpValues.entries()) {
4308
+ dataStr +=
4309
+ now + ' ' +
4310
+ meta.device.ieeeAddr + ' ' +
4311
+ getHex(msg.data.seq) + ' ' +
4312
+ getHex(i) + ' ' +
4313
+ getHex(dpValue.dp) + ' ' +
4314
+ getHex(dpValue.datatype);
4315
+
4316
+ dpValue.data.forEach((elem) => {
4317
+ dataStr += ' ' + getHex(elem);
4318
+ });
4319
+ dataStr += '\n';
4320
+ }
4295
4321
  const fs = require('fs');
4296
4322
  fs.appendFile('data/tuya.dump.txt', dataStr, (err) => {
4297
4323
  if (err) throw err;
@@ -4336,7 +4362,8 @@ const converters = {
4336
4362
  cluster: 'manuSpecificTuya',
4337
4363
  type: 'commandDataResponse',
4338
4364
  convert: (model, msg, publish, options, meta) => {
4339
- msg.data.occupancy = msg.data.dp === tuya.dataPoints.occupancy ? 1 : 0;
4365
+ const dpValue = tuya.firstDpValue(msg, meta, 'blitzwolf_occupancy_with_timeout');
4366
+ msg.data.occupancy = dpValue.dp === tuya.dataPoints.occupancy ? 1 : 0;
4340
4367
  return converters.occupancy_with_timeout.convert(model, msg, publish, options, meta);
4341
4368
  },
4342
4369
  },
@@ -4633,8 +4660,9 @@ const converters = {
4633
4660
  cluster: 'manuSpecificTuya',
4634
4661
  type: ['commandDataResponse', 'commandDataReport', 'commandActiveStatusReport'],
4635
4662
  convert: (model, msg, publish, options, meta) => {
4636
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4637
- const dp = msg.data.dp;
4663
+ const dpValue = tuya.firstDpValue(msg, meta, 'frankever_valve');
4664
+ const value = tuya.getDataValue(dpValue);
4665
+ const dp = dpValue.dp;
4638
4666
  switch (dp) {
4639
4667
  case tuya.dataPoints.state: {
4640
4668
  return {state: value ? 'ON': 'OFF'};
@@ -4647,31 +4675,37 @@ const converters = {
4647
4675
  }
4648
4676
  default: {
4649
4677
  meta.logger.warn(`zigbee-herdsman-converters:FrankeverValve: NOT RECOGNIZED DP ` +
4650
- `#${dp} with data ${JSON.stringify(msg.data)}`);
4678
+ `#${dp} with data ${JSON.stringify(dpValue)}`);
4651
4679
  }
4652
4680
  }
4653
4681
  },
4654
4682
  },
4655
4683
  tuya_smoke: {
4656
4684
  cluster: 'manuSpecificTuya',
4657
- type: ['commandDataResponse'],
4685
+ type: ['commandDataResponse', 'commandDataReport'],
4658
4686
  convert: (model, msg, publish, options, meta) => {
4659
- const dp = msg.data.dp;
4660
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4661
- switch (dp) {
4662
- case tuya.dataPoints.state:
4663
- return {smoke: value === 0};
4664
- default:
4665
- meta.logger.warn(`zigbee-herdsman-converters:tuya_smoke: Unrecognized DP #${ dp} with data ${JSON.stringify(msg.data)}`);
4687
+ const result = {};
4688
+ for (const dpValue of msg.data.dpValues) {
4689
+ const dp = dpValue.dp;
4690
+ const value = tuya.getDataValue(dpValue);
4691
+ switch (dp) {
4692
+ case tuya.dataPoints.state:
4693
+ result.smoke = value === 0;
4694
+ break;
4695
+ default:
4696
+ meta.logger.warn(`zigbee-herdsman-converters:tuya_smoke: Unrecognized DP #${ dp} with data ${JSON.stringify(dpValue)}`);
4697
+ }
4666
4698
  }
4699
+ return result;
4667
4700
  },
4668
4701
  },
4669
4702
  tuya_woox_smoke: {
4670
4703
  cluster: 'manuSpecificTuya',
4671
4704
  type: ['commandDataResponse'],
4672
4705
  convert: (model, msg, publish, options, meta) => {
4673
- const dp = msg.data.dp;
4674
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4706
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_woox_smoke');
4707
+ const dp = dpValue.dp;
4708
+ const value = tuya.getDataValue(dpValue);
4675
4709
  switch (dp) {
4676
4710
  case tuya.dataPoints.wooxBattery:
4677
4711
  return {battery_low: value === 0};
@@ -4680,7 +4714,7 @@ const converters = {
4680
4714
  case tuya.dataPoints.wooxSmokeTest:
4681
4715
  return {smoke: value};
4682
4716
  default:
4683
- meta.logger.warn(`zigbee-herdsman-converters:tuya_smoke: Unrecognized DP #${ dp} with data ${JSON.stringify(msg.data)}`);
4717
+ meta.logger.warn(`zigbee-herdsman-converters:tuya_smoke: Unrecognized DP #${ dp} with data ${JSON.stringify(dpValue)}`);
4684
4718
  }
4685
4719
  },
4686
4720
  },
@@ -4689,8 +4723,9 @@ const converters = {
4689
4723
  type: ['commandDataReport', 'commandDataResponse', 'commandActiveStatusReport'],
4690
4724
  convert: (model, msg, publish, options, meta) => {
4691
4725
  const multiEndpoint = model.meta && model.meta.multiEndpoint;
4692
- const dp = msg.data.dp;
4693
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4726
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_switch');
4727
+ const dp = dpValue.dp;
4728
+ const value = tuya.getDataValue(dpValue);
4694
4729
  const state = value ? 'ON' : 'OFF';
4695
4730
  if (multiEndpoint) {
4696
4731
  const lookup = {1: 'l1', 2: 'l2', 3: 'l3', 4: 'l4'};
@@ -4708,8 +4743,9 @@ const converters = {
4708
4743
  cluster: 'manuSpecificTuya',
4709
4744
  type: ['commandDataReport', 'commandDataResponse', 'commandActiveStatusReport'],
4710
4745
  convert: (model, msg, publish, options, meta) => {
4711
- const dp = msg.data.dp;
4712
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
4746
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_dinrail_switch');
4747
+ const dp = dpValue.dp;
4748
+ const value = tuya.getDataValue(dpValue);
4713
4749
  const state = value ? 'ON' : 'OFF';
4714
4750
 
4715
4751
  switch (dp) {
@@ -4725,7 +4761,7 @@ const converters = {
4725
4761
  return {voltage: value/10};
4726
4762
  default:
4727
4763
  meta.logger.warn(`zigbee-herdsman-converters:TuyaDinRailSwitch: NOT RECOGNIZED DP ` +
4728
- `#${dp} with data ${JSON.stringify(msg.data)}`);
4764
+ `#${dp} with data ${JSON.stringify(dpValue)}`);
4729
4765
  }
4730
4766
 
4731
4767
  return null;
@@ -4985,6 +5021,11 @@ const converters = {
4985
5021
  value = data.readUInt16LE(i+2);
4986
5022
  i += 3;
4987
5023
  break;
5024
+ case 34:
5025
+ // 0x22 Zcl24BitUint
5026
+ value = data.readUIntLE(i+2, 3);
5027
+ i += 4;
5028
+ break;
4988
5029
  case 35:
4989
5030
  // 0x23 Zcl32BitUint
4990
5031
  value = data.readUInt32LE(i+2);
@@ -4992,9 +5033,19 @@ const converters = {
4992
5033
  break;
4993
5034
  case 36:
4994
5035
  // 0x24 Zcl40BitUint
4995
- value = [data.readUInt32LE(i+2), data.readUInt8(i+6)];
5036
+ value = data.readUIntLE(i+2, 5);
4996
5037
  i += 6;
4997
5038
  break;
5039
+ case 37:
5040
+ // 0x25 Zcl48BitUint
5041
+ value = data.readUIntLE(i+2, 6);
5042
+ i += 7;
5043
+ break;
5044
+ case 38:
5045
+ // 0x26 Zcl56BitUint
5046
+ value = data.readUIntLE(i+2, 7);
5047
+ i += 8;
5048
+ break;
4998
5049
  case 39:
4999
5050
  // 0x27 Zcl64BitUint
5000
5051
  value = data.readBigUInt64BE(i+2);
@@ -5010,11 +5061,31 @@ const converters = {
5010
5061
  value = data.readInt16LE(i+2);
5011
5062
  i += 3;
5012
5063
  break;
5064
+ case 42:
5065
+ // 0x2A Zcl24BitInt
5066
+ value = data.readIntLE(i+2, 3);
5067
+ i += 4;
5068
+ break;
5013
5069
  case 43:
5014
5070
  // 0x2B Zcl32BitInt
5015
5071
  value = data.readInt32LE(i+2);
5016
5072
  i += 5;
5017
5073
  break;
5074
+ case 44:
5075
+ // 0x2C Zcl40BitInt
5076
+ value = data.readIntLE(i+2, 5);
5077
+ i += 6;
5078
+ break;
5079
+ case 45:
5080
+ // 0x2D Zcl48BitInt
5081
+ value = data.readIntLE(i+2, 6);
5082
+ i += 7;
5083
+ break;
5084
+ case 46:
5085
+ // 0x2E Zcl56BitInt
5086
+ value = data.readIntLE(i+2, 7);
5087
+ i += 8;
5088
+ break;
5018
5089
  case 47:
5019
5090
  // 0x2F Zcl64BitInt
5020
5091
  value = data.readBigInt64BE(i+2);
@@ -5064,6 +5135,7 @@ const converters = {
5064
5135
  if (msg.data.hasOwnProperty('0')) payload.detection_period = msg.data['0'];
5065
5136
  if (msg.data.hasOwnProperty('4')) payload.mode_switch = {4: 'anti_flicker_mode', 1: 'quick_mode'}[msg.data['4']];
5066
5137
  if (msg.data.hasOwnProperty('10')) payload.switch_type = {1: 'toggle', 2: 'momentary'}[msg.data['10']];
5138
+ if (msg.data.hasOwnProperty('258')) payload.detection_interval = msg.data['258'];
5067
5139
  if (msg.data.hasOwnProperty('268')) payload.motion_sensitivity = {1: 'low', 2: 'medium', 3: 'high'}[msg.data['268']];
5068
5140
  if (msg.data.hasOwnProperty('512')) {
5069
5141
  if (['ZNCZ15LM', 'QBCZ14LM', 'QBCZ15LM'].includes(model.model)) {
@@ -5878,7 +5950,13 @@ const converters = {
5878
5950
  ZMCSW032D_cover_position: {
5879
5951
  cluster: 'closuresWindowCovering',
5880
5952
  type: ['attributeReport', 'readResponse'],
5881
- options: [exposes.options.invert_cover()],
5953
+ options: [
5954
+ exposes.options.invert_cover(),
5955
+ exposes.numeric('time_close')
5956
+ .withDescription(`Set the full closing time of the roller shutter (e.g. set it to 20) (value is in s).`),
5957
+ exposes.numeric('time_open')
5958
+ .withDescription(`Set the full opening time of the roller shutter (e.g. set it to 21) (value is in s).`),
5959
+ ],
5882
5960
  convert: (model, msg, publish, options, meta) => {
5883
5961
  const result = {};
5884
5962
  const timeCoverSetMiddle = 60;
@@ -6072,8 +6150,9 @@ const converters = {
6072
6150
  cluster: 'manuSpecificTuya',
6073
6151
  type: ['commandDataReport', 'commandDataResponse'],
6074
6152
  convert: (model, msg, publish, options, meta) => {
6075
- const dp = msg.data.dp;
6076
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
6153
+ const dpValue = tuya.firstDpValue(msg, meta, 'javis_microwave_sensor');
6154
+ const dp = dpValue.dp;
6155
+ const value = tuya.getDataValue(dpValue);
6077
6156
  const lookup = {
6078
6157
  0: 'no_motion',
6079
6158
  1: 'big_motion',
@@ -6135,7 +6214,7 @@ const converters = {
6135
6214
  }
6136
6215
  default:
6137
6216
  meta.logger.warn(`zigbee-herdsman-converters:javis_microwave_sensor: NOT RECOGNIZED ` +
6138
- `DP #${dp} with data ${JSON.stringify(msg.data)}`);
6217
+ `DP #${dp} with data ${JSON.stringify(dpValue)}`);
6139
6218
  }
6140
6219
  },
6141
6220
  },
@@ -6279,8 +6358,9 @@ const converters = {
6279
6358
  cluster: 'manuSpecificTuya',
6280
6359
  type: 'commandDataResponse',
6281
6360
  convert: (model, msg, publish, options, meta) => {
6282
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
6283
- const dp = msg.data.dp;
6361
+ const dpValue = tuya.firstDpValue(msg, meta, 'ZVG1');
6362
+ const value = tuya.getDataValue(dpValue);
6363
+ const dp = dpValue.dp;
6284
6364
  switch (dp) {
6285
6365
  case tuya.dataPoints.state: {
6286
6366
  return {state: value ? 'ON': 'OFF'};
@@ -6307,7 +6387,7 @@ const converters = {
6307
6387
  }
6308
6388
  default: {
6309
6389
  meta.logger.warn(`zigbee-herdsman-converters:RTXZVG1Valve: NOT RECOGNIZED DP ` +
6310
- `#${dp} with data ${JSON.stringify(msg.data)}`);
6390
+ `#${dp} with data ${JSON.stringify(dpValue)}`);
6311
6391
  }
6312
6392
  }
6313
6393
  },
@@ -6843,8 +6923,9 @@ const converters = {
6843
6923
  cluster: 'manuSpecificTuya',
6844
6924
  type: ['commandDataResponse', 'commandDataReport'],
6845
6925
  convert: (model, msg, publish, options, meta) => {
6846
- const dp = msg.data.dp;
6847
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
6926
+ const dpValue = tuya.firstDpValue(msg, meta, 'SLUXZB');
6927
+ const dp = dpValue.dp;
6928
+ const value = tuya.getDataValue(dpValue);
6848
6929
  switch (dp) {
6849
6930
  case 2:
6850
6931
  return {illuminance_lux: value.toFixed(0)};
@@ -6853,7 +6934,7 @@ const converters = {
6853
6934
  case 1:
6854
6935
  return {battery_low: value.toFixed(1)};
6855
6936
  default:
6856
- meta.logger.warn(`s_lux_zb_illuminance: NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(msg.data)}`);
6937
+ meta.logger.warn(`s_lux_zb_illuminance: NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(dpValue)}`);
6857
6938
  }
6858
6939
  },
6859
6940
  },
@@ -6863,8 +6944,9 @@ const converters = {
6863
6944
  options: [exposes.options.precision('temperature'), exposes.options.calibration('temperature'),
6864
6945
  exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
6865
6946
  convert: (model, msg, publish, options, meta) => {
6866
- const dp = msg.data.dp;
6867
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
6947
+ const dpValue = tuya.firstDpValue(msg, meta, 'ZB003X');
6948
+ const dp = dpValue.dp;
6949
+ const value = tuya.getDataValue(dpValue);
6868
6950
 
6869
6951
  switch (dp) {
6870
6952
  case tuya.dataPoints.fantemTemp:
@@ -6893,7 +6975,7 @@ const converters = {
6893
6975
  return {reporting_enable: value};
6894
6976
  default:
6895
6977
  meta.logger.warn(`zigbee-herdsman-converters:FantemZB003X: Unrecognized DP #${
6896
- dp} with data ${JSON.stringify(msg.data)}`);
6978
+ dp} with data ${JSON.stringify(dpValue)}`);
6897
6979
  }
6898
6980
  },
6899
6981
  },
@@ -6926,15 +7008,16 @@ const converters = {
6926
7008
  cluster: 'manuSpecificTuya',
6927
7009
  type: ['commandDataResponse'],
6928
7010
  convert: (model, msg, publish, options, meta) => {
6929
- const dp = msg.data.dp;
6930
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7011
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_gas');
7012
+ const dp = dpValue.dp;
7013
+ const value = tuya.getDataValue(dpValue);
6931
7014
 
6932
7015
  switch (dp) {
6933
7016
  case tuya.dataPoints.state:
6934
7017
  return {gas: value === 0 ? true : false};
6935
7018
  default:
6936
7019
  meta.logger.warn(`zigbee-herdsman-converters:tuya_gas: Unrecognized DP #${
6937
- dp} with data ${JSON.stringify(msg.data)}`);
7020
+ dp} with data ${JSON.stringify(dpValue)}`);
6938
7021
  }
6939
7022
  },
6940
7023
  },
@@ -6942,15 +7025,16 @@ const converters = {
6942
7025
  cluster: 'manuSpecificTuya',
6943
7026
  type: ['commandActiveStatusReport'],
6944
7027
  convert: (model, msg, publish, options, meta) => {
6945
- const dp = msg.data.dp;
6946
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7028
+ const dpValue = tuya.firstDpValue(msg, meta, 'woox_R7060');
7029
+ const dp = dpValue.dp;
7030
+ const value = tuya.getDataValue(dpValue);
6947
7031
 
6948
7032
  switch (dp) {
6949
7033
  case tuya.dataPoints.wooxSwitch:
6950
7034
  return {state: value === 2 ? 'OFF' : 'ON'};
6951
7035
  default:
6952
7036
  meta.logger.warn(`zigbee-herdsman-converters:WooxR7060: Unrecognized DP #${
6953
- dp} with data ${JSON.stringify(msg.data)}`);
7037
+ dp} with data ${JSON.stringify(dpValue)}`);
6954
7038
  }
6955
7039
  },
6956
7040
  },
@@ -7296,8 +7380,9 @@ const converters = {
7296
7380
  cluster: 'manuSpecificTuya',
7297
7381
  type: ['commandDataResponse'],
7298
7382
  convert: (model, msg, publish, options, meta) => {
7299
- const dp = msg.data.dp;
7300
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7383
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_motion_sensor');
7384
+ const dp = dpValue.dp;
7385
+ const value = tuya.getDataValue(dpValue);
7301
7386
  let result = null;
7302
7387
  switch (dp) {
7303
7388
  case tuya.dataPoints.state:
@@ -7334,7 +7419,7 @@ const converters = {
7334
7419
  result = {luminance_level: value};
7335
7420
  break;
7336
7421
  default:
7337
- meta.logger.warn(`fromZigbee.tuya_motion_sensor: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(msg.data)}`);
7422
+ meta.logger.warn(`fromZigbee.tuya_motion_sensor: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(dpValue)}`);
7338
7423
  }
7339
7424
 
7340
7425
  return result;
@@ -7344,8 +7429,9 @@ const converters = {
7344
7429
  cluster: 'manuSpecificTuya',
7345
7430
  type: ['commandDataResponse', 'commandDataReport'],
7346
7431
  convert: (model, msg, publish, options, meta) => {
7347
- const dp = msg.data.dp;
7348
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7432
+ const dpValue = tuya.firstDpValue(msg, meta, 'tuya_radar_sensor');
7433
+ const dp = dpValue.dp;
7434
+ const value = tuya.getDataValue(dpValue);
7349
7435
  switch (dp) {
7350
7436
  case tuya.dataPoints.trsPresenceState:
7351
7437
  return {presence: {0: false, 1: true}[value]};
@@ -7368,8 +7454,9 @@ const converters = {
7368
7454
  cluster: 'manuSpecificTuya',
7369
7455
  type: ['commandDataResponse', 'commandDataReport', 'raw'],
7370
7456
  convert: (model, msg, publish, options, meta) => {
7371
- const dp = msg.data.dp;
7372
- let value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7457
+ const dpValue = tuya.firstDpValue(msg, meta, 'moes_thermostat_tv');
7458
+ const dp = dpValue.dp;
7459
+ let value = tuya.getDataValue(dpValue);
7373
7460
  let result = null;
7374
7461
  switch (dp) {
7375
7462
  case tuya.dataPoints.tvMode:
@@ -7443,7 +7530,7 @@ const converters = {
7443
7530
  }
7444
7531
  break;
7445
7532
  default:
7446
- meta.logger.warn(`fromZigbee.moes_thermostat_tv: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(msg.data)}`);
7533
+ meta.logger.warn(`fromZigbee.moes_thermostat_tv: NOT RECOGNIZED DP ${dp} with data ${JSON.stringify(dpValue)}`);
7447
7534
  }
7448
7535
 
7449
7536
  return result;
@@ -7477,10 +7564,11 @@ const converters = {
7477
7564
  cluster: 'manuSpecificTuya',
7478
7565
  type: ['commandDataResponse', 'commandDataReport'],
7479
7566
  convert: (model, msg, publish, options, meta) => {
7480
- const dp = msg.data.dp;
7481
- const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
7567
+ const dpValue = tuya.firstDpValue(msg, meta, 'hoch_din');
7568
+ const dp = dpValue.dp;
7569
+ const value = tuya.getDataValue(dpValue);
7482
7570
  const result = {};
7483
- meta.logger.debug(`from hoch_din, msg.data.dp=[${dp}], msg.data.datatype=[${msg.data.datatype}], value=[${value}]`);
7571
+ meta.logger.debug(`from hoch_din, dp=[${dp}], datatype=[${dpValue.datatype}], value=[${value}]`);
7484
7572
 
7485
7573
  if (dp === tuya.dataPoints.state) {
7486
7574
  result.state = value ? 'ON' : 'OFF';