@switchbot/homebridge-switchbot 1.2.2 → 1.2.5

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 (59) hide show
  1. package/.github/workflows/nodejs.yml +1 -1
  2. package/CHANGELOG.md +21 -0
  3. package/dist/devices/bots.d.ts.map +1 -1
  4. package/dist/devices/bots.js +13 -9
  5. package/dist/devices/bots.js.map +1 -1
  6. package/dist/devices/contact.d.ts.map +1 -1
  7. package/dist/devices/contact.js +11 -7
  8. package/dist/devices/contact.js.map +1 -1
  9. package/dist/devices/curtains.d.ts.map +1 -1
  10. package/dist/devices/curtains.js +14 -8
  11. package/dist/devices/curtains.js.map +1 -1
  12. package/dist/devices/humidifiers.d.ts.map +1 -1
  13. package/dist/devices/humidifiers.js +7 -3
  14. package/dist/devices/humidifiers.js.map +1 -1
  15. package/dist/devices/meters.d.ts.map +1 -1
  16. package/dist/devices/meters.js +5 -1
  17. package/dist/devices/meters.js.map +1 -1
  18. package/dist/devices/motion.d.ts.map +1 -1
  19. package/dist/devices/motion.js +5 -1
  20. package/dist/devices/motion.js.map +1 -1
  21. package/dist/devices/plugs.d.ts +0 -1
  22. package/dist/devices/plugs.d.ts.map +1 -1
  23. package/dist/devices/plugs.js +0 -10
  24. package/dist/devices/plugs.js.map +1 -1
  25. package/dist/irdevices/airconditioners.js +6 -6
  26. package/dist/irdevices/airconditioners.js.map +1 -1
  27. package/dist/irdevices/airpurifiers.js +3 -3
  28. package/dist/irdevices/airpurifiers.js.map +1 -1
  29. package/dist/irdevices/cameras.js +1 -1
  30. package/dist/irdevices/cameras.js.map +1 -1
  31. package/dist/irdevices/fans.js +3 -3
  32. package/dist/irdevices/fans.js.map +1 -1
  33. package/dist/irdevices/lights.js +1 -1
  34. package/dist/irdevices/lights.js.map +1 -1
  35. package/dist/irdevices/others.js +2 -2
  36. package/dist/irdevices/others.js.map +1 -1
  37. package/dist/irdevices/tvs.js +2 -2
  38. package/dist/irdevices/tvs.js.map +1 -1
  39. package/dist/irdevices/vacuumcleaners.js +1 -1
  40. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  41. package/dist/irdevices/waterheaters.js +1 -1
  42. package/dist/irdevices/waterheaters.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/devices/bots.ts +13 -9
  45. package/src/devices/contact.ts +11 -7
  46. package/src/devices/curtains.ts +14 -8
  47. package/src/devices/humidifiers.ts +7 -3
  48. package/src/devices/meters.ts +5 -1
  49. package/src/devices/motion.ts +5 -1
  50. package/src/devices/plugs.ts +0 -11
  51. package/src/irdevices/airconditioners.ts +6 -6
  52. package/src/irdevices/airpurifiers.ts +3 -3
  53. package/src/irdevices/cameras.ts +1 -1
  54. package/src/irdevices/fans.ts +3 -3
  55. package/src/irdevices/lights.ts +1 -1
  56. package/src/irdevices/others.ts +2 -2
  57. package/src/irdevices/tvs.ts +2 -2
  58. package/src/irdevices/vacuumcleaners.ts +1 -1
  59. package/src/irdevices/waterheaters.ts +1 -1
@@ -123,7 +123,7 @@ export class Curtain {
123
123
  .onSet(this.TargetPositionSet.bind(this));
124
124
 
125
125
  // Light Sensor Service
126
- if (this.device.curtain?.hide_lightsensor) {
126
+ if (device.curtain?.hide_lightsensor) {
127
127
  this.platform.device(`Curtain: ${accessory.displayName} Removing Light Sensor Service`);
128
128
  this.lightSensorService = this.accessory.getService(this.platform.Service.LightSensor);
129
129
  accessory.removeService(this.lightSensorService!);
@@ -373,14 +373,16 @@ export class Curtain {
373
373
  + ` TargetPosition: ${this.TargetPosition}, PositionState: ${this.PositionState},`);
374
374
 
375
375
  if (!this.device.curtain?.hide_lightsensor) {
376
+ this.set_minLux = this.minLux();
377
+ this.set_maxLux = this.maxLux();
376
378
  // Brightness
377
379
  switch (this.deviceStatus.body.brightness) {
378
380
  case 'dim':
379
- this.CurrentAmbientLightLevel = 0.0001;
381
+ this.CurrentAmbientLightLevel = this.set_minLux;
380
382
  break;
381
383
  case 'bright':
382
384
  default:
383
- this.CurrentAmbientLightLevel = 100000;
385
+ this.CurrentAmbientLightLevel = this.set_maxLux;
384
386
  }
385
387
  this.platform.debug(`Curtain: ${this.accessory.displayName} CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
386
388
  }
@@ -425,7 +427,7 @@ export class Curtain {
425
427
  };
426
428
  // Wait 10 seconds
427
429
  return switchbot.wait(10000);
428
- }).then(() => {
430
+ }).then(async () => {
429
431
  // Stop to monitor
430
432
  switchbot.stopScan();
431
433
  if (this.connected) {
@@ -433,6 +435,10 @@ export class Curtain {
433
435
  this.updateHomeKitCharacteristics();
434
436
  } else {
435
437
  this.platform.log.error(`Curtain: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
438
+ if (this.platform.config.credentials?.openToken) {
439
+ this.platform.log.warn(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
440
+ await this.openAPIRefreshStatus();
441
+ }
436
442
  }
437
443
  }).catch(async (e: any) => {
438
444
  this.platform.log.error(`Curtain: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
@@ -569,7 +575,7 @@ export class Curtain {
569
575
  if (this.CurrentAmbientLightLevel === undefined || Number.isNaN(this.CurrentAmbientLightLevel)) {
570
576
  this.platform.debug(`Curtain: ${this.accessory.displayName} CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
571
577
  } else {
572
- this.lightSensorService!.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, this.CurrentAmbientLightLevel);
578
+ this.lightSensorService?.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, this.CurrentAmbientLightLevel);
573
579
  this.platform.device(`Curtain: ${this.accessory.displayName}`
574
580
  + ` updateCharacteristic CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
575
581
  }
@@ -595,11 +601,11 @@ export class Curtain {
595
601
  this.service.updateCharacteristic(this.platform.Characteristic.PositionState, e);
596
602
  this.service.updateCharacteristic(this.platform.Characteristic.TargetPosition, e);
597
603
  if (!this.device.curtain?.hide_lightsensor) {
598
- this.lightSensorService!.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, e);
604
+ this.lightSensorService?.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, e);
599
605
  }
600
606
  if (this.device.ble) {
601
- this.batteryService!.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
602
- this.batteryService!.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
607
+ this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
608
+ this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
603
609
  }
604
610
  }
605
611
 
@@ -327,7 +327,7 @@ export class Humidifier {
327
327
  };
328
328
  // Wait 10 seconds
329
329
  return switchbot.wait(10000);
330
- }).then(() => {
330
+ }).then(async () => {
331
331
  // Stop to monitor
332
332
  switchbot.stopScan();
333
333
  if (this.connected) {
@@ -335,6 +335,10 @@ export class Humidifier {
335
335
  this.updateHomeKitCharacteristics();
336
336
  } else {
337
337
  this.platform.log.error(`Humidifier: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
338
+ if (this.platform.config.credentials?.openToken) {
339
+ this.platform.log.warn(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
340
+ await this.openAPIRefreshStatus();
341
+ }
338
342
  }
339
343
  }).catch(async (e: any) => {
340
344
  this.platform.log.error(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
@@ -591,7 +595,7 @@ export class Humidifier {
591
595
  if (this.CurrentTemperature === undefined) {
592
596
  this.platform.debug(`Humidifier: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
593
597
  } else {
594
- this.temperatureservice!.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
598
+ this.temperatureservice?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
595
599
  this.platform.device(`Humidifier: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
596
600
  }
597
601
  }
@@ -607,7 +611,7 @@ export class Humidifier {
607
611
  this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
608
612
  this.service.updateCharacteristic(this.platform.Characteristic.RelativeHumidityHumidifierThreshold, e);
609
613
  if (!this.device.humidifier?.hide_temperature && !this.device.ble) {
610
- this.temperatureservice!.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, e);
614
+ this.temperatureservice?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, e);
611
615
  }
612
616
  }
613
617
 
@@ -284,7 +284,7 @@ export class Meter {
284
284
  };
285
285
  // Wait 10 seconds
286
286
  return switchbot.wait(10000);
287
- }).then(() => {
287
+ }).then(async () => {
288
288
  // Stop to monitor
289
289
  switchbot.stopScan();
290
290
  if (this.connected) {
@@ -292,6 +292,10 @@ export class Meter {
292
292
  this.updateHomeKitCharacteristics();
293
293
  } else {
294
294
  this.platform.log.error(`Meter: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
295
+ if (this.platform.config.credentials?.openToken) {
296
+ this.platform.log.warn(`Meter: ${this.accessory.displayName} Using OpenAPI Connection`);
297
+ await this.openAPIRefreshStatus();
298
+ }
295
299
  }
296
300
  }).catch(async (e: any) => {
297
301
  this.platform.log.error(`Meter: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
@@ -197,7 +197,7 @@ export class Motion {
197
197
  };
198
198
  // Wait 10 seconds
199
199
  return switchbot.wait(10000);
200
- }).then(() => {
200
+ }).then(async () => {
201
201
  // Stop to monitor
202
202
  switchbot.stopScan();
203
203
  if (this.connected) {
@@ -205,6 +205,10 @@ export class Motion {
205
205
  this.updateHomeKitCharacteristics();
206
206
  } else {
207
207
  this.platform.log.error(`Motion Sensor: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
208
+ if (this.platform.config.credentials?.openToken) {
209
+ this.platform.log.warn(`Motion Sensor: ${this.accessory.displayName} Using OpenAPI Connection`);
210
+ await this.openAPIRefreshStatus();
211
+ }
208
212
  }
209
213
  }).catch(async (e: any) => {
210
214
  this.platform.log.error(`Motion Sensor: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
@@ -12,7 +12,6 @@ export class Plug {
12
12
 
13
13
  // Characteristic Values
14
14
  On!: CharacteristicValue;
15
- OutletInUse!: CharacteristicValue;
16
15
 
17
16
  // OpenAPI Others
18
17
  deviceStatus!: deviceStatusResponse;
@@ -32,7 +31,6 @@ export class Plug {
32
31
  ) {
33
32
  // default placeholders
34
33
  this.On = false;
35
- this.OutletInUse = true;
36
34
 
37
35
  // this is subject we use to track when we need to POST changes to the SwitchBot API
38
36
  this.doPlugUpdate = new Subject();
@@ -68,8 +66,6 @@ export class Plug {
68
66
  // create handlers for required characteristics
69
67
  this.service.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
70
68
 
71
- this.service.setCharacteristic(this.platform.Characteristic.OutletInUse, this.OutletInUse || true);
72
-
73
69
  // Update Homekit
74
70
  this.updateHomeKitCharacteristics();
75
71
 
@@ -173,17 +169,10 @@ export class Plug {
173
169
  this.service.updateCharacteristic(this.platform.Characteristic.On, this.On);
174
170
  this.platform.device(`Plug: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
175
171
  }
176
- if (this.OutletInUse === undefined) {
177
- this.platform.debug(`Plug: ${this.accessory.displayName} OutletInUse: ${this.OutletInUse}`);
178
- } else {
179
- this.service.updateCharacteristic(this.platform.Characteristic.OutletInUse, this.OutletInUse);
180
- this.platform.device(`Plug: ${this.accessory.displayName} updateCharacteristic OutletInUse: ${this.OutletInUse}`);
181
- }
182
172
  }
183
173
 
184
174
  public apiError(e: any) {
185
175
  this.service.updateCharacteristic(this.platform.Characteristic.On, e);
186
- this.service.updateCharacteristic(this.platform.Characteristic.OutletInUse, e);
187
176
  }
188
177
 
189
178
  private statusCode(push: AxiosResponse<{ statusCode: number; }>) {
@@ -168,39 +168,39 @@ export class AirConditioner {
168
168
  if (this.Active === undefined) {
169
169
  this.platform.debug(`Air Conditioner: ${this.accessory.displayName} Active: ${this.Active}`);
170
170
  } else {
171
- this.service!.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
171
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
172
172
  this.platform.device(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
173
173
  }
174
174
  if (this.RotationSpeed === undefined) {
175
175
  this.platform.debug(`Air Conditioner: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
176
176
  } else {
177
- this.service!.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
177
+ this.service?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
178
178
  this.platform.device(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
179
179
  }
180
180
  if (this.CurrentTemperature === undefined) {
181
181
  this.platform.debug(`Air Conditioner: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
182
182
  } else {
183
- this.service!.updateCharacteristic(this.platform.Characteristic.Active, this.CurrentTemperature);
183
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.CurrentTemperature);
184
184
  this.platform.device(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
185
185
  }
186
186
  if (this.TargetHeaterCoolerState === undefined) {
187
187
  this.platform.debug(`Air Conditioner: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
188
188
  } else {
189
- this.service!.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
189
+ this.service?.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
190
190
  this.platform.device(`Air Conditioner: ${this.accessory.displayName}`
191
191
  + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
192
192
  }
193
193
  if (this.CurrentHeaterCoolerState === undefined) {
194
194
  this.platform.debug(`Air Conditioner: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
195
195
  } else {
196
- this.service!.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
196
+ this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
197
197
  this.platform.device(`Air Conditioner: ${this.accessory.displayName}`
198
198
  + ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
199
199
  }
200
200
  if (this.HeatingThresholdTemperature === undefined) {
201
201
  this.platform.debug(`Air Conditioner: ${this.accessory.displayName} HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
202
202
  } else {
203
- this.service!.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, this.HeatingThresholdTemperature);
203
+ this.service?.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, this.HeatingThresholdTemperature);
204
204
  this.platform.device(`Air Conditioner: ${this.accessory.displayName}`
205
205
  + ` updateCharacteristic HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
206
206
  }
@@ -87,20 +87,20 @@ export class AirPurifier {
87
87
  if (this.Active === undefined) {
88
88
  this.platform.debug(`Air Purifier: ${this.accessory.displayName} Active: ${this.Active}`);
89
89
  } else {
90
- this.service!.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
90
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
91
91
  this.platform.device(`Air Purifier: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
92
92
  }
93
93
  if (this.CurrentAirPurifierState === undefined) {
94
94
  this.platform.debug(`Air Purifier: ${this.accessory.displayName} CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
95
95
  } else {
96
- this.service!.updateCharacteristic(this.platform.Characteristic.CurrentAirPurifierState, this.CurrentAirPurifierState);
96
+ this.service?.updateCharacteristic(this.platform.Characteristic.CurrentAirPurifierState, this.CurrentAirPurifierState);
97
97
  this.platform.device(`Air Purifier: ${this.accessory.displayName}`
98
98
  + ` updateCharacteristic CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
99
99
  }
100
100
  if (this.CurrentHeaterCoolerState === undefined) {
101
101
  this.platform.debug(`Air Purifier: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
102
102
  } else {
103
- this.service!.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
103
+ this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
104
104
  this.platform.device(`Air Purifier: ${this.accessory.displayName}`
105
105
  + ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
106
106
  }
@@ -63,7 +63,7 @@ export class Camera {
63
63
  if (this.On === undefined) {
64
64
  this.platform.debug(`Camera: ${this.accessory.displayName} On: ${this.On}`);
65
65
  } else {
66
- this.service!.updateCharacteristic(this.platform.Characteristic.On, this.On);
66
+ this.service?.updateCharacteristic(this.platform.Characteristic.On, this.On);
67
67
  this.platform.device(`Camera: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
68
68
  }
69
69
  }
@@ -126,19 +126,19 @@ export class Fan {
126
126
  if (this.Active === undefined) {
127
127
  this.platform.debug(`Fan: ${this.accessory.displayName} Active: ${this.Active}`);
128
128
  } else {
129
- this.service!.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
129
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
130
130
  this.platform.device(`Fan: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
131
131
  }
132
132
  if (this.SwingMode === undefined) {
133
133
  this.platform.debug(`Fan: ${this.accessory.displayName} SwingMode: ${this.SwingMode}`);
134
134
  } else {
135
- this.service!.updateCharacteristic(this.platform.Characteristic.SwingMode, this.SwingMode);
135
+ this.service?.updateCharacteristic(this.platform.Characteristic.SwingMode, this.SwingMode);
136
136
  this.platform.device(`Fan: ${this.accessory.displayName} updateCharacteristic SwingMode: ${this.SwingMode}`);
137
137
  }
138
138
  if (this.RotationSpeed === undefined) {
139
139
  this.platform.debug(`Fan: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
140
140
  } else {
141
- this.service!.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
141
+ this.service?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
142
142
  this.platform.device(`Fan: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
143
143
  }
144
144
  }
@@ -78,7 +78,7 @@ export class Light {
78
78
  if (this.On === undefined) {
79
79
  this.platform.debug(`Light: ${this.accessory.displayName} On: ${this.On}`);
80
80
  } else {
81
- this.service!.updateCharacteristic(this.platform.Characteristic.On, this.On);
81
+ this.service?.updateCharacteristic(this.platform.Characteristic.On, this.On);
82
82
  this.platform.device(`Light: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
83
83
  }
84
84
  }
@@ -60,7 +60,7 @@ export class Others {
60
60
  if (this.Active === undefined) {
61
61
  this.platform.debug(`Other: ${this.accessory.displayName} Active: ${this.Active}`);
62
62
  } else {
63
- this.service!.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
63
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
64
64
  this.platform.device(`Other: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
65
65
  }
66
66
  }
@@ -175,6 +175,6 @@ export class Others {
175
175
  }
176
176
 
177
177
  public apiError(e: any) {
178
- this.service!.updateCharacteristic(this.platform.Characteristic.Active, e);
178
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, e);
179
179
  }
180
180
  }
@@ -214,13 +214,13 @@ export class TV {
214
214
  if (this.Active === undefined) {
215
215
  this.platform.debug(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
216
216
  } else {
217
- this.service!.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
217
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
218
218
  this.platform.device(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
219
219
  }
220
220
  if (this.ActiveIdentifier === undefined) {
221
221
  this.platform.debug(`${this.device.remoteType}: ${this.accessory.displayName} ActiveIdentifier: ${this.ActiveIdentifier}`);
222
222
  } else {
223
- this.service!.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, this.ActiveIdentifier);
223
+ this.service?.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, this.ActiveIdentifier);
224
224
  this.platform.device(`${this.device.remoteType}: ${this.accessory.displayName}`
225
225
  + ` updateCharacteristic ActiveIdentifier: ${this.ActiveIdentifier}`);
226
226
  }
@@ -63,7 +63,7 @@ export class VacuumCleaner {
63
63
  if (this.On === undefined) {
64
64
  this.platform.debug(`Vacuum Cleaner: ${this.accessory.displayName} On: ${this.On}`);
65
65
  } else {
66
- this.service!.updateCharacteristic(this.platform.Characteristic.On, this.On);
66
+ this.service?.updateCharacteristic(this.platform.Characteristic.On, this.On);
67
67
  this.platform.device(`Vacuum Cleaner: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
68
68
  }
69
69
  }
@@ -77,7 +77,7 @@ export class WaterHeater {
77
77
  if (this.Active === undefined) {
78
78
  this.platform.debug(`Water Heater: ${this.accessory.displayName} Active: ${this.Active}`);
79
79
  } else {
80
- this.service!.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
80
+ this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
81
81
  this.platform.device(`Water Heater: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
82
82
  }
83
83
  }