homebridge-tasmota-control 1.5.1-beta.0 → 1.5.1-beta.2
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/deviceinfo.js +7 -0
- package/src/sensors.js +6 -6
package/package.json
CHANGED
package/src/deviceinfo.js
CHANGED
|
@@ -54,6 +54,13 @@ class DeviceInfo extends EventEmitter {
|
|
|
54
54
|
//status SNS
|
|
55
55
|
const statusSns = deviceInfo.StatusSNS ?? {};
|
|
56
56
|
const statusSnsKeys = Object.keys(statusSns);
|
|
57
|
+
const sensor = Object.entries(statusSns)
|
|
58
|
+
.filter(([key]) => SensorKeys.some(type => key.includes(type)))
|
|
59
|
+
.reduce((obj, [key, value]) => {
|
|
60
|
+
obj[key] = value;
|
|
61
|
+
return obj;
|
|
62
|
+
}, {});
|
|
63
|
+
this.emit('debug', `Sensor: ${JSON.stringify(sensor, null, 2)}`)
|
|
57
64
|
|
|
58
65
|
//status STS
|
|
59
66
|
const statusSts = deviceInfo.StatusSTS ?? {};
|
package/src/sensors.js
CHANGED
|
@@ -87,14 +87,14 @@ class Sensors extends EventEmitter {
|
|
|
87
87
|
//status SNS
|
|
88
88
|
if (statusSnsSupported) {
|
|
89
89
|
this.sensors = [];
|
|
90
|
-
const
|
|
90
|
+
const sensorData = Object.entries(statusSns)
|
|
91
91
|
.filter(([key]) => SensorKeys.some(type => key.includes(type)))
|
|
92
92
|
.reduce((obj, [key, value]) => {
|
|
93
93
|
obj[key] = value;
|
|
94
94
|
return obj;
|
|
95
95
|
}, {});
|
|
96
96
|
|
|
97
|
-
for (const [key, value] of Object.entries(
|
|
97
|
+
for (const [key, value] of Object.entries(sensorData)) {
|
|
98
98
|
const sensorData = value;
|
|
99
99
|
|
|
100
100
|
//sensor
|
|
@@ -114,7 +114,7 @@ class Sensors extends EventEmitter {
|
|
|
114
114
|
gas: sensorData.Gas,
|
|
115
115
|
carbonDioxyde: sensorData.CarbonDioxyde,
|
|
116
116
|
ambientLight: sensorData.Ambient,
|
|
117
|
-
motion: sensorData.Motion === 'ON'
|
|
117
|
+
motion: sensorData.Motion ? sensorData.Motion === 'ON' : null
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
//energy
|
|
@@ -132,11 +132,11 @@ class Sensors extends EventEmitter {
|
|
|
132
132
|
current: sensorData.Current,
|
|
133
133
|
load: sensorData.Load,
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
this.emit('debug', `Sensors status: ${JSON.stringify(
|
|
135
|
+
const sensor = key === 'ENERGY' ? { ...obj, ...obj1 } : obj;
|
|
136
|
+
this.emit('debug', `Sensors status: ${JSON.stringify(sensor, null, 2)}`)
|
|
137
137
|
|
|
138
138
|
//push to array
|
|
139
|
-
this.sensors.push(
|
|
139
|
+
this.sensors.push(sensor);
|
|
140
140
|
}
|
|
141
141
|
this.sensorsCount = this.sensors.length;
|
|
142
142
|
|