homebridge-tasmota-control 1.6.2-beta.1 → 1.6.2-beta.3
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 +31 -36
package/package.json
CHANGED
package/src/sensors.js
CHANGED
|
@@ -114,13 +114,28 @@ class Sensors extends EventEmitter {
|
|
|
114
114
|
gas: sensorData.Gas,
|
|
115
115
|
carbonDioxyde: sensorData.CarbonDioxyde,
|
|
116
116
|
ambientLight: sensorData.Ambient,
|
|
117
|
-
motion: sensorData.Motion
|
|
117
|
+
motion: sensorData.Motion,
|
|
118
|
+
power: sensorData.Power,
|
|
119
|
+
apparentPower: sensorData.ApparentPower,
|
|
120
|
+
reactivePower: sensorData.ReactivePower,
|
|
121
|
+
energyToday: sensorData.Today,
|
|
122
|
+
energyLastDay: sensorData.Yesterday,
|
|
123
|
+
energyLifetime: sensorData.Total,
|
|
124
|
+
energyLifeTimeStartTime: sensorData.TotalStartTime,
|
|
125
|
+
energyPeriod: sensorData.Period,
|
|
126
|
+
current: sensorData.Current,
|
|
127
|
+
voltage: sensorData.Voltage,
|
|
128
|
+
factor: sensorData.Factor,
|
|
129
|
+
frequency: sensorData.Frequency,
|
|
130
|
+
load: sensorData.Load
|
|
118
131
|
}
|
|
119
132
|
if (obj.tempUnit === 'C') {
|
|
120
133
|
obj.tempUnit = '°C';
|
|
121
134
|
}
|
|
122
135
|
|
|
123
|
-
|
|
136
|
+
//push to array
|
|
137
|
+
this.sensors.push(obj);
|
|
138
|
+
|
|
124
139
|
//update characteristics
|
|
125
140
|
this.sensorTemperatureServices?.[i]?.Characteristic?.CurrentTemperature?.updateCharacteristic(Characteristic.CurrentTemperature, obj.temperature);
|
|
126
141
|
this.sensorReferenceTemperatureServices?.[i]?.Characteristic?.CurrentTemperature?.updateCharacteristic(Characteristic.CurrentTemperature, obj.referenceTemperature);
|
|
@@ -136,44 +151,24 @@ class Sensors extends EventEmitter {
|
|
|
136
151
|
|
|
137
152
|
//energy
|
|
138
153
|
const isEnergy = key === 'ENERGY';
|
|
139
|
-
const energy = {
|
|
140
|
-
power: sensorData.Power,
|
|
141
|
-
apparentPower: sensorData.ApparentPower,
|
|
142
|
-
reactivePower: sensorData.ReactivePower,
|
|
143
|
-
energyToday: sensorData.Today,
|
|
144
|
-
energyLastDay: sensorData.Yesterday,
|
|
145
|
-
energyLifetime: sensorData.Total,
|
|
146
|
-
energyLifeTimeStartTime: sensorData.TotalStartTime,
|
|
147
|
-
energyPeriod: sensorData.Period,
|
|
148
|
-
current: sensorData.Current,
|
|
149
|
-
voltage: sensorData.Voltage,
|
|
150
|
-
factor: sensorData.Factor,
|
|
151
|
-
frequency: sensorData.Frequency,
|
|
152
|
-
load: sensorData.Load,
|
|
153
|
-
}
|
|
154
|
-
|
|
155
154
|
if (isEnergy) {
|
|
156
|
-
this.emit('warn', `Energy: ${JSON.stringify(
|
|
155
|
+
this.emit('warn', `Energy: ${JSON.stringify(obj, null, 2)}`)
|
|
157
156
|
//update characteristics
|
|
158
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.Power?.updateCharacteristic(Characteristic.Power,
|
|
159
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.ApparentPower?.updateCharacteristic(Characteristic.ApparentPower,
|
|
160
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.ReactivePower?.updateCharacteristic(Characteristic.ReactivePower,
|
|
161
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.EnergyToday?.updateCharacteristic(Characteristic.EnergyToday,
|
|
162
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.EnergyLastDay?.updateCharacteristic(Characteristic.EnergyLastDay,
|
|
163
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.EnergyLifetime?.updateCharacteristic(Characteristic.EnergyLifetime,
|
|
164
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.Current?.updateCharacteristic(Characteristic.Current,
|
|
165
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.Voltage?.updateCharacteristic(Characteristic.Voltage,
|
|
166
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.Factor?.updateCharacteristic(Characteristic.Factor,
|
|
167
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.Frequency?.updateCharacteristic(Characteristic.Frequency,
|
|
168
|
-
this.sensorEnergyServices?.[i]?.Characteristic?.ReadingTime?.updateCharacteristic(Characteristic.ReadingTime,
|
|
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);
|
|
169
168
|
}
|
|
170
169
|
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
this.emit('warn', `Sensor: ${JSON.stringify(sensor, null, 2)}`)
|
|
174
|
-
|
|
175
|
-
//push to array
|
|
176
|
-
this.sensors.push(sensor);
|
|
170
|
+
const debug1 = this.enableDebugMode ? this.emit('debug', `Sensor: ${JSON.stringify(obj, null, 2)}`) : false;
|
|
171
|
+
this.emit('warn', `Sensor: ${JSON.stringify(obj, null, 2)}`)
|
|
177
172
|
i++;
|
|
178
173
|
}
|
|
179
174
|
this.sensorsCount = this.sensors.length;
|