homebridge-tasmota-control 1.4.0-beta.6 → 1.4.0-beta.8
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/tasmotadevice.js +8 -8
package/package.json
CHANGED
package/src/tasmotadevice.js
CHANGED
|
@@ -154,7 +154,7 @@ class TasmotaDevice extends EventEmitter {
|
|
|
154
154
|
this.previousStateSwingH = 'center';
|
|
155
155
|
|
|
156
156
|
//fan
|
|
157
|
-
this.
|
|
157
|
+
this.fanDirection = 0;
|
|
158
158
|
this.fanSpeed = 1;
|
|
159
159
|
|
|
160
160
|
//axios instance
|
|
@@ -259,6 +259,7 @@ class TasmotaDevice extends EventEmitter {
|
|
|
259
259
|
//power status
|
|
260
260
|
const powerStatusData = await this.axiosInstance(ApiCommands.PowerStatus);
|
|
261
261
|
const powerStatus = powerStatusData.data ?? {};
|
|
262
|
+
const powerStatusKeys = Object.keys(powerStatus);
|
|
262
263
|
const debug = this.enableDebugMode ? this.emit('debug', `Power status: ${JSON.stringify(powerStatus, null, 2)}`) : false;
|
|
263
264
|
|
|
264
265
|
//sensor status
|
|
@@ -1260,12 +1261,11 @@ class TasmotaDevice extends EventEmitter {
|
|
|
1260
1261
|
for (let i = 0; i < relaysCount; i++) {
|
|
1261
1262
|
const friendlyName = this.friendlyNames[i];
|
|
1262
1263
|
const powerNr = i + 1;
|
|
1263
|
-
const power1 =
|
|
1264
|
+
const power1 = powerStatusKeys.includes('POWER1');
|
|
1264
1265
|
const powerKey = relaysCount === 1 ? (power1 ? 'POWER1' : 'POWER') : `POWER${powerNr}`;
|
|
1265
1266
|
const power = powerStatus[powerKey] === 'ON';
|
|
1266
|
-
|
|
1267
|
-
const
|
|
1268
|
-
const speed = statusSts.FanSpeed > 0 ? statusSts.FanSpeed : this.fanSpeed;
|
|
1267
|
+
const direction = statusSts.FanDirection ?? 0;
|
|
1268
|
+
const speed = statusSts.FanSpeed;
|
|
1269
1269
|
|
|
1270
1270
|
//push to array
|
|
1271
1271
|
const fan = {
|
|
@@ -1284,13 +1284,13 @@ class TasmotaDevice extends EventEmitter {
|
|
|
1284
1284
|
.updateCharacteristic(Characteristic.RotationSpeed, speed);
|
|
1285
1285
|
}
|
|
1286
1286
|
|
|
1287
|
-
this.
|
|
1287
|
+
this.fanDirection = direction;
|
|
1288
1288
|
this.fanSpeed = speed;
|
|
1289
1289
|
|
|
1290
1290
|
//log info
|
|
1291
1291
|
if (!this.disableLogInfo) {
|
|
1292
1292
|
this.emit('info', `${friendlyName}, state: ${power ? 'ON' : 'OFF'}`);
|
|
1293
|
-
//this.emit('info', `${friendlyName}, direction: ${direction}
|
|
1293
|
+
//this.emit('info', `${friendlyName}, direction: ${direction}`);
|
|
1294
1294
|
this.emit('info', `${friendlyName}, speed: ${speed}`);
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
@@ -2261,7 +2261,7 @@ class TasmotaDevice extends EventEmitter {
|
|
|
2261
2261
|
// });
|
|
2262
2262
|
fanService.getCharacteristic(Characteristic.RotationSpeed)
|
|
2263
2263
|
.setProps({
|
|
2264
|
-
minValue:
|
|
2264
|
+
minValue: 0,
|
|
2265
2265
|
maxValue: 3,
|
|
2266
2266
|
minStep: 1
|
|
2267
2267
|
})
|