homebridge-tasmota-control 1.6.3-beta.8 → 1.6.3-beta.9

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.6.3-beta.8",
4
+ "version": "1.6.3-beta.9",
5
5
  "description": "Homebridge plugin to control Tasmota flashed devices.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/fans.js CHANGED
@@ -101,8 +101,9 @@ class Fans extends EventEmitter {
101
101
  this.lights.push(light);
102
102
 
103
103
  //update characteristics
104
- if (this.lightServices) {
105
- this.lightServices[i].updateCharacteristic(Characteristic.On, power);
104
+ const lightService = this.lightServices?.[i];
105
+ if (lightService) {
106
+ lightService.updateCharacteristic(Characteristic.On, power);
106
107
  }
107
108
 
108
109
  //fan
@@ -119,12 +120,14 @@ class Fans extends EventEmitter {
119
120
  this.fans.push(fan);
120
121
 
121
122
  //update characteristics
122
- if (this.fanServices) {
123
- this.fanServices[i].updateCharacteristic(Characteristic.On, powerFan)
124
- //.updateCharacteristic(Characteristic.Direction, direction)
123
+ const fanService = this.fanServices?.[i];
124
+ if (fanService) {
125
+ fanService.updateCharacteristic(Characteristic.On, powerFan)
126
+ // .updateCharacteristic(Characteristic.Direction, direction)
125
127
  .updateCharacteristic(Characteristic.RotationSpeed, speed);
126
128
  }
127
129
 
130
+
128
131
  //log info
129
132
  if (!this.disableLogInfo) {
130
133
  this.emit('info', `${friendlyName}, light: ${power ? 'ON' : 'OFF'}`);
package/src/lights.js CHANGED
@@ -118,23 +118,25 @@ class Lights extends EventEmitter {
118
118
  this.lights.push(light);
119
119
 
120
120
  //update characteristics
121
- if (this.lightServices) {
122
- this.lightServices[i].updateCharacteristic(Characteristic.On, power);
121
+ const service = this.lightServices?.[i];
122
+ if (service) {
123
+ service.updateCharacteristic(Characteristic.On, power);
123
124
 
124
125
  if (brightnessType > 0) {
125
- this.lightServices[i].updateCharacteristic(Characteristic.Brightness, bright);
126
+ service.updateCharacteristic(Characteristic.Brightness, bright);
126
127
  }
127
128
  if (colorTemperature !== false) {
128
- this.lightServices[i].updateCharacteristic(Characteristic.ColorTemperature, colorTemperature);
129
+ service.updateCharacteristic(Characteristic.ColorTemperature, colorTemperature);
129
130
  }
130
131
  if (hue !== false) {
131
- this.lightServices[i].updateCharacteristic(Characteristic.Hue, hue);
132
+ service.updateCharacteristic(Characteristic.Hue, hue);
132
133
  }
133
134
  if (saturation !== false) {
134
- this.lightServices[i].updateCharacteristic(Characteristic.Saturation, saturation);
135
+ service.updateCharacteristic(Characteristic.Saturation, saturation);
135
136
  }
136
137
  }
137
138
 
139
+
138
140
  //log info
139
141
  if (!this.disableLogInfo) {
140
142
  this.emit('info', `${friendlyName}, state: ${power ? 'ON' : 'OFF'}`);
package/src/switches.js CHANGED
@@ -84,8 +84,9 @@ class Switches extends EventEmitter {
84
84
  this.switchesOutlets.push(switchOutlet);
85
85
 
86
86
  //update characteristics
87
- if (this.switchOutletServices) {
88
- this.switchOutletServices[i].updateCharacteristic(Characteristic.On, power);
87
+ const service = this.lightServices?.[i];
88
+ if (service) {
89
+ service.updateCharacteristic(Characteristic.On, power);
89
90
  }
90
91
 
91
92
  //log info