zigbee-herdsman-converters 14.0.497 → 14.0.498

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.
@@ -4294,7 +4294,6 @@ const converters = {
4294
4294
  const dpValue = tuya.firstDpValue(msg, meta, 'tuya_air_quality');
4295
4295
  const dp = dpValue.dp;
4296
4296
  const value = tuya.getDataValue(dpValue);
4297
- const swapPM25CO2 = ['_TZE200_ryfmq5rl', '_TZE200_dwcarsat'];
4298
4297
  switch (dp) {
4299
4298
  case tuya.dataPoints.tuyaSabTemp:
4300
4299
  return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
@@ -4302,15 +4301,17 @@ const converters = {
4302
4301
  return {humidity: calibrateAndPrecisionRoundOptions(value / 10, options, 'humidity')};
4303
4302
  // DP22: Smart Air Box: Formaldehyd, Smart Air Housekeeper: co2
4304
4303
  case tuya.dataPoints.tuyaSabFormaldehyd:
4305
- if (swapPM25CO2.includes(meta.device.manufacturerName)) {
4304
+ if (['_TZE200_dwcarsat', '_TZE200_ryfmq5rl'].includes(meta.device.manufacturerName)) {
4306
4305
  return {co2: calibrateAndPrecisionRoundOptions(value, options, 'co2')};
4307
4306
  } else {
4308
4307
  return {formaldehyd: calibrateAndPrecisionRoundOptions(value, options, 'formaldehyd')};
4309
4308
  }
4310
4309
  // DP2: Smart Air Box: co2, Smart Air Housekeeper: MP25
4311
4310
  case tuya.dataPoints.tuyaSabCO2:
4312
- if (swapPM25CO2.includes(meta.device.manufacturerName)) {
4311
+ if (meta.device.manufacturerName === '_TZE200_dwcarsat') {
4313
4312
  return {pm25: calibrateAndPrecisionRoundOptions(value, options, 'pm25')};
4313
+ } else if (meta.device.manufacturerName === '_TZE200_ryfmq5rl') {
4314
+ return {formaldehyd: calibrateAndPrecisionRoundOptions(value, options, 'formaldehyd')};
4314
4315
  } else {
4315
4316
  return {co2: calibrateAndPrecisionRoundOptions(value, options, 'co2')};
4316
4317
  }
@@ -4763,7 +4764,7 @@ const converters = {
4763
4764
  },
4764
4765
  tuya_data_point_dump: {
4765
4766
  cluster: 'manuSpecificTuya',
4766
- type: ['commandDataResponse', 'commandDataReport', 'commandActiveStatusReport'],
4767
+ type: ['commandDataResponse', 'commandDataReport', 'commandActiveStatusReport', 'commandActiveStatusReportAlt'],
4767
4768
  convert: (model, msg, publis, options, meta) => {
4768
4769
  // Don't use in production!
4769
4770
  // Used in: https://www.zigbee2mqtt.io/how_tos/how_to_support_new_tuya_devices.html
@@ -7326,22 +7327,34 @@ const converters = {
7326
7327
  },
7327
7328
  ZB006X_settings: {
7328
7329
  cluster: 'manuSpecificTuya',
7329
- type: ['commandDataResponse'],
7330
+ type: ['commandActiveStatusReport', 'commandActiveStatusReportAlt'],
7330
7331
  convert: (model, msg, publish, options, meta) => {
7331
7332
  const dpValue = tuya.firstDpValue(msg, meta, 'ZB006X_settings');
7332
7333
  const dp = dpValue.dp;
7333
7334
  const value = tuya.getDataValue(dpValue);
7334
- if (dp === 103) {
7335
- meta.logger.debug(`fromZigbee.ZB006X_settings: Found DP #${dp} with data ${JSON.stringify(dpValue)}`);
7336
- return {ext_switch_type: {0: 'unknown', 1: 'toggle_sw', 2: 'momentary_sw', 3: 'rotary_sw', 4: 'auto_config'}[value]};
7337
- } else if (dp === 105) {
7338
- meta.logger.debug(`fromZigbee.ZB006X_settings: Found DP #${dp} with data ${JSON.stringify(dpValue)}`);
7335
+ switch (dp) {
7336
+ case tuya.dataPoints.fantemPowerSupplyMode:
7337
+ return {power_supply_mode: {0: 'unknown', 1: 'no_neutral', 2: 'with_neutral'}[value]};
7338
+ case tuya.dataPoints.fantemExtSwitchType:
7339
+ return {ext_switch_type: {0: 'unknown', 1: 'toggle_sw', 2: 'momentary_sw', 3: 'rotary_sw',
7340
+ 4: 'auto_config'}[value]};
7341
+ case tuya.dataPoints.fantemLoadDetectionMode:
7339
7342
  return {load_detection_mode: {0: 'none', 1: 'first_power_on', 2: 'every_power_on'}[value]};
7340
- } else if (dp === 109) {
7341
- meta.logger.debug(`fromZigbee.ZB006X_settings: Found DP #${dp} with data ${JSON.stringify(dpValue)}`);
7342
- return {control_mode: {0: 'local', 1: 'remote', 2: 'both'}[value]};
7343
- } else {
7344
- meta.logger.warn(`fromZigbee.ZB006X_settings: Unrecognized DP #${dp} with data ${JSON.stringify(dpValue)}`);
7343
+ case tuya.dataPoints.fantemExtSwitchStatus:
7344
+ return {ext_switch_status: value};
7345
+ case tuya.dataPoints.fantemControlMode:
7346
+ return {control_mode: {0: 'ext_switch', 1: 'remote', 2: 'both'}[value]};
7347
+ case 111:
7348
+ // Value 0 is received after each device power-on. No idea what it means.
7349
+ return;
7350
+ case tuya.dataPoints.fantemLoadType:
7351
+ // Not sure if 0 is 'resistive' and 2 is 'resistive_inductive'.
7352
+ // If you see 'unknown', pls. check with Tuya gateway and app and update with label shown in Tuya app.
7353
+ return {load_type: {0: 'unknown', 1: 'resistive_capacitive', 2: 'unknown', 3: 'detecting'}[value]};
7354
+ case tuya.dataPoints.fantemLoadDimmable:
7355
+ return {load_dimmable: {0: 'unknown', 1: 'dimmable', 2: 'not_dimmable'}[value]};
7356
+ default:
7357
+ meta.logger.warn(`fz.ZB006X_settings: Unhandled DP|Value [${dp}|${value}][${JSON.stringify(dpValue)}]`);
7345
7358
  }
7346
7359
  },
7347
7360
  },
@@ -6495,17 +6495,19 @@ const converters = {
6495
6495
  convertSet: async (entity, key, value, meta) => {
6496
6496
  switch (key) {
6497
6497
  case 'ext_switch_type':
6498
- await tuya.sendDataPointEnum(entity, 103, {'unknown': 0, 'toggle_sw': 1,
6499
- 'momentary_sw': 2, 'rotary_sw': 3, 'auto_config': 4}[value]);
6498
+ await tuya.sendDataPointEnum(entity, tuya.dataPoints.fantemExtSwitchType, {'unknown': 0, 'toggle_sw': 1,
6499
+ 'momentary_sw': 2, 'rotary_sw': 3, 'auto_config': 4}[value], 'sendData');
6500
6500
  break;
6501
6501
  case 'load_detection_mode':
6502
- await tuya.sendDataPointEnum(entity, 105, {'none': 0, 'first_power_on': 1, 'every_power_on': 2}[value]);
6502
+ await tuya.sendDataPointEnum(entity, tuya.dataPoints.fantemLoadDetectionMode, {'none': 0, 'first_power_on': 1,
6503
+ 'every_power_on': 2}[value], 'sendData');
6503
6504
  break;
6504
6505
  case 'control_mode':
6505
- await tuya.sendDataPointEnum(entity, 109, {'local': 0, 'remote': 1, 'both': 2}[value]);
6506
+ await tuya.sendDataPointEnum(entity, tuya.dataPoints.fantemControlMode, {'ext_switch': 0, 'remote': 1,
6507
+ 'both': 2}[value], 'sendData');
6506
6508
  break;
6507
6509
  default: // Unknown key
6508
- throw new Error(`toZigbee.ZB006X_settings: Unhandled key ${key}`);
6510
+ throw new Error(`tz.ZB006X_settings: Unhandled key ${key}`);
6509
6511
  }
6510
6512
  },
6511
6513
  },
@@ -45,7 +45,7 @@ module.exports = [
45
45
  .withDescription('Whether or not the unit needs warm water. `false` No Heat Request or `true` Heat Request'),
46
46
  exposes.enum('setpoint_change_source', ea.STATE, ['manual', 'schedule', 'externally'])
47
47
  .withDescription('Values observed are `0` (manual), `1` (schedule) or `2` (externally)'),
48
- exposes.climate().withSetpoint('occupied_heating_setpoint', 5, 32, 0.5).withLocalTemperature().withPiHeatingDemand()
48
+ exposes.climate().withSetpoint('occupied_heating_setpoint', 5, 35, 0.5).withLocalTemperature().withPiHeatingDemand()
49
49
  .withSystemMode(['heat']).withRunningState(['idle', 'heat'], ea.STATE),
50
50
  exposes.numeric('external_measured_room_sensor', ea.ALL)
51
51
  .withDescription('If `radiator_covered` is `true`: Set at maximum 30 minutes interval but not more often than every ' +
package/devices/fantem.js CHANGED
@@ -5,6 +5,7 @@ const e = exposes.presets;
5
5
  const ea = exposes.access;
6
6
  const extend = require('../lib/extend');
7
7
  const reporting = require('../lib/reporting');
8
+ const tuya = require('../lib/tuya');
8
9
 
9
10
  module.exports = [
10
11
  {
@@ -13,21 +14,34 @@ module.exports = [
13
14
  vendor: 'Fantem',
14
15
  description: 'Smart dimmer module without neutral',
15
16
  extend: extend.light_onoff_brightness({noConfigure: true}),
16
- fromZigbee: [...extend.light_onoff_brightness({noConfigure: true}).fromZigbee, fz.command_on, fz.command_off,
17
- fz.command_move, fz.command_stop, fz.ZB006X_settings],
17
+ fromZigbee: [...extend.light_onoff_brightness({noConfigure: true}).fromZigbee,
18
+ fz.command_on, fz.command_off, fz.command_move, fz.command_stop, fz.ZB006X_settings],
18
19
  toZigbee: [...extend.light_onoff_brightness({noConfigure: true}).toZigbee, tz.ZB006X_settings],
19
20
  exposes: [e.light_brightness(),
20
21
  e.action(['on', 'off', 'brightness_move_down', 'brightness_move_up', 'brightness_stop']),
22
+ exposes.enum('control_mode', ea.STATE_SET, ['ext_switch', 'remote', 'both']).withDescription('Control mode'),
21
23
  exposes.enum('ext_switch_type', ea.STATE_SET, ['unknown', 'toggle_sw', 'momentary_sw', 'rotary_sw', 'auto_config'])
22
24
  .withDescription('External switch type'),
25
+ exposes.numeric('ext_switch_status', ea.STATE).withDescription('External switch status')
26
+ .withValueMin(-10000).withValueMax(10000),
23
27
  exposes.enum('load_detection_mode', ea.STATE_SET, ['none', 'first_power_on', 'every_power_on'])
24
28
  .withDescription('Load detection mode'),
25
- exposes.enum('control_mode', ea.STATE_SET, ['local', 'remote', 'both']).withDescription('Control mode'),
29
+ // If you see load_type 'unknown', pls. check with Tuya gateway and app and update with label from Tuya app.
30
+ exposes.enum('load_type', ea.STATE, ['unknown', 'resistive_capacitive', 'unknown', 'detecting'])
31
+ .withDescription('Load type'),
32
+ exposes.enum('load_dimmable', ea.STATE, ['unknown', 'dimmable', 'not_dimmable'])
33
+ .withDescription('Load dimmable'),
34
+ exposes.enum('power_supply_mode', ea.STATE, ['unknown', 'no_neutral', 'with_neutral'])
35
+ .withDescription('Power supply mode'),
26
36
  ],
27
37
  meta: {disableActionGroup: true},
38
+ onEvent: tuya.onEventSetLocalTime,
28
39
  configure: async (device, coordinatorEndpoint, logger) => {
29
40
  await extend.light_onoff_brightness().configure(device, coordinatorEndpoint, logger);
30
41
  const endpoint = device.getEndpoint(1);
42
+ // Enables reporting of physical state changes
43
+ // https://github.com/Koenkk/zigbee2mqtt/issues/9057#issuecomment-1007742130
44
+ await endpoint.read('genBasic', ['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 0xfffe]);
31
45
  await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']);
32
46
  await reporting.onOff(endpoint);
33
47
  },
package/lib/tuya.js CHANGED
@@ -449,16 +449,23 @@ const dataPoints = {
449
449
  silvercrestSetColor: 5,
450
450
  silvercrestSetEffect: 6,
451
451
  // Fantem
452
+ fantemPowerSupplyMode: 101,
452
453
  fantemReportingTime: 102,
454
+ fantemExtSwitchType: 103,
453
455
  fantemTempCalibration: 104,
454
456
  fantemHumidityCalibration: 105,
457
+ fantemLoadDetectionMode: 105,
455
458
  fantemLuxCalibration: 106,
459
+ fantemExtSwitchStatus: 106,
456
460
  fantemTemp: 107,
457
461
  fantemHumidity: 108,
458
462
  fantemMotionEnable: 109,
463
+ fantemControlMode: 109,
459
464
  fantemBattery: 110,
460
465
  fantemLedEnable: 111,
461
466
  fantemReportingEnable: 112,
467
+ fantemLoadType: 112,
468
+ fantemLoadDimmable: 113,
462
469
  // Woox
463
470
  wooxSwitch: 102,
464
471
  wooxBattery: 14,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-herdsman-converters",
3
- "version": "14.0.497",
3
+ "version": "14.0.498",
4
4
  "description": "Collection of device converters to be used with zigbee-herdsman",
5
5
  "main": "index.js",
6
6
  "files": [