homebridge-tasmota-control 0.10.21 → 0.10.22-beta.1

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/index.js CHANGED
@@ -54,8 +54,8 @@ class tasmotaPlatform {
54
54
  log.error(`Device: ${device.host} ${device.name}, ${error}, trying again in 15s.`);
55
55
 
56
56
  //start data refresh
57
+ tasmotaDevice.impulseGenerator.stop();
57
58
  await new Promise(resolve => setTimeout(resolve, 15000));
58
- tasmotaDevice.impulseGenerator.stop()
59
59
  tasmotaDevice.start();
60
60
  });
61
61
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Tasmota Control",
3
3
  "name": "homebridge-tasmota-control",
4
- "version": "0.10.21",
4
+ "version": "0.10.22-beta.1",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -65,6 +65,19 @@ class TasmotaDevice extends EventEmitter {
65
65
  }
66
66
  });
67
67
 
68
+ //impulse generator
69
+ const timers = [
70
+ { name: 'checkDeviceState', interval: this.refreshInterval }
71
+ ];
72
+ this.impulseGenerator = new ImpulseGenerator(timers);
73
+ this.impulseGenerator.on('checkDeviceState', async () => {
74
+ try {
75
+ await this.checkDeviceState();
76
+ } catch (error) {
77
+ this.emit('error', `Update home error: ${error}`);
78
+ };
79
+ });
80
+
68
81
  this.start();
69
82
  };
70
83
 
@@ -76,27 +89,13 @@ class TasmotaDevice extends EventEmitter {
76
89
  return;
77
90
  };
78
91
 
79
- //check device state
92
+ //start update data
80
93
  await this.checkDeviceState();
81
94
 
82
95
  //start prepare accessory
83
96
  const accessory = this.startPrepareAccessory ? await this.prepareAccessory() : false;
84
97
  const publishAccessory = this.startPrepareAccessory && accessory ? this.emit('publishAccessory', accessory) : false;
85
98
  this.startPrepareAccessory = false;
86
-
87
- //start update data
88
- const timers = [
89
- { name: 'checkDeviceState', interval: this.refreshInterval }
90
- ];
91
-
92
- this.impulseGenerator = new ImpulseGenerator(timers);
93
- this.impulseGenerator.on('checkDeviceState', async () => {
94
- try {
95
- await this.checkDeviceState();
96
- } catch (error) {
97
- this.emit('error', `Update home error: ${error}`);
98
- };
99
- });
100
99
  this.impulseGenerator.start();
101
100
  } catch (error) {
102
101
  this.emit('error', error);