homebridge-tasmota-control 1.6.2-beta.2 → 1.6.2-beta.4
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 +25 -25
package/package.json
CHANGED
package/src/sensors.js
CHANGED
|
@@ -133,42 +133,42 @@ class Sensors extends EventEmitter {
|
|
|
133
133
|
obj.tempUnit = '°C';
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
//push to array
|
|
137
|
+
this.sensors.push(obj);
|
|
138
|
+
|
|
136
139
|
//update characteristics
|
|
137
|
-
this.sensorTemperatureServices?.[i]?.Characteristic
|
|
138
|
-
this.sensorReferenceTemperatureServices?.[i]?.Characteristic
|
|
139
|
-
this.sensorObjTemperatureServices?.[i]?.Characteristic
|
|
140
|
-
this.sensorAmbTemperatureServices?.[i]?.Characteristic
|
|
141
|
-
this.sensorDewPointTemperatureServices?.[i]
|
|
142
|
-
this.sensorHumidityServices?.[i]?.Characteristic
|
|
143
|
-
this.sensorCarbonDioxydeServices?.[i]?.Characteristic
|
|
144
|
-
this.sensorCarbonDioxydeServices?.[i]?.Characteristic
|
|
145
|
-
this.sensorCarbonDioxydeServices?.[i]?.Characteristic
|
|
146
|
-
this.sensorAmbientLightServices?.[i]?.Characteristic
|
|
147
|
-
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);
|
|
148
151
|
|
|
149
152
|
//energy
|
|
150
153
|
const isEnergy = key === 'ENERGY';
|
|
151
154
|
if (isEnergy) {
|
|
152
155
|
this.emit('warn', `Energy: ${JSON.stringify(obj, null, 2)}`)
|
|
153
156
|
//update characteristics
|
|
154
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
155
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
156
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
157
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
158
|
-
this.sensorEnergyServices?.[i]?.Characteristic
|
|
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
|
|
157
|
+
this.sensorEnergyServices?.[i]?.Characteristic.Power?.updateCharacteristic(Characteristic.Power, obj.power);
|
|
158
|
+
this.sensorEnergyServices?.[i]?.Characteristic.ApparentPower?.updateCharacteristic(Characteristic.ApparentPower, obj.apparentPower);
|
|
159
|
+
this.sensorEnergyServices?.[i]?.Characteristic.ReactivePower?.updateCharacteristic(Characteristic.ReactivePower, obj.reactivePower);
|
|
160
|
+
this.sensorEnergyServices?.[i]?.Characteristic.EnergyToday?.updateCharacteristic(Characteristic.EnergyToday, obj.energyToday);
|
|
161
|
+
this.sensorEnergyServices?.[i]?.Characteristic.EnergyLastDay?.updateCharacteristic(Characteristic.EnergyLastDay, obj.energyLastDay);
|
|
162
|
+
this.sensorEnergyServices?.[i]?.Characteristic.EnergyLifetime?.updateCharacteristic(Characteristic.EnergyLifetime, obj.energyLifetime);
|
|
163
|
+
this.sensorEnergyServices?.[i]?.Characteristic.Current?.updateCharacteristic(Characteristic.Current, obj.current);
|
|
164
|
+
this.sensorEnergyServices?.[i]?.Characteristic.Voltage?.updateCharacteristic(Characteristic.Voltage, obj.voltage);
|
|
165
|
+
this.sensorEnergyServices?.[i]?.Characteristic.Factor?.updateCharacteristic(Characteristic.Factor, obj.factor);
|
|
166
|
+
this.sensorEnergyServices?.[i]?.Characteristic.Frequency?.updateCharacteristic(Characteristic.Frequency, obj.frequency);
|
|
167
|
+
this.sensorEnergyServices?.[i]?.Characteristic.ReadingTime?.updateCharacteristic(Characteristic.ReadingTime, obj.time);
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
const debug1 = this.enableDebugMode ? this.emit('debug', `Sensor: ${JSON.stringify(obj, null, 2)}`) : false;
|
|
168
171
|
this.emit('warn', `Sensor: ${JSON.stringify(obj, null, 2)}`)
|
|
169
|
-
|
|
170
|
-
//push to array
|
|
171
|
-
this.sensors.push(obj);
|
|
172
172
|
i++;
|
|
173
173
|
}
|
|
174
174
|
this.sensorsCount = this.sensors.length;
|