homebridge-tasmota-control 1.6.2-beta.4 → 1.6.2-beta.6
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/package.json +1 -1
- package/src/sensors.js +26 -22
package/package.json
CHANGED
package/src/sensors.js
CHANGED
|
@@ -137,36 +137,40 @@ class Sensors extends EventEmitter {
|
|
|
137
137
|
this.sensors.push(obj);
|
|
138
138
|
|
|
139
139
|
//update characteristics
|
|
140
|
-
this.sensorTemperatureServices?.[i]?.Characteristic
|
|
141
|
-
this.sensorReferenceTemperatureServices?.[i]?.Characteristic
|
|
142
|
-
this.sensorObjTemperatureServices?.[i]?.Characteristic
|
|
143
|
-
this.sensorAmbTemperatureServices?.[i]?.Characteristic
|
|
144
|
-
this.sensorDewPointTemperatureServices?.[i].Characteristic
|
|
145
|
-
this.sensorHumidityServices?.[i]?.Characteristic
|
|
146
|
-
this.sensorCarbonDioxydeServices?.[i]?.Characteristic
|
|
147
|
-
this.sensorCarbonDioxydeServices?.[i]?.Characteristic
|
|
148
|
-
this.sensorCarbonDioxydeServices?.[i]?.Characteristic
|
|
149
|
-
this.sensorAmbientLightServices?.[i]?.Characteristic
|
|
150
|
-
this.sensorMotionServices?.[i]?.Characteristic
|
|
140
|
+
this.sensorTemperatureServices?.[i]?.Characteristic?.CurrentTemperature?.updateCharacteristic(Characteristic.CurrentTemperature, obj.temperature);
|
|
141
|
+
this.sensorReferenceTemperatureServices?.[i]?.Characteristic?.CurrentTemperature?.updateCharacteristic(Characteristic.CurrentTemperature, obj.referenceTemperature);
|
|
142
|
+
this.sensorObjTemperatureServices?.[i]?.Characteristic?.CurrentTemperature?.updateCharacteristic(Characteristic.CurrentTemperature, obj.objTemperature);
|
|
143
|
+
this.sensorAmbTemperatureServices?.[i]?.Characteristic?.CurrentTemperature?.updateCharacteristic(Characteristic.CurrentTemperature, obj.ambTemperature);
|
|
144
|
+
this.sensorDewPointTemperatureServices?.[i].Characteristic.CurrentTemperature?.updateCharacteristic(Characteristic.CurrentTemperature, obj.dewPointTemperature);
|
|
145
|
+
this.sensorHumidityServices?.[i]?.Characteristic?.CurrentRelativeHumidity?.updateCharacteristic(Characteristic.CurrentRelativeHumidity, obj.humidity);
|
|
146
|
+
this.sensorCarbonDioxydeServices?.[i]?.Characteristic?.CarbonDioxideDetected?.updateCharacteristic(Characteristic.CarbonDioxideDetected, obj.carbonDioxyde > 1000);
|
|
147
|
+
this.sensorCarbonDioxydeServices?.[i]?.Characteristic?.CarbonDioxideLevel?.updateCharacteristic(Characteristic.CarbonDioxideLevel, obj.carbonDioxyde);
|
|
148
|
+
this.sensorCarbonDioxydeServices?.[i]?.Characteristic?.CarbonDioxidePeakLevel?.updateCharacteristic(Characteristic.CarbonDioxidePeakLevel, obj.carbonDioxyde);
|
|
149
|
+
this.sensorAmbientLightServices?.[i]?.Characteristic?.CurrentAmbientLightLevel?.updateCharacteristic(Characteristic.CurrentAmbientLightLevel, obj.ambientLight);
|
|
150
|
+
this.sensorMotionServices?.[i]?.Characteristic?.MotionDetected?.updateCharacteristic(Characteristic.MotionDetected, obj.motion);
|
|
151
151
|
|
|
152
152
|
//energy
|
|
153
153
|
const isEnergy = key === 'ENERGY';
|
|
154
154
|
if (isEnergy) {
|
|
155
155
|
this.emit('warn', `Energy: ${JSON.stringify(obj, null, 2)}`)
|
|
156
156
|
//update characteristics
|
|
157
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
158
|
-
this.
|
|
159
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
160
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
161
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
162
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
163
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
164
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
165
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
166
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
167
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
157
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.Power?.updateCharacteristic(Characteristic.Power, obj.power);
|
|
158
|
+
this.emit('warn', `Energy: ${JSON.stringify(obj, null, 2)}`)
|
|
159
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.ApparentPower?.updateCharacteristic(Characteristic.ApparentPower, obj.apparentPower);
|
|
160
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.ReactivePower?.updateCharacteristic(Characteristic.ReactivePower, obj.reactivePower);
|
|
161
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.EnergyToday?.updateCharacteristic(Characteristic.EnergyToday, obj.energyToday);
|
|
162
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.EnergyLastDay?.updateCharacteristic(Characteristic.EnergyLastDay, obj.energyLastDay);
|
|
163
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.EnergyLifetime?.updateCharacteristic(Characteristic.EnergyLifetime, obj.energyLifetime);
|
|
164
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.Current?.updateCharacteristic(Characteristic.Current, obj.current);
|
|
165
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.Voltage?.updateCharacteristic(Characteristic.Voltage, obj.voltage);
|
|
166
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.Factor?.updateCharacteristic(Characteristic.Factor, obj.factor);
|
|
167
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.Frequency?.updateCharacteristic(Characteristic.Frequency, obj.frequency);
|
|
168
|
+
this.sensorEnergyServices?.[i]?.Characteristic?.ReadingTime?.updateCharacteristic(Characteristic.ReadingTime, obj.time);
|
|
168
169
|
}
|
|
169
170
|
|
|
171
|
+
const emit = this.sensorEnergyServices?.[i]?.Characteristic?.Power ? this.emit('warn', `Power: ${JSON.stringify(obj, null, 2)}`) : false;
|
|
172
|
+
|
|
173
|
+
|
|
170
174
|
const debug1 = this.enableDebugMode ? this.emit('debug', `Sensor: ${JSON.stringify(obj, null, 2)}`) : false;
|
|
171
175
|
this.emit('warn', `Sensor: ${JSON.stringify(obj, null, 2)}`)
|
|
172
176
|
i++;
|