homebridge-tasmota-control 1.4.0-beta.4 → 1.4.0-beta.6

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.4",
4
+ "version": "1.4.0-beta.6",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -1092,8 +1092,8 @@ class TasmotaDevice extends EventEmitter {
1092
1092
  this.emit('info', `${friendlyName}, state: ${power ? 'ON' : 'OFF'}`);
1093
1093
  const logInfo = brightnessType === 0 ? false : this.emit('info', `${friendlyName}, brightness: ${bright} %`);
1094
1094
  const logInfo1 = colorTemperature === false ? false : this.emit('info', `${friendlyName}, color temperatur: ${colorTemperature}`);
1095
- const logInfo2 = hue === false ? false : this.emit('info', `${friendlyName}, hue: ${hue} %`);
1096
- const logInfo3 = saturation === false ? false : this.emit('info', `${friendlyName}, saturation: ${saturation} %`);
1095
+ const logInfo2 = hue === false ? false : this.emit('info', `${friendlyName}, hue: ${hue}`);
1096
+ const logInfo3 = saturation === false ? false : this.emit('info', `${friendlyName}, saturation: ${saturation}`);
1097
1097
  }
1098
1098
  }
1099
1099
  }
@@ -1260,7 +1260,8 @@ class TasmotaDevice extends EventEmitter {
1260
1260
  for (let i = 0; i < relaysCount; i++) {
1261
1261
  const friendlyName = this.friendlyNames[i];
1262
1262
  const powerNr = i + 1;
1263
- const powerKey = relaysCount === 1 ? 'POWER1' : `POWER${powerNr}`;
1263
+ const power1 = powerStatus.includes('POWER1');
1264
+ const powerKey = relaysCount === 1 ? (power1 ? 'POWER1' : 'POWER') : `POWER${powerNr}`;
1264
1265
  const power = powerStatus[powerKey] === 'ON';
1265
1266
 
1266
1267
  const direction = statusSts.direction ?? 0;
@@ -1271,7 +1272,8 @@ class TasmotaDevice extends EventEmitter {
1271
1272
  friendlyName: friendlyName,
1272
1273
  power: power,
1273
1274
  direction: direction,
1274
- speed: speed
1275
+ speed: speed,
1276
+ power1: power1
1275
1277
  };
1276
1278
  this.fans.push(fan);
1277
1279
 
@@ -2172,7 +2174,7 @@ class TasmotaDevice extends EventEmitter {
2172
2174
  value = await this.scaleValue(value, 140, 500, 153, 500);
2173
2175
  const colorTemperature = `${ApiCommands.ColorTemperature}${value}`; //153..500
2174
2176
  await this.axiosInstance(colorTemperature);
2175
- const logInfo = this.disableLogInfo ? false : this.emit('info', `${friendlyName}, set color temperatur: ${value} °`);
2177
+ const logInfo = this.disableLogInfo ? false : this.emit('info', `${friendlyName}, set color temperatur: ${value}`);
2176
2178
  } catch (error) {
2177
2179
  this.emit('warn', `set color temperatur error: ${error}`);
2178
2180
  }
@@ -2188,7 +2190,7 @@ class TasmotaDevice extends EventEmitter {
2188
2190
  try {
2189
2191
  const hue = `${ApiCommands.HSBHue}${value}`; //0..360
2190
2192
  await this.axiosInstance(hue);
2191
- const logInfo = this.disableLogInfo ? false : this.emit('info', `${friendlyName}, set hue: ${value} %`);
2193
+ const logInfo = this.disableLogInfo ? false : this.emit('info', `${friendlyName}, set hue: ${value}`);
2192
2194
  } catch (error) {
2193
2195
  this.emit('warn', `set hue error: ${error}`);
2194
2196
  }
@@ -2204,7 +2206,7 @@ class TasmotaDevice extends EventEmitter {
2204
2206
  try {
2205
2207
  const saturation = `${ApiCommands.HSBSaturation}${value}`; //0..100
2206
2208
  await this.axiosInstance(saturation);
2207
- const logInfo = this.disableLogInfo ? false : this.emit('info', `set saturation: ${value} °`);
2209
+ const logInfo = this.disableLogInfo ? false : this.emit('info', `set saturation: ${value}`);
2208
2210
  } catch (error) {
2209
2211
  this.emit('warn', `set saturation error: ${error}`);
2210
2212
  }
@@ -2233,8 +2235,8 @@ class TasmotaDevice extends EventEmitter {
2233
2235
  .onSet(async (state) => {
2234
2236
  try {
2235
2237
  const relayNr = i + 1;
2236
- const powerOn = this.fans.length === 1 ? ApiCommands.PowerOn : `${ApiCommands.Power}${relayNr}${ApiCommands.On}`;
2237
- const powerOff = this.fans.length === 1 ? ApiCommands.PowerOff : `${ApiCommands.Power}${relayNr}${ApiCommands.Off}`;
2238
+ const powerOn = this.fans.length === 1 ? (this.fans[i].power1 ? `${ApiCommands.Power}${relayNr}${ApiCommands.On}` : ApiCommands.PowerOn) : `${ApiCommands.Power}${relayNr}${ApiCommands.On}`;
2239
+ const powerOff = this.fans.length === 1 ? (this.fans[i].power1 ? `${ApiCommands.Power}${relayNr}${ApiCommands.Off}` : ApiCommands.PowerOff) : `${ApiCommands.Power}${relayNr}${ApiCommands.Off}`;
2238
2240
  state = state ? powerOn : powerOff;
2239
2241
 
2240
2242
  await this.axiosInstance(state);
@@ -2269,7 +2271,7 @@ class TasmotaDevice extends EventEmitter {
2269
2271
  })
2270
2272
  .onSet(async (value) => {
2271
2273
  try {
2272
- const speed = `${ApiCommands.RotationSpeed}${value}`;
2274
+ const speed = `${ApiCommands.FanSpeed}${value}`;
2273
2275
  await this.axiosInstance(speed);
2274
2276
  const logInfo = this.disableLogInfo ? false : this.emit('info', `${friendlyName}, set speed: ${value}`);
2275
2277
  } catch (error) {