zigbee-herdsman-converters 15.0.62 → 15.0.63

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.
@@ -1222,24 +1222,69 @@ const converters = {
1222
1222
  key: ['weekly_schedule'],
1223
1223
  convertSet: async (entity, key, value, meta) => {
1224
1224
  const payload = {
1225
- numoftrans: value.numoftrans,
1226
1225
  dayofweek: value.dayofweek,
1227
- mode: value.mode,
1228
1226
  transitions: value.transitions,
1229
1227
  };
1230
1228
 
1229
+ if (Array.isArray(payload.transitions)) {
1230
+ // calculate numoftrans
1231
+ if (typeof value.numoftrans !== 'undefined') {
1232
+ meta.logger.warn(`weekly_schedule: igonoring provided numoftrans value (${JSON.stringify(value.numoftrans)}),\
1233
+ this is now calculated automatically`);
1234
+ }
1235
+ payload.numoftrans = payload.transitions.length;
1231
1236
 
1232
- // map array of desired modes to bitmask
1233
- if (typeof payload.dayofweek === 'string') payload.dayofweek = [payload.dayofweek];
1234
- if (Array.isArray(payload.dayofweek)) {
1235
- let mode = 0;
1236
- for (let m of payload.mode) {
1237
- // lookup mode bit
1238
- m = utils.getKey(constants.thermostatScheduleMode, m.toLowerCase(), m, Number);
1239
- mode |= (1 << m);
1237
+ // mode is calculated below
1238
+ if (typeof value.mode !== 'undefined') {
1239
+ meta.logger.warn(
1240
+ `weekly_schedule: igonoring provided mode value (${JSON.stringify(value.mode)}),\
1241
+ this is now calculated automatically`);
1242
+ }
1243
+ payload.mode = [];
1244
+
1245
+ // transform transition payload values if needed
1246
+ for (const elem of payload.transitions) {
1247
+ // update payload.mode if needed
1248
+ if (elem.hasOwnProperty('heatSetpoint') && !payload.mode.includes('heat')) {
1249
+ payload.mode.push('heat');
1250
+ }
1251
+ if (elem.hasOwnProperty('coolSetpoint') && !payload.mode.includes('cool')) {
1252
+ payload.mode.push('cool');
1253
+ }
1254
+
1255
+ // transform setpoint values if numeric
1256
+ if (typeof elem['heatSetpoint'] === 'number') {
1257
+ elem['heatSetpoint'] = Math.round(elem['heatSetpoint'] * 100);
1258
+ }
1259
+ if (typeof elem['coolSetpoint'] === 'number') {
1260
+ elem['coolSetpoint'] = Math.round(elem['coolSetpoint'] * 100);
1261
+ }
1262
+
1263
+ // accept 24h time notation (e.g. 19:30)
1264
+ if (typeof elem['transitionTime'] === 'string') {
1265
+ const time = elem['transitionTime'].split(':');
1266
+ if ((time.length != 2) || isNaN(time[0]) || isNaN(time[1])) {
1267
+ meta.logger.warn(
1268
+ `weekly_schedule: expected 24h time notation (e.g. 19:30) but got '${elem['transitionTime']}'!`,
1269
+ );
1270
+ } else {
1271
+ elem['transitionTime'] = ((parseInt(time[0]) * 60) + parseInt(time[1]));
1272
+ }
1273
+ }
1240
1274
  }
1241
- payload.mode = mode;
1275
+ } else {
1276
+ meta.logger.error('weekly_schedule: transitions is not an array!');
1277
+ return;
1278
+ }
1279
+
1280
+ // map array of desired modes to bitmask
1281
+ let mode = 0;
1282
+ for (let m of payload.mode) {
1283
+ // lookup mode bit
1284
+ m = utils.getKey(constants.thermostatScheduleMode, m.toLowerCase(), m, Number);
1285
+ mode |= (1 << m);
1242
1286
  }
1287
+ payload.mode = mode;
1243
1288
 
1244
1289
  // map array of days to desired dayofweek bitmask
1245
1290
  if (typeof payload.dayofweek === 'string') payload.dayofweek = [payload.dayofweek];
@@ -1253,24 +1298,6 @@ const converters = {
1253
1298
  payload.dayofweek = dayofweek;
1254
1299
  }
1255
1300
 
1256
- for (const elem of payload['transitions']) {
1257
- if (typeof elem['heatSetpoint'] === 'number') {
1258
- elem['heatSetpoint'] = Math.round(elem['heatSetpoint'] * 100);
1259
- }
1260
- if (typeof elem['coolSetpoint'] === 'number') {
1261
- elem['coolSetpoint'] = Math.round(elem['coolSetpoint'] * 100);
1262
- }
1263
-
1264
- // accept 24h time notation (e.g. 19:30)
1265
- if (typeof elem['transitionTime'] === 'string') {
1266
- const time = elem['transitionTime'].split(':');
1267
- if ((time.length != 2) || isNaN(time[0]) || isNaN(time[1])) {
1268
- meta.logger.warn(`weekly_schedule: expected 24h time notation (e.g. 19:30) but got '${elem['transitionTime']}'!`);
1269
- } else {
1270
- elem['transitionTime'] = ((parseInt(time[0]) * 60) + parseInt(time[1]));
1271
- }
1272
- }
1273
- }
1274
1301
  await entity.command('hvacThermostat', 'setWeeklySchedule', payload, utils.getOptions(meta.mapped, entity));
1275
1302
  },
1276
1303
  convertGet: async (entity, key, meta) => {
package/devices/namron.js CHANGED
@@ -452,7 +452,7 @@ module.exports = [
452
452
  const time = Math.round(((new Date()).getTime() - constants.OneJanuary2000) / 1000 + ((new Date())
453
453
  .getTimezoneOffset() * -1) * 60);
454
454
  const values = {time: time};
455
- endpoint.write('genTime', values);
455
+ await endpoint.write('genTime', values);
456
456
  } catch (error) {/* Do nothing*/}
457
457
  }, hours24);
458
458
  globalStore.putValue(device, 'time', interval);
@@ -1788,6 +1788,13 @@ module.exports = [
1788
1788
  description: 'Hue Centura',
1789
1789
  extend: philips.extend.light_onoff_brightness_colortemp_color(),
1790
1790
  },
1791
+ {
1792
+ zigbeeModel: ['LWV007'],
1793
+ model: '9290030523',
1794
+ vendor: 'Philips',
1795
+ description: 'Hue white filament Edison ST72 LED',
1796
+ extend: philips.extend.light_onoff_brightness(),
1797
+ },
1791
1798
  {
1792
1799
  zigbeeModel: ['5055148P7'],
1793
1800
  model: '5055148P7',
@@ -7,5 +7,10 @@ module.exports = [
7
7
  vendor: 'Fischer & Honsel',
8
8
  description: 'LED Tischleuchte Beta Zig',
9
9
  extend: extend.light_onoff_brightness_colortemp_color({colorTempRange: [153, 370]}),
10
+ endpoint: (device) => {
11
+ // https://github.com/Koenkk/zigbee-herdsman-converters/issues/5463
12
+ const endpoint = device.endpoints.find((e) => e.inputClusters.includes(6)).ID;
13
+ return {'default': endpoint};
14
+ },
10
15
  },
11
16
  ];
package/devices/sonoff.js CHANGED
@@ -216,7 +216,7 @@ module.exports = [
216
216
  model: 'S40ZBTPB',
217
217
  vendor: 'SONOFF',
218
218
  description: '15A Zigbee smart plug',
219
- extend: extend.switch(),
219
+ extend: extend.switch({disablePowerOnBehavior: true}),
220
220
  fromZigbee: [fz.on_off_skip_duplicate_transaction],
221
221
  ota: ota.zigbeeOTA,
222
222
  configure: async (device, coordinatorEndpoint, logger) => {
package/lib/constants.js CHANGED
@@ -24,6 +24,7 @@ const thermostatControlSequenceOfOperations = {
24
24
  const thermostatProgrammingOperationModes = {
25
25
  0: 'setpoint',
26
26
  1: 'schedule',
27
+ 3: 'schedule_with_preheat',
27
28
  4: 'eco',
28
29
  };
29
30
 
package/lib/exposes.js CHANGED
@@ -626,7 +626,7 @@ module.exports = {
626
626
  power_outage_memory: () => new Binary('power_outage_memory', access.ALL, true, false).withDescription('Enable/disable the power outage memory, this recovers the on/off mode after power failure'),
627
627
  presence: () => new Binary('presence', access.STATE, true, false).withDescription('Indicates whether the device detected presence'),
628
628
  pressure: () => new Numeric('pressure', access.STATE).withUnit('hPa').withDescription('The measured atmospheric pressure'),
629
- programming_operation_mode: () => new Enum('programming_operation_mode', access.ALL, ['setpoint', 'schedule', 'eco']).withDescription('Controls how programming affects the thermostat. Possible values: setpoint (only use specified setpoint), schedule (follow programmed setpoint schedule). Changing this value does not clear programmed schedules.'),
629
+ programming_operation_mode: () => new Enum('programming_operation_mode', access.ALL, ['setpoint', 'schedule', 'schedule_with_preheat', 'eco']).withDescription('Controls how programming affects the thermostat. Possible values: setpoint (only use specified setpoint), schedule (follow programmed setpoint schedule), schedule_with_preheat (follow programmed setpoint schedule with pre-heating). Changing this value does not clear programmed schedules.'),
630
630
  smoke: () => new Binary('smoke', access.STATE, true, false).withDescription('Indicates whether the device detected smoke'),
631
631
  soil_moisture: () => new Numeric('soil_moisture', access.STATE).withUnit('%').withDescription('Measured soil moisture value'),
632
632
  sos: () => new Binary('sos', access.STATE, true, false).withDescription('SOS alarm'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-herdsman-converters",
3
- "version": "15.0.62",
3
+ "version": "15.0.63",
4
4
  "description": "Collection of device converters to be used with zigbee-herdsman",
5
5
  "main": "index.js",
6
6
  "files": [