homebridge-tasmota-control 1.6.1-beta.15 → 1.6.1-beta.17

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/sensors.js +13 -11
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.1-beta.15",
4
+ "version": "1.6.1-beta.17",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/sensors.js CHANGED
@@ -162,17 +162,19 @@ class Sensors extends EventEmitter {
162
162
  this.sensorAmbientLightServices?.[i]?.Characteristic?.CurrentAmbientLightLevel?.updateCharacteristic(Characteristic.CurrentAmbientLightLevel, sensor.ambientLight);
163
163
  this.sensorMotionServices?.[i]?.Characteristic?.MotionDetected?.updateCharacteristic(Characteristic.MotionDetected, sensor.motion);
164
164
 
165
-
166
165
  //energy
167
- const fields = [
168
- 'Power', 'ApparentPower', 'ReactivePower', 'EnergyToday', 'EnergyLastDay',
169
- 'EnergyLifetime', 'Current', 'Voltage', 'Factor', 'Frequency', 'ReadingTime'
170
- ];
171
- const characteristic = this.sensorEnergyServices?.[i]?.Characteristic;
172
- for (const key of fields) {
173
- characteristic?.[key]?.updateCharacteristic(Characteristic[key], sensor[key.toLowerCase()]);
174
- }
175
-
166
+ this.sensorEnergyServices?.[i]
167
+ ?.Characteristic?.Power?.updateCharacteristic(Characteristic.MotionDetected, sensor.power)
168
+ .Characteristic?.ApparentPower?.updateCharacteristic(Characteristic.MotionDetected, sensor.apparentPower)
169
+ .Characteristic?.ReactivePower?.updateCharacteristic(Characteristic.MotionDetected, sensor.reactivePower)
170
+ .Characteristic?.EnergyToday?.updateCharacteristic(Characteristic.MotionDetected, sensor.energyToday)
171
+ .Characteristic?.EnergyLastDay?.updateCharacteristic(Characteristic.MotionDetected, sensor.energyLastDay)
172
+ .Characteristic?.EnergyLifetime?.updateCharacteristic(Characteristic.MotionDetected, sensor.energyLifetime)
173
+ .Characteristic?.Current?.updateCharacteristic(Characteristic.MotionDetected, sensor.current)
174
+ .Characteristic?.Voltage?.updateCharacteristic(Characteristic.MotionDetected, sensor.voltage)
175
+ .Characteristic?.Factor?.updateCharacteristic(Characteristic.MotionDetected, sensor.factor)
176
+ .Characteristic?.Frequency?.updateCharacteristic(Characteristic.MotionDetected, sensor.frequency)
177
+ .Characteristic?.ReadingTime?.updateCharacteristic(Characteristic.MotionDetected, sensor.readingTime);
176
178
  }
177
179
  }
178
180
  }
@@ -263,7 +265,7 @@ class Sensors extends EventEmitter {
263
265
  let i = 0;
264
266
  for (const sensor of this.sensors) {
265
267
  const sensorName = sensor.name;
266
- if (sensor.temperature) {
268
+ if (sensor.temperature !== undefined) {
267
269
  const debug = this.enableDebugMode ? this.emit('debug', `Prepare Temperature Sensor Services`) : false;
268
270
  const serviceName = this.sensorsNamePrefix ? `${accessoryName} ${sensorName} Temperature` : `${sensorName} Temperature`;
269
271
  const sensorTemperatureService = accessory.addService(Service.TemperatureSensor, serviceName, `Temperature Sensor ${i}`);