homebridge-tasmota-control 0.6.2-beta.2 → 0.6.2-beta.4

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.6.2-beta.2",
4
+ "version": "0.6.2-beta.4",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -155,7 +155,7 @@ class TasmotaDevice {
155
155
 
156
156
  for (let i = 0; i < relaysCount; i++) {
157
157
  const statusKey = relaysCount === 1 ? 'POWER' : 'POWER' + (i + 1);
158
- const status = relaysStatus[statusKey] === 'ON'
158
+ const status = relaysStatus[statusKey] === 'ON' ?? false;
159
159
  this.relaysStete.push(status);
160
160
 
161
161
  //update characteristics
@@ -240,12 +240,13 @@ class TasmotaDevice {
240
240
 
241
241
  this.api.publishExternalAccessories(CONSTANS.PluginName, [accessory]);
242
242
  const debug = this.enableDebugMode ? this.log(`Device: ${this.host} ${this.name}, published as external accessory.`) : false;
243
+ this.updateDeviceState();
243
244
  } catch (error) {
244
245
  this.log.error(`Device: ${this.host} ${this.name}, Prepare accessory error: ${error}`);
245
246
  };
246
247
  };
247
248
 
248
- this.updateDeviceState();
249
+ const updateState = this.startPrepareAccessory ? false : this.updateDeviceState();
249
250
  } catch (error) {
250
251
  this.log.error(`Device: ${this.host} ${this.name}, check state error: ${error}, trying again.`);
251
252
  this.updateDeviceState();
@@ -288,7 +289,7 @@ class TasmotaDevice {
288
289
  relayService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
289
290
  relayService.getCharacteristic(Characteristic.On)
290
291
  .onGet(async () => {
291
- const state = this.relaysStete[i];
292
+ const state = this.relaysStete[i] ?? false;
292
293
  const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${logName}, state: ${state ? 'ON' : 'OFF'}`);
293
294
  return state;
294
295
  })