homebridge-tasmota-control 0.3.35 → 0.3.36

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +7 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1 +1 @@
1
- # tasmota-outlet
1
+ # tasmota-control
package/index.js CHANGED
@@ -85,6 +85,7 @@ class tasmotaDevice {
85
85
  this.checkDeviceInfo = true;
86
86
  this.checkDeviceState = false;
87
87
  this.startPrepareAccessory = true;
88
+
88
89
  this.prefDir = path.join(api.user.storagePath(), 'tasmota');
89
90
  this.url = `http://${this.host}/cm?user=${this.user}&password=${this.passwd}&cmnd=`
90
91
 
@@ -103,19 +104,18 @@ class tasmotaDevice {
103
104
  setInterval(function () {
104
105
  if (this.checkDeviceInfo) {
105
106
  this.getDeviceInfo();
106
- }
107
- if (this.checkDeviceState) {
107
+ } else {
108
108
  this.updateDeviceState();
109
109
  }
110
110
  }.bind(this), this.refreshInterval * 1000);
111
-
112
- //start prepare accessory
113
111
  }
114
112
 
115
113
  async getDeviceInfo() {
116
114
  this.log.debug('Device: %s %s, requesting Device Info.', this.host, this.name);
117
115
  try {
118
116
  const response = await this.axiosInstance(STATUS);
117
+ const debug = this.enableDebugMode ? this.log('Device: %s %s, debug response: %s', this.host, this.name, response.data) : false;
118
+
119
119
  const deviceName = response.data.Status.DeviceName;
120
120
  const modelName = response.data.StatusFWR.Hardware;
121
121
  const addressMac = response.data.StatusNET.Mac;
@@ -133,7 +133,9 @@ class tasmotaDevice {
133
133
  this.firmwareRevision = firmwareRevision;
134
134
 
135
135
  this.checkDeviceInfo = false;
136
- this.updateDeviceState();
136
+ if (this.startPrepareAccessory) {
137
+ this.prepareAccessory();
138
+ }
137
139
  } catch (error) {
138
140
  this.log.error('Device: %s %s, Device Info eror: %s, state: Offline, trying to reconnect', this.host, this.name, error);
139
141
  this.checkDeviceInfo = true;
@@ -154,10 +156,6 @@ class tasmotaDevice {
154
156
  }
155
157
  }
156
158
  this.checkDeviceState = true;
157
-
158
- if (this.startPrepareAccessory) {
159
- this.prepareAccessory();
160
- }
161
159
  } catch (error) {
162
160
  this.log.error('Device: %s %s, update Device state error: %s, state: Offline', this.host, this.name, error);
163
161
  this.checkDeviceState = false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Tasmota Control",
3
3
  "name": "homebridge-tasmota-control",
4
- "version": "0.3.35",
4
+ "version": "0.3.36",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",