homebridge-tasmota-control 1.6.15-beta.25 → 1.6.15-beta.27

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.
package/index.js CHANGED
@@ -33,9 +33,7 @@ class tasmotaPlatform {
33
33
 
34
34
  //check accessory is enabled
35
35
  const disableAccessory = device.disableAccessory || false;
36
- if (disableAccessory) {
37
- continue;
38
- }
36
+ if (disableAccessory) continue;
39
37
 
40
38
  const deviceName = device.name;
41
39
  const host = device.host;
@@ -53,7 +51,7 @@ class tasmotaPlatform {
53
51
  const refreshInterval = device.refreshInterval * 1000 || 5000;
54
52
  const enableDebugMode = device.enableDebugMode || false;
55
53
  const logLevel = {
56
- debug: enableDebugMode,
54
+ debug: device.enableDebugMode,
57
55
  info: !device.disableLogInfo,
58
56
  success: !device.disableLogSuccess,
59
57
  warn: !device.disableLogWarn,
@@ -71,7 +69,7 @@ class tasmotaPlatform {
71
69
 
72
70
  try {
73
71
  //get device info
74
- const deviceInfo = new DeviceInfo(url, auth, user, passwd, deviceName, loadNameFromDevice, enableDebugMode, refreshInterval)
72
+ const deviceInfo = new DeviceInfo(url, auth, user, passwd, deviceName, loadNameFromDevice, enableDebugMode)
75
73
  .on('debug', (msg) => logLevel.debug && log.info(`Device: ${host} ${deviceName}, debug: ${msg}`))
76
74
  .on('warn', (msg) => logLevel.warn && log.warn(`Device: ${host} ${deviceName}, ${msg}`))
77
75
  .on('error', (msg) => logLevel.error && log.error(`Device: ${host} ${deviceName}, ${msg}`));
@@ -106,7 +104,7 @@ class tasmotaPlatform {
106
104
  }
107
105
  });
108
106
  } catch (error) {
109
- log.error(`Device: ${host} ${deviceName}, Prepare files error: ${error}`);
107
+ if (logLevel.error) log.error(`Device: ${host} ${deviceName}, Prepare files error: ${error}`);
110
108
  return;
111
109
  }
112
110
 
@@ -146,7 +144,7 @@ class tasmotaPlatform {
146
144
  if (logLevel.success) log.success(`Device: ${host} ${deviceName}, Published as external accessory.`);
147
145
 
148
146
  await impulseGenerator.stop();
149
- await zone.startImpulseGenerator();
147
+ await deviceType.startImpulseGenerator();
150
148
  }
151
149
  } catch (error) {
152
150
  if (logLevel.error) log.error(`Device: ${host} ${deviceName}, ${error}, trying again.`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Tasmota Control",
3
3
  "name": "homebridge-tasmota-control",
4
- "version": "1.6.15-beta.25",
4
+ "version": "1.6.15-beta.27",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/deviceinfo.js CHANGED
@@ -3,7 +3,7 @@ import EventEmitter from 'events';
3
3
  import { ApiCommands, LightKeys, SensorKeys } from './constants.js';
4
4
 
5
5
  class DeviceInfo extends EventEmitter {
6
- constructor(url, auth, user, passwd, deviceName, loadNameFromDevice, enableDebugMode, refreshInterval) {
6
+ constructor(url, auth, user, passwd, deviceName, loadNameFromDevice, enableDebugMode) {
7
7
  super();
8
8
  this.name = deviceName
9
9
  this.loadNameFromDevice = loadNameFromDevice;
package/src/mielhvac.js CHANGED
@@ -806,7 +806,7 @@ class MiElHvac extends EventEmitter {
806
806
  try {
807
807
  const power = [MiElHVAC.PowerOff, MiElHVAC.PowerOn][state];
808
808
  await this.axiosInstance(power);
809
- const info = this.disableLogInfo ? false : this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
809
+ if (!this.disableLogInfo) this.emit('info', `Set power: ${state ? 'ON' : 'OFF'}`);
810
810
  } catch (error) {
811
811
  this.emit('warn', `Set power error: ${error}`);
812
812
  }
@@ -840,7 +840,7 @@ class MiElHvac extends EventEmitter {
840
840
  break;
841
841
  };
842
842
 
843
- const info = this.disableLogInfo ? false : this.emit('info', `Set operation mode: ${MiElHVAC.OperationMode[value]}`);
843
+ if (!this.disableLogInfo) this.emit('info', `Set operation mode: ${MiElHVAC.OperationMode[value]}`);
844
844
  } catch (error) {
845
845
  this.emit('warn', `Set operation mode error: ${error}`);
846
846
  }
@@ -887,7 +887,7 @@ class MiElHvac extends EventEmitter {
887
887
  //fan speed mode
888
888
  const fanSpeedMap = ['auto', 'quiet', '1', '2', '3', '4'][fanSpeed];
889
889
  await this.axiosInstance(MiElHVAC.SetFanSpeed[fanSpeedMap]);
890
- const info = this.disableLogInfo ? false : this.emit('info', `Set fan speed mode: ${MiElHVAC.FanSpeed[fanSpeedModeText]}`);
890
+ if (!this.disableLogInfo) this.emit('info', `Set fan speed mode: ${MiElHVAC.FanSpeed[fanSpeedModeText]}`);
891
891
  } catch (error) {
892
892
  this.emit('warn', `Set fan speed mode error: ${error}`);
893
893
  }
@@ -916,7 +916,7 @@ class MiElHvac extends EventEmitter {
916
916
  await this.axiosInstance(MiElHVAC.SetSwingH.swing);
917
917
  break;
918
918
  }
919
- const info = this.disableLogInfo ? false : this.emit('info', `Set air direction mode: ${MiElHVAC.SwingMode[value]}`);
919
+ if (!this.disableLogInfo) this.emit('info', `Set air direction mode: ${MiElHVAC.SwingMode[value]}`);
920
920
  } catch (error) {
921
921
  this.emit('warn', `Set vane swing mode error: ${error}`);
922
922
  }
@@ -941,7 +941,7 @@ class MiElHvac extends EventEmitter {
941
941
 
942
942
  const temp = `${MiElHVAC.SetTemp}${value}`
943
943
  await this.axiosInstance(temp);
944
- const info = this.disableLogInfo ? false : this.emit('info', `Set ${this.mielHvac.targetOperationMode === 2 ? 'temperature' : 'cooling threshold temperature'}: ${value}${this.mielHvac.temperatureUnit}`);
944
+ if (!this.disableLogInfo) this.emit('info', `Set ${this.mielHvac.targetOperationMode === 2 ? 'temperature' : 'cooling threshold temperature'}: ${value}${this.mielHvac.temperatureUnit}`);
945
945
  } catch (error) {
946
946
  this.emit('warn', `Set cooling threshold temperature error: ${error}`);
947
947
  }
@@ -966,7 +966,7 @@ class MiElHvac extends EventEmitter {
966
966
 
967
967
  const temp = `${MiElHVAC.SetTemp}${value}`
968
968
  await this.axiosInstance(temp);
969
- const info = this.disableLogInfo ? false : this.emit('info', `Set ${this.mielHvac.targetOperationMode === 1 ? 'temperature' : 'heating threshold temperature'}: ${value}${this.mielHvac.temperatureUnit}`);
969
+ if (!this.disableLogInfo) this.emit('info', `Set ${this.mielHvac.targetOperationMode === 1 ? 'temperature' : 'heating threshold temperature'}: ${value}${this.mielHvac.temperatureUnit}`);
970
970
  } catch (error) {
971
971
  this.emit('warn', `Set heating threshold temperature error: ${error}`);
972
972
  }
@@ -981,7 +981,7 @@ class MiElHvac extends EventEmitter {
981
981
  try {
982
982
  const lock = [MiElHVAC.SetProhibit.off, MiElHVAC.SetProhibit.all][value];
983
983
  await this.axiosInstance(lock);
984
- const info = this.disableLogInfo ? false : this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
984
+ if (!this.disableLogInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
985
985
  } catch (error) {
986
986
  this.emit('warn', `Set lock physical controls error: ${error}`);
987
987
  }
@@ -995,7 +995,7 @@ class MiElHvac extends EventEmitter {
995
995
  try {
996
996
  const unit = [MiElHVAC.SetDisplayUnit.c, MiElHVAC.SetDisplayUnit.f][value];
997
997
  //await this.axiosInstance(unit);
998
- const info = this.disableLogInfo ? false : this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
998
+ if (!this.disableLogInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
999
999
  } catch (error) {
1000
1000
  this.emit('warn', `Set temperature display unit error: ${error}`);
1001
1001
  }
package/src/sensors.js CHANGED
@@ -438,7 +438,7 @@ class Sensors extends EventEmitter {
438
438
  powerAndEnergyService.getCharacteristic(Characteristic.Power)
439
439
  .onGet(async () => {
440
440
  const value = sensor.power;
441
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} power: ${value} W`);
441
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} power: ${value} W`);
442
442
  return value;
443
443
  });
444
444
  }
@@ -446,7 +446,7 @@ class Sensors extends EventEmitter {
446
446
  powerAndEnergyService.getCharacteristic(Characteristic.ApparentPower)
447
447
  .onGet(async () => {
448
448
  const value = sensor.apparentPower;
449
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} apparent power: ${value} VA`);
449
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} apparent power: ${value} VA`);
450
450
  return value;
451
451
  });
452
452
  }
@@ -454,7 +454,7 @@ class Sensors extends EventEmitter {
454
454
  powerAndEnergyService.getCharacteristic(Characteristic.ReactivePower)
455
455
  .onGet(async () => {
456
456
  const value = sensor.reactivePower;
457
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} reactive power: ${value} VAr`);
457
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} reactive power: ${value} VAr`);
458
458
  return value;
459
459
  });
460
460
  }
@@ -462,7 +462,7 @@ class Sensors extends EventEmitter {
462
462
  powerAndEnergyService.getCharacteristic(Characteristic.EnergyToday)
463
463
  .onGet(async () => {
464
464
  const value = sensor.energyToday;
465
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} energy today: ${value} kWh`);
465
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} energy today: ${value} kWh`);
466
466
  return value;
467
467
  });
468
468
  }
@@ -470,7 +470,7 @@ class Sensors extends EventEmitter {
470
470
  powerAndEnergyService.getCharacteristic(Characteristic.EnergyLastDay)
471
471
  .onGet(async () => {
472
472
  const value = sensor.energyLastDay;
473
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} energy last day: ${value} kWh`);
473
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} energy last day: ${value} kWh`);
474
474
  return value;
475
475
  });
476
476
  }
@@ -478,7 +478,7 @@ class Sensors extends EventEmitter {
478
478
  powerAndEnergyService.getCharacteristic(Characteristic.EnergyLifetime)
479
479
  .onGet(async () => {
480
480
  const value = sensor.energyLifetime;
481
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} energy lifetime: ${value} kWh`);
481
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} energy lifetime: ${value} kWh`);
482
482
  return value;
483
483
  });
484
484
  }
@@ -486,7 +486,7 @@ class Sensors extends EventEmitter {
486
486
  powerAndEnergyService.getCharacteristic(Characteristic.Current)
487
487
  .onGet(async () => {
488
488
  const value = sensor.current;
489
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} current: ${value} A`);
489
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} current: ${value} A`);
490
490
  return value;
491
491
  });
492
492
  }
@@ -494,7 +494,7 @@ class Sensors extends EventEmitter {
494
494
  powerAndEnergyService.getCharacteristic(Characteristic.Voltage)
495
495
  .onGet(async () => {
496
496
  const value = sensor.voltage;
497
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} voltage: ${value} V`);
497
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} voltage: ${value} V`);
498
498
  return value;
499
499
  });
500
500
  }
@@ -502,7 +502,7 @@ class Sensors extends EventEmitter {
502
502
  powerAndEnergyService.getCharacteristic(Characteristic.Factor)
503
503
  .onGet(async () => {
504
504
  const value = sensor.factor;
505
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} power factor: ${value} cos φ`);
505
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} power factor: ${value} cos φ`);
506
506
  return value;
507
507
  });
508
508
  }
@@ -510,7 +510,7 @@ class Sensors extends EventEmitter {
510
510
  powerAndEnergyService.getCharacteristic(Characteristic.Freqency)
511
511
  .onGet(async () => {
512
512
  const value = sensor.frequency;
513
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} frequency: ${value} Hz`);
513
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} frequency: ${value} Hz`);
514
514
  return value;
515
515
  });
516
516
  }
@@ -518,7 +518,7 @@ class Sensors extends EventEmitter {
518
518
  powerAndEnergyService.getCharacteristic(Characteristic.ReadingTime)
519
519
  .onGet(async () => {
520
520
  const value = sensor.time;
521
- const info = this.disableLogInfo ? false : this.emit('info', `sensor: ${sensorName} last report: ${value}`);
521
+ if (!this.disableLogInfo) this.emit('info', `sensor: ${sensorName} last report: ${value}`);
522
522
  return value;
523
523
  });
524
524
  }