zigbee-herdsman-converters 14.0.412 → 14.0.413

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.
@@ -2420,6 +2420,12 @@ const converters = {
2420
2420
  convert: (model, msg, publish, options, meta) => {
2421
2421
  const dpValue = tuya.firstDpValue(msg, meta, 'moes_switch');
2422
2422
  const dp = dpValue.dp;
2423
+
2424
+ // tuya_switch datapoints
2425
+ if (dp >= 1 && dp <= 4) {
2426
+ return null;
2427
+ }
2428
+
2423
2429
  const value = tuya.getDataValue(dpValue);
2424
2430
 
2425
2431
  switch (dp) {
@@ -2637,6 +2643,31 @@ const converters = {
2637
2643
  }
2638
2644
  },
2639
2645
  },
2646
+ ts011f_plug_indicator_mode: {
2647
+ cluster: 'genOnOff',
2648
+ type: ['attributeReport', 'readResponse'],
2649
+ convert: (model, msg, publish, options, meta) => {
2650
+ const property = 'tuyaBacklightMode'; // 0x8001 or 32769
2651
+ if (msg.data.hasOwnProperty(property)) {
2652
+ const value = msg.data[property];
2653
+ const lookup = {0: 'off', 1: 'off/on', 2: 'on/off', 3: 'on'};
2654
+ if (lookup.hasOwnProperty(value)) {
2655
+ return {indicator_mode: lookup[value]};
2656
+ }
2657
+ }
2658
+ },
2659
+ },
2660
+ ts011f_plug_child_mode: {
2661
+ cluster: 'genOnOff',
2662
+ type: ['attributeReport', 'readResponse'],
2663
+ convert: (model, msg, publish, options, meta) => {
2664
+ const property = (0x8000).toString(); // 32768
2665
+ if (msg.data.hasOwnProperty(property)) {
2666
+ const value = msg.data[property];
2667
+ return {child_lock: value ? 'LOCK' : 'UNLOCK'};
2668
+ }
2669
+ },
2670
+ },
2640
2671
  WSZ01_on_off_action: {
2641
2672
  cluster: 65029,
2642
2673
  type: 'raw',
@@ -5330,8 +5361,11 @@ const converters = {
5330
5361
  if (index == 1) {
5331
5362
  payload.voltage = value;
5332
5363
  payload.battery = batteryVoltageToPercentage(value, '3V_2100');
5333
- } else if (index === 3) payload.temperature = calibrateAndPrecisionRoundOptions(value, options, 'temperature'); // 0x03
5334
- else if (index === 5) {
5364
+ } else if (index === 3) {
5365
+ if (!['WXCJKG11LM ', 'WXCJKG12LM', 'WXCJKG13LM'].includes(model.model)) {
5366
+ payload.temperature = calibrateAndPrecisionRoundOptions(value, options, 'temperature'); // 0x03
5367
+ }
5368
+ } else if (index === 5) {
5335
5369
  if (['JT-BZ-01AQ/A', 'RTCZCGQ11LM'].includes(model.model)) payload.power_outage_count = value;
5336
5370
  } else if (index === 100) {
5337
5371
  if (['QBKG20LM', 'QBKG31LM', 'QBKG39LM', 'QBKG41LM', 'QBCZ15LM'].includes(model.model)) {
@@ -3218,7 +3218,7 @@ const converters = {
3218
3218
  );
3219
3219
  break;
3220
3220
  case 'indicate_light':
3221
- await tuya.sendDataPointValue(
3221
+ await tuya.sendDataPointEnum(
3222
3222
  entity,
3223
3223
  tuya.dataPoints.moesSwitchIndicateLight,
3224
3224
  utils.getKey(tuya.moesSwitch.indicateLight, value),
@@ -5994,6 +5994,32 @@ const converters = {
5994
5994
  await entity.read('genOnOff', ['tuyaBacklightMode']);
5995
5995
  },
5996
5996
  },
5997
+ ts011f_plug_indicator_mode: {
5998
+ key: ['indicator_mode'],
5999
+ convertSet: async (entity, key, value, meta) => {
6000
+ if (typeof value === 'string') {
6001
+ value = value.toLowerCase();
6002
+ const lookup = {'off': 0, 'off/on': 1, 'on/off': 2, 'on': 3};
6003
+ utils.validateValue(value, Object.keys(lookup));
6004
+ value = lookup[value];
6005
+ }
6006
+
6007
+ if (typeof value === 'number' && value >= 0 && value <= 3) {
6008
+ await entity.write('genOnOff', {tuyaBacklightMode: value});
6009
+ } else {
6010
+ meta.logger.warn(`toZigbee.ts011f_plug_indicator_mode: Unsupported value ${value}`);
6011
+ }
6012
+ },
6013
+ convertGet: async (entity, key, meta) => {
6014
+ await entity.read('genOnOff', ['tuyaBacklightMode']);
6015
+ },
6016
+ },
6017
+ ts011f_plug_child_mode: {
6018
+ key: ['child_lock'],
6019
+ convertSet: async (entity, key, value, meta) => {
6020
+ await entity.write('genOnOff', {0x8000: {value: value === 'LOCK', type: 0x10}});
6021
+ },
6022
+ },
5997
6023
  hy_thermostat: {
5998
6024
  key: [
5999
6025
  'child_lock', 'current_heating_setpoint', 'local_temperature_calibration',
@@ -375,4 +375,25 @@ module.exports = [
375
375
  },
376
376
  exposes: [e.battery(), e.illuminance(), e.temperature(), e.humidity(), e.pressure()],
377
377
  },
378
+ {
379
+ zigbeeModel: ['EFEKTA_eFlower_Pro'],
380
+ model: 'EFEKTA_eFlower_Pro',
381
+ vendor: 'Custom devices (DiY)',
382
+ description: '[Plant Wattering Sensor with e-ink display 2.13](https://efektalab.com/eFlowerPro)',
383
+ fromZigbee: [fz.temperature, fz.humidity, fz.illuminance, fz.soil_moisture, fz.battery],
384
+ toZigbee: [tz.factory_reset],
385
+ configure: async (device, coordinatorEndpoint, logger) => {
386
+ const firstEndpoint = device.getEndpoint(1);
387
+ await reporting.bind(firstEndpoint, coordinatorEndpoint, [
388
+ 'genPowerCfg', 'msTemperatureMeasurement', 'msRelativeHumidity', 'msIlluminanceMeasurement', 'msSoilMoisture']);
389
+ const overides = {min: 0, max: 21600, change: 0};
390
+ await reporting.batteryVoltage(firstEndpoint, overides);
391
+ await reporting.batteryPercentageRemaining(firstEndpoint, overides);
392
+ await reporting.temperature(firstEndpoint, overides);
393
+ await reporting.humidity(firstEndpoint, overides);
394
+ await reporting.illuminance(firstEndpoint, overides);
395
+ await reporting.soil_moisture(firstEndpoint, overides);
396
+ },
397
+ exposes: [e.soil_moisture(), e.battery(), e.illuminance(), e.temperature(), e.humidity()],
398
+ },
378
399
  ];
@@ -62,10 +62,14 @@ const gledoptoExtend = {
62
62
  }),
63
63
  };
64
64
 
65
- const configureReadModelID = async (device) => {
65
+ const configureReadModelID = async (device, coordinatorEndpoint, logger) => {
66
66
  // https://github.com/Koenkk/zigbee-herdsman-converters/issues/3016#issuecomment-1027726604
67
67
  const endpoint = device.endpoints[0];
68
- await endpoint.read('genBasic', ['modelId']);
68
+ const oldModel = device.modelID;
69
+ const newModel = (await endpoint.read('genBasic', ['modelId'])).modelId;
70
+ if (oldModel != newModel) {
71
+ logger.info(`Detected Gledopto device mode change, from '${oldModel}' to '${newModel}'`);
72
+ }
69
73
  };
70
74
 
71
75
  module.exports = [
@@ -125,7 +129,7 @@ module.exports = [
125
129
  extend: gledoptoExtend.light_onoff_brightness_colortemp({noConfigure: true}),
126
130
  configure: async (device, coordinatorEndpoint, logger) => {
127
131
  await extend.light_onoff_brightness_colortemp().configure(device, coordinatorEndpoint, logger);
128
- await configureReadModelID(device);
132
+ await configureReadModelID(device, coordinatorEndpoint, logger);
129
133
  },
130
134
  },
131
135
  {
@@ -192,7 +196,7 @@ module.exports = [
192
196
  extend: gledoptoExtend.light_onoff_brightness_colortemp_color({noConfigure: true}),
193
197
  configure: async (device, coordinatorEndpoint, logger) => {
194
198
  await extend.light_onoff_brightness_colortemp_color().configure(device, coordinatorEndpoint, logger);
195
- await configureReadModelID(device);
199
+ await configureReadModelID(device, coordinatorEndpoint, logger);
196
200
  },
197
201
  },
198
202
  {
@@ -254,7 +258,7 @@ module.exports = [
254
258
  extend: gledoptoExtend.light_onoff_brightness_color({noConfigure: true}),
255
259
  configure: async (device, coordinatorEndpoint, logger) => {
256
260
  await extend.light_onoff_brightness_color().configure(device, coordinatorEndpoint, logger);
257
- await configureReadModelID(device);
261
+ await configureReadModelID(device, coordinatorEndpoint, logger);
258
262
  },
259
263
  },
260
264
  {
@@ -267,7 +271,7 @@ module.exports = [
267
271
  meta: {disableDefaultResponse: true},
268
272
  configure: async (device, coordinatorEndpoint, logger) => {
269
273
  await extend.light_onoff_brightness_colortemp_color().configure(device, coordinatorEndpoint, logger);
270
- await configureReadModelID(device);
274
+ await configureReadModelID(device, coordinatorEndpoint, logger);
271
275
  },
272
276
  },
273
277
  {
@@ -292,7 +296,7 @@ module.exports = [
292
296
  extend: gledoptoExtend.light_onoff_brightness({noConfigure: true}),
293
297
  configure: async (device, coordinatorEndpoint, logger) => {
294
298
  await extend.light_onoff_brightness().configure(device, coordinatorEndpoint, logger);
295
- await configureReadModelID(device);
299
+ await configureReadModelID(device, coordinatorEndpoint, logger);
296
300
  },
297
301
  },
298
302
  {
package/devices/tuya.js CHANGED
@@ -1149,8 +1149,9 @@ module.exports = [
1149
1149
  vendor: 'TuYa',
1150
1150
  whiteLabel: [{vendor: 'LELLKI', model: 'TS011F_plug'}, {vendor: 'NEO', model: 'NAS-WR01B'},
1151
1151
  {vendor: 'BlitzWolf', model: 'BW-SHP15'}],
1152
- fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, fz.tuya_switch_power_outage_memory],
1153
- toZigbee: [tz.on_off, tz.tuya_switch_power_outage_memory],
1152
+ fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, fz.tuya_switch_power_outage_memory,
1153
+ fz.ts011f_plug_indicator_mode, fz.ts011f_plug_child_mode],
1154
+ toZigbee: [tz.on_off, tz.tuya_switch_power_outage_memory, tz.ts011f_plug_indicator_mode, tz.ts011f_plug_child_mode],
1154
1155
  configure: async (device, coordinatorEndpoint, logger) => {
1155
1156
  const endpoint = device.getEndpoint(1);
1156
1157
  await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']);
@@ -1164,7 +1165,9 @@ module.exports = [
1164
1165
  },
1165
1166
  exposes: [e.switch(), e.power(), e.current(), e.voltage().withAccess(ea.STATE),
1166
1167
  e.energy(), exposes.enum('power_outage_memory', ea.STATE_SET, ['on', 'off', 'restore'])
1167
- .withDescription('Recover state after power outage')],
1168
+ .withDescription('Recover state after power outage'),
1169
+ exposes.enum('indicator_mode', ea.ALL, ['off', 'off/on', 'on/off', 'on'])
1170
+ .withDescription('Plug LED indicator mode'), e.child_lock()],
1168
1171
  },
1169
1172
  {
1170
1173
  fingerprint: [
@@ -1174,14 +1177,16 @@ module.exports = [
1174
1177
  model: 'TS011F_plug_2',
1175
1178
  description: 'Smart plug (without power monitoring)',
1176
1179
  vendor: 'TuYa',
1177
- fromZigbee: [fz.on_off, fz.tuya_switch_power_outage_memory],
1178
- toZigbee: [tz.on_off, tz.tuya_switch_power_outage_memory],
1180
+ fromZigbee: [fz.on_off, fz.tuya_switch_power_outage_memory, fz.ts011f_plug_indicator_mode, fz.ts011f_plug_child_mode],
1181
+ toZigbee: [tz.on_off, tz.tuya_switch_power_outage_memory, tz.ts011f_plug_indicator_mode, tz.ts011f_plug_child_mode],
1179
1182
  configure: async (device, coordinatorEndpoint, logger) => {
1180
1183
  const endpoint = device.getEndpoint(1);
1181
1184
  await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
1182
1185
  },
1183
1186
  exposes: [e.switch(), exposes.enum('power_outage_memory', ea.STATE_SET, ['on', 'off', 'restore'])
1184
- .withDescription('Recover state after power outage')],
1187
+ .withDescription('Recover state after power outage'),
1188
+ exposes.enum('indicator_mode', ea.ALL, ['off', 'off/on', 'on/off', 'on'])
1189
+ .withDescription('Plug LED indicator mode'), e.child_lock()],
1185
1190
  },
1186
1191
  {
1187
1192
  fingerprint: [].concat(...TS011Fplugs.map((manufacturerName) => {
@@ -1193,8 +1198,9 @@ module.exports = [
1193
1198
  description: 'Smart plug (with power monitoring by polling)',
1194
1199
  vendor: 'TuYa',
1195
1200
  whiteLabel: [{vendor: 'VIKEFON', model: 'TS011F'}, {vendor: 'BlitzWolf', model: 'BW-SHP15'}],
1196
- fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, fz.tuya_switch_power_outage_memory],
1197
- toZigbee: [tz.on_off, tz.tuya_switch_power_outage_memory],
1201
+ fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, fz.tuya_switch_power_outage_memory,
1202
+ fz.ts011f_plug_indicator_mode, fz.ts011f_plug_child_mode],
1203
+ toZigbee: [tz.on_off, tz.tuya_switch_power_outage_memory, tz.ts011f_plug_indicator_mode, tz.ts011f_plug_child_mode],
1198
1204
  configure: async (device, coordinatorEndpoint, logger) => {
1199
1205
  const endpoint = device.getEndpoint(1);
1200
1206
  // Enables reporting of physical state changes
@@ -1207,7 +1213,9 @@ module.exports = [
1207
1213
  options: [exposes.options.measurement_poll_interval()],
1208
1214
  exposes: [e.switch(), e.power(), e.current(), e.voltage().withAccess(ea.STATE),
1209
1215
  e.energy(), exposes.enum('power_outage_memory', ea.STATE_SET, ['on', 'off', 'restore'])
1210
- .withDescription('Recover state after power outage')],
1216
+ .withDescription('Recover state after power outage'),
1217
+ exposes.enum('indicator_mode', ea.ALL, ['off', 'off/on', 'on/off', 'on'])
1218
+ .withDescription('Plug LED indicator mode'), e.child_lock()],
1211
1219
  onEvent: tuya.onEventMeasurementPoll,
1212
1220
  },
1213
1221
  {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-herdsman-converters",
3
- "version": "14.0.412",
3
+ "version": "14.0.413",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-herdsman-converters",
3
- "version": "14.0.412",
3
+ "version": "14.0.413",
4
4
  "description": "Collection of device converters to be used with zigbee-herdsman",
5
5
  "main": "index.js",
6
6
  "files": [