homebridge-tasmota-control 0.7.2-beta.1 → 0.7.2-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Tasmota Control",
3
3
  "name": "homebridge-tasmota-control",
4
- "version": "0.7.2-beta.1",
4
+ "version": "0.7.2-beta.2",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -126,22 +126,23 @@ class TasmotaDevice {
126
126
  const addressMac = deviceInfo.StatusNET.Mac;
127
127
 
128
128
  //status sns
129
- const sensorTypes = CONSTANS.StatusSNS;
130
- const sensor = Object.entries(deviceInfo.StatusSNS)
131
- .filter(([key]) => sensorTypes.includes(key))
132
- .reduce((obj, [key, value]) => {
133
- obj[key] = value;
134
- return obj;
135
- }, {});
136
-
137
- const debug3 = this.enableDebugMode ? this.log(`Device: ${this.host} ${this.name}, debug sensors: ${JSON.stringify(sensor, null, 2)}`) : false;
138
- for (const [key, value] of Object.entries(sensor)) {
139
- const debug = this.enableDebugMode ? this.log(`Device: ${this.host} ${this.name}, debug key: ${key} value: ${JSON.stringify(value, null, 2)}`) : false;
140
- const obj = {
141
- 'name': key,
142
- 'data': value
129
+ const statusSNSSupported = deviceInfoKeys.includes('StatusSNS') ?? false;
130
+ if (statusSNSSupported) {
131
+ const sensorTypes = CONSTANS.StatusSNS;
132
+ const sensor = Object.entries(deviceInfo.StatusSNS)
133
+ .filter(([key]) => sensorTypes.some(type => key.includes(type)))
134
+ .reduce((obj, [key, value]) => {
135
+ obj[key] = value;
136
+ return obj;
137
+ }, {});
138
+
139
+ for (const [key, value] of Object.entries(sensor)) {
140
+ const obj = {
141
+ 'name': key,
142
+ 'data': value
143
+ }
144
+ this.sensors.push(obj);
143
145
  }
144
- this.sensors.push(obj);
145
146
  }
146
147
  const sensorsCount = this.sensors.length;
147
148