homebridge-tasmota-control 1.4.0-beta.5 → 1.4.0-beta.7

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": "1.4.0-beta.5",
4
+ "version": "1.4.0-beta.7",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -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,7 +1261,7 @@ 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 = powerStatus.includes('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
 
@@ -1290,7 +1291,7 @@ class TasmotaDevice extends EventEmitter {
1290
1291
  //log info
1291
1292
  if (!this.disableLogInfo) {
1292
1293
  this.emit('info', `${friendlyName}, state: ${power ? 'ON' : 'OFF'}`);
1293
- //this.emit('info', `${friendlyName}, direction: ${direction} %`);
1294
+ //this.emit('info', `${friendlyName}, direction: ${direction}`);
1294
1295
  this.emit('info', `${friendlyName}, speed: ${speed}`);
1295
1296
  }
1296
1297
  }
@@ -2271,7 +2272,7 @@ class TasmotaDevice extends EventEmitter {
2271
2272
  })
2272
2273
  .onSet(async (value) => {
2273
2274
  try {
2274
- const speed = `${ApiCommands.RotationSpeed}${value}`;
2275
+ const speed = `${ApiCommands.FanSpeed}${value}`;
2275
2276
  await this.axiosInstance(speed);
2276
2277
  const logInfo = this.disableLogInfo ? false : this.emit('info', `${friendlyName}, set speed: ${value}`);
2277
2278
  } catch (error) {