@switchbot/homebridge-switchbot 3.5.0-beta.55 → 3.5.0-beta.57

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 (58) hide show
  1. package/dist/device/blindtilt.js.map +1 -1
  2. package/dist/device/bot.js.map +1 -1
  3. package/dist/device/ceilinglight.js.map +1 -1
  4. package/dist/device/colorbulb.js.map +1 -1
  5. package/dist/device/contact.js.map +1 -1
  6. package/dist/device/curtain.js.map +1 -1
  7. package/dist/device/fan.js.map +1 -1
  8. package/dist/device/hub.js.map +1 -1
  9. package/dist/device/humidifier.js.map +1 -1
  10. package/dist/device/iosensor.js.map +1 -1
  11. package/dist/device/lightstrip.js.map +1 -1
  12. package/dist/device/lock.js.map +1 -1
  13. package/dist/device/meter.js.map +1 -1
  14. package/dist/device/meterplus.js.map +1 -1
  15. package/dist/device/motion.d.ts.map +1 -1
  16. package/dist/device/motion.js +15 -2
  17. package/dist/device/motion.js.map +1 -1
  18. package/dist/device/plug.js.map +1 -1
  19. package/dist/device/robotvacuumcleaner.js.map +1 -1
  20. package/dist/device/waterdetector.js.map +1 -1
  21. package/dist/irdevice/airconditioner.js.map +1 -1
  22. package/dist/irdevice/airpurifier.js.map +1 -1
  23. package/dist/irdevice/camera.js.map +1 -1
  24. package/dist/irdevice/fan.js.map +1 -1
  25. package/dist/irdevice/light.js.map +1 -1
  26. package/dist/irdevice/other.js.map +1 -1
  27. package/dist/irdevice/tv.js.map +1 -1
  28. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  29. package/dist/irdevice/waterheater.js.map +1 -1
  30. package/eslint.config.js +55 -55
  31. package/package.json +2 -2
  32. package/src/device/blindtilt.ts +3 -3
  33. package/src/device/bot.ts +11 -11
  34. package/src/device/ceilinglight.ts +1 -1
  35. package/src/device/colorbulb.ts +1 -1
  36. package/src/device/contact.ts +3 -3
  37. package/src/device/curtain.ts +3 -3
  38. package/src/device/fan.ts +2 -2
  39. package/src/device/hub.ts +3 -3
  40. package/src/device/humidifier.ts +2 -2
  41. package/src/device/iosensor.ts +3 -3
  42. package/src/device/lightstrip.ts +1 -1
  43. package/src/device/lock.ts +4 -4
  44. package/src/device/meter.ts +3 -3
  45. package/src/device/meterplus.ts +3 -3
  46. package/src/device/motion.ts +18 -3
  47. package/src/device/plug.ts +1 -1
  48. package/src/device/robotvacuumcleaner.ts +2 -2
  49. package/src/device/waterdetector.ts +2 -2
  50. package/src/irdevice/airconditioner.ts +2 -2
  51. package/src/irdevice/airpurifier.ts +2 -2
  52. package/src/irdevice/camera.ts +1 -1
  53. package/src/irdevice/fan.ts +1 -1
  54. package/src/irdevice/light.ts +1 -1
  55. package/src/irdevice/other.ts +10 -10
  56. package/src/irdevice/tv.ts +2 -2
  57. package/src/irdevice/vacuumcleaner.ts +1 -1
  58. package/src/irdevice/waterheater.ts +1 -1
@@ -44,7 +44,7 @@ export class Meter extends deviceBase {
44
44
  // Initialize Temperature Sensor property
45
45
  if (!device.meter?.hide_temperature) {
46
46
  this.TemperatureSensor = {
47
- Service: accessory.getService(this.hap.Service.TemperatureSensor)!,
47
+ Service: accessory.getService(this.hap.Service.TemperatureSensor) as Service,
48
48
  CurrentTemperature: accessory.context.CurrentTemperature || 30,
49
49
  };
50
50
  }
@@ -52,14 +52,14 @@ export class Meter extends deviceBase {
52
52
  // Initialize Humidity Sensor property
53
53
  if (!device.meter?.hide_humidity) {
54
54
  this.HumiditySensor = {
55
- Service: accessory.getService(this.hap.Service.HumiditySensor)!,
55
+ Service: accessory.getService(this.hap.Service.HumiditySensor) as Service,
56
56
  CurrentRelativeHumidity: accessory.context.CurrentRelativeHumidity || 50,
57
57
  };
58
58
  }
59
59
 
60
60
  // Initialize Battery property
61
61
  this.Battery = {
62
- Service: accessory.getService(this.hap.Service.Battery)!,
62
+ Service: accessory.getService(this.hap.Service.Battery) as Service,
63
63
  BatteryLevel: accessory.context.BatteryLevel || 100,
64
64
  StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
65
65
  };
@@ -48,7 +48,7 @@ export class MeterPlus extends deviceBase {
48
48
  // Initialize Temperature Sensor property
49
49
  if (!device.meter?.hide_temperature) {
50
50
  this.TemperatureSensor = {
51
- Service: accessory.getService(this.hap.Service.TemperatureSensor)!,
51
+ Service: accessory.getService(this.hap.Service.TemperatureSensor) as Service,
52
52
  CurrentTemperature: accessory.context.CurrentTemperature || 30,
53
53
  };
54
54
  }
@@ -56,14 +56,14 @@ export class MeterPlus extends deviceBase {
56
56
  // Initialize Humidity Sensor property
57
57
  if (!device.meter?.hide_humidity) {
58
58
  this.HumiditySensor = {
59
- Service: accessory.getService(this.hap.Service.HumiditySensor)!,
59
+ Service: accessory.getService(this.hap.Service.HumiditySensor) as Service,
60
60
  CurrentRelativeHumidity: accessory.context.CurrentRelativeHumidity || 50,
61
61
  };
62
62
  }
63
63
 
64
64
  // Initialize Battery property
65
65
  this.Battery = {
66
- Service: accessory.getService(this.hap.Service.Battery)!,
66
+ Service: accessory.getService(this.hap.Service.Battery) as Service,
67
67
  BatteryLevel: accessory.context.BatteryLevel || 100,
68
68
  StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
69
69
  };
@@ -48,18 +48,33 @@ export class Motion extends deviceBase {
48
48
 
49
49
  // Initialize Motion Sensor property
50
50
  this.MotionSensor = {
51
- Service: accessory.getService(this.hap.Service.MotionSensor)!,
51
+ Service: accessory.getService(this.hap.Service.MotionSensor) as Service,
52
52
  MotionDetected: accessory.context.MotionDetected || false,
53
53
  };
54
54
 
55
+ // Initialize Battery property
56
+ this.Battery = {
57
+ Service: accessory.getService(this.hap.Service.Battery) as Service,
58
+ BatteryLevel: accessory.context.BatteryLevel || 100,
59
+ StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
60
+ };
61
+
62
+ // Initialize Motion Sensor property
63
+ if (!device.motion?.hide_lightsensor) {
64
+ this.LightSensor = {
65
+ Service: accessory.getService(this.hap.Service.LightSensor) as Service,
66
+ CurrentAmbientLightLevel: accessory.context.CurrentAmbientLightLevel || 0,
67
+ };
68
+ };
69
+
70
+
55
71
  // Retrieve initial values and updateHomekit
56
72
  this.refreshStatus();
57
73
 
58
74
  // get the Battery service if it exists, otherwise create a new Motion service
59
75
  // you can create multiple services for each accessory
60
- const MotionSensorService = `${accessory.displayName} Motion Sensor`;
61
76
  (this.MotionSensor.Service = accessory.getService(this.hap.Service.MotionSensor)
62
- || accessory.addService(this.hap.Service.MotionSensor)), MotionSensorService;
77
+ || accessory.addService(this.hap.Service.MotionSensor)), `${accessory.displayName} Motion Sensor`;
63
78
 
64
79
  this.MotionSensor.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
65
80
  // each service must implement at-minimum the "required characteristics" for the given service type
@@ -31,7 +31,7 @@ export class Plug extends deviceBase {
31
31
 
32
32
  // Initialize Outlet property
33
33
  this.Outlet = {
34
- Service: accessory.getService(this.hap.Service.Outlet)!,
34
+ Service: accessory.getService(this.hap.Service.Outlet) as Service,
35
35
  On: accessory.context.On || false,
36
36
  };
37
37
 
@@ -40,14 +40,14 @@ export class RobotVacuumCleaner extends deviceBase {
40
40
 
41
41
  // Initialize Lightbulb property
42
42
  this.LightBulb = {
43
- Service: accessory.getService(this.hap.Service.Lightbulb)!,
43
+ Service: accessory.getService(this.hap.Service.Lightbulb) as Service,
44
44
  On: accessory.context.On || false,
45
45
  Brightness: accessory.context.Brightness || 0,
46
46
  };
47
47
 
48
48
  // Initialize Battery property
49
49
  this.Battery = {
50
- Service: accessory.getService(this.hap.Service.Battery)!,
50
+ Service: accessory.getService(this.hap.Service.Battery) as Service,
51
51
  BatteryLevel: accessory.context.BatteryLevel || 100,
52
52
  StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
53
53
  };
@@ -48,7 +48,7 @@ export class WaterDetector extends deviceBase {
48
48
 
49
49
  // Initialize Battery property
50
50
  this.Battery = {
51
- Service: accessory.getService(this.hap.Service.Battery)!,
51
+ Service: accessory.getService(this.hap.Service.Battery) as Service,
52
52
  BatteryLevel: accessory.context.BatteryLevel || 100,
53
53
  StatusLowBattery: accessory.context.StatusLowBattery || this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
54
54
  ChargingState: accessory.context.ChargingState || this.hap.Characteristic.ChargingState.NOT_CHARGEABLE,
@@ -57,7 +57,7 @@ export class WaterDetector extends deviceBase {
57
57
  // Initialize Leak Sensor property
58
58
  if (!this.device.waterdetector?.hide_leak) {
59
59
  this.LeakSensor = {
60
- Service: accessory.getService(this.hap.Service.LeakSensor)!,
60
+ Service: accessory.getService(this.hap.Service.LeakSensor) as Service,
61
61
  StatusActive: accessory.context.StatusActive || false,
62
62
  LeakDetected: accessory.context.LeakDetected || this.hap.Characteristic.LeakDetected.LEAK_NOT_DETECTED,
63
63
  };
@@ -58,7 +58,7 @@ export class AirConditioner extends irdeviceBase {
58
58
 
59
59
  // Initialize HeaterCooler property
60
60
  this.HeaterCooler = {
61
- Service: accessory.getService(this.hap.Service.Switch)!,
61
+ Service: accessory.getService(this.hap.Service.Switch) as Service,
62
62
  Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
63
63
  CurrentHeaterCoolerState: accessory.context.CurrentHeaterCoolerState || this.hap.Characteristic.CurrentHeaterCoolerState.IDLE,
64
64
  TargetHeaterCoolerState: accessory.context.TargetHeaterCoolerState || this.hap.Characteristic.TargetHeaterCoolerState.AUTO,
@@ -72,7 +72,7 @@ export class AirConditioner extends irdeviceBase {
72
72
  const meterUuid = this.platform.api.hap.uuid.generate(`${this.device.irair.meterId}-${this.device.irair.meterType}`);
73
73
  this.meter = this.platform.accessories.find((accessory) => accessory.UUID === meterUuid);
74
74
  this.HumiditySensor = {
75
- Service: this.meter!.getService(this.hap.Service.HumiditySensor)!,
75
+ Service: this.meter!.getService(this.hap.Service.HumiditySensor) as Service,
76
76
  CurrentRelativeHumidity: this.meter!.context.CurrentRelativeHumidity || 0,
77
77
  };
78
78
  }
@@ -54,7 +54,7 @@ export class AirPurifier extends irdeviceBase {
54
54
 
55
55
  // Initialize AirPurifier property
56
56
  this.AirPurifier = {
57
- Service: accessory.getService(this.hap.Service.Switch)!,
57
+ Service: accessory.getService(this.hap.Service.Switch) as Service,
58
58
  Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
59
59
  RotationSpeed: accessory.context.RotationSpeed || 0,
60
60
  CurrentAirPurifierState: accessory.context.CurrentAirPurifierState || this.hap.Characteristic.CurrentAirPurifierState.INACTIVE,
@@ -63,7 +63,7 @@ export class AirPurifier extends irdeviceBase {
63
63
 
64
64
  // Initialize TemperatureSensor property
65
65
  this.TemperatureSensor = {
66
- Service: accessory.getService(this.hap.Service.TemperatureSensor)!,
66
+ Service: accessory.getService(this.hap.Service.TemperatureSensor) as Service,
67
67
  CurrentTemperature: accessory.context.CurrentTemperature || 24,
68
68
  };
69
69
 
@@ -29,7 +29,7 @@ export class Camera extends irdeviceBase {
29
29
 
30
30
  // Initialize Switch property
31
31
  this.Switch = {
32
- Service: accessory.getService(this.hap.Service.Switch)!,
32
+ Service: accessory.getService(this.hap.Service.Switch) as Service,
33
33
  On: accessory.context.On || false,
34
34
  };
35
35
 
@@ -37,7 +37,7 @@ export class IRFan extends irdeviceBase {
37
37
 
38
38
  // Initialize Switch property
39
39
  this.Fan = {
40
- Service: accessory.getService(this.hap.Service.Lightbulb)!,
40
+ Service: accessory.getService(this.hap.Service.Lightbulb) as Service,
41
41
  Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
42
42
  SwingMode: accessory.context.SwingMode || this.hap.Characteristic.SwingMode.SWING_DISABLED,
43
43
  RotationSpeed: accessory.context.RotationSpeed || 0,
@@ -40,7 +40,7 @@ export class Light extends irdeviceBase {
40
40
  if (!device.irlight?.stateless) {
41
41
  // Initialize LightBulb property
42
42
  this.LightBulb = {
43
- Service: accessory.getService(this.hap.Service.Lightbulb)!,
43
+ Service: accessory.getService(this.hap.Service.Lightbulb) as Service,
44
44
  On: accessory.context.On || false,
45
45
  };
46
46
  // get the Light service if it exists, otherwise create a new Light service
@@ -82,7 +82,7 @@ export class Others extends irdeviceBase {
82
82
  if (this.otherDeviceType === 'switch') {
83
83
  // Initialize Switch property
84
84
  this.Switch = {
85
- Service: accessory.getService(this.hap.Service.Switch)!,
85
+ Service: accessory.getService(this.hap.Service.Switch) as Service,
86
86
  On: accessory.context.On || false,
87
87
  };
88
88
  this.removeFanService(accessory);
@@ -106,7 +106,7 @@ export class Others extends irdeviceBase {
106
106
  } else if (this.otherDeviceType === 'garagedoor') {
107
107
  // Initialize Garage Door property
108
108
  this.GarageDoor = {
109
- Service: accessory.getService(this.hap.Service.GarageDoorOpener)!,
109
+ Service: accessory.getService(this.hap.Service.GarageDoorOpener) as Service,
110
110
  On: accessory.context.On || false,
111
111
  };
112
112
  this.removeFanService(accessory);
@@ -131,7 +131,7 @@ export class Others extends irdeviceBase {
131
131
  } else if (this.otherDeviceType === 'door') {
132
132
  // Initialize Door property
133
133
  this.Door = {
134
- Service: accessory.getService(this.hap.Service.Door)!,
134
+ Service: accessory.getService(this.hap.Service.Door) as Service,
135
135
  On: accessory.context.On || false,
136
136
  };
137
137
  this.removeFanService(accessory);
@@ -164,7 +164,7 @@ export class Others extends irdeviceBase {
164
164
  } else if (this.otherDeviceType === 'window') {
165
165
  // Initialize Window property
166
166
  this.Window = {
167
- Service: accessory.getService(this.hap.Service.Window)!,
167
+ Service: accessory.getService(this.hap.Service.Window) as Service,
168
168
  On: accessory.context.On || false,
169
169
  };
170
170
  this.removeFanService(accessory);
@@ -197,7 +197,7 @@ export class Others extends irdeviceBase {
197
197
  } else if (this.otherDeviceType === 'windowcovering') {
198
198
  // Initialize WindowCovering property
199
199
  this.WindowCovering = {
200
- Service: accessory.getService(this.hap.Service.WindowCovering)!,
200
+ Service: accessory.getService(this.hap.Service.WindowCovering) as Service,
201
201
  On: accessory.context.On || false,
202
202
  };
203
203
  this.removeFanService(accessory);
@@ -230,7 +230,7 @@ export class Others extends irdeviceBase {
230
230
  } else if (this.otherDeviceType === 'lock') {
231
231
  // Initialize Lock property
232
232
  this.Lock = {
233
- Service: accessory.getService(this.hap.Service.LockMechanism)!,
233
+ Service: accessory.getService(this.hap.Service.LockMechanism) as Service,
234
234
  On: accessory.context.On || false,
235
235
  };
236
236
  this.removeFanService(accessory);
@@ -254,7 +254,7 @@ export class Others extends irdeviceBase {
254
254
  } else if (this.otherDeviceType === 'faucet') {
255
255
  // Initialize Faucet property
256
256
  this.Faucet = {
257
- Service: accessory.getService(this.hap.Service.Faucet)!,
257
+ Service: accessory.getService(this.hap.Service.Faucet) as Service,
258
258
  On: accessory.context.On || false,
259
259
  };
260
260
  this.removeFanService(accessory);
@@ -278,7 +278,7 @@ export class Others extends irdeviceBase {
278
278
  } else if (this.otherDeviceType === 'fan') {
279
279
  // Initialize Fan property
280
280
  this.Fan = {
281
- Service: accessory.getService(this.hap.Service.Fanv2)!,
281
+ Service: accessory.getService(this.hap.Service.Fanv2) as Service,
282
282
  On: accessory.context.On || false,
283
283
  };
284
284
  this.removeLockService(accessory);
@@ -302,7 +302,7 @@ export class Others extends irdeviceBase {
302
302
  } else if (this.otherDeviceType === 'stateful') {
303
303
  // Initialize StatefulProgrammableSwitch property
304
304
  this.StatefulProgrammableSwitch = {
305
- Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch)!,
305
+ Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch) as Service,
306
306
  On: accessory.context.On || false,
307
307
  };
308
308
  this.removeFanService(accessory);
@@ -328,7 +328,7 @@ export class Others extends irdeviceBase {
328
328
  } else {
329
329
  // Initialize Outlet property
330
330
  this.Outlet = {
331
- Service: accessory.getService(this.hap.Service.Outlet)!,
331
+ Service: accessory.getService(this.hap.Service.Outlet) as Service,
332
332
  On: accessory.context.On || false,
333
333
  };
334
334
  this.removeFanService(accessory);
@@ -41,7 +41,7 @@ export class TV extends irdeviceBase {
41
41
 
42
42
  // Initialize Television property
43
43
  this.Television = {
44
- Service: accessory.getService(this.hap.Service.Television)!,
44
+ Service: accessory.getService(this.hap.Service.Television) as Service,
45
45
  Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
46
46
  ActiveIdentifier: accessory.context.ActiveIdentifier || 1,
47
47
  SleepDiscoveryMode: accessory.context.SleepDiscoveryMode || this.hap.Characteristic.SleepDiscoveryMode.ALWAYS_DISCOVERABLE,
@@ -50,7 +50,7 @@ export class TV extends irdeviceBase {
50
50
 
51
51
  // Initialize TelevisionSpeaker property
52
52
  this.TelevisionSpeaker = {
53
- Service: accessory.getService(this.hap.Service.TelevisionSpeaker)!,
53
+ Service: accessory.getService(this.hap.Service.TelevisionSpeaker) as Service,
54
54
  Active: accessory.context.Active || false,
55
55
  VolumeControlType: accessory.context.VolumeControlType || this.hap.Characteristic.VolumeControlType.ABSOLUTE,
56
56
  VolumeSelector: accessory.context.VolumeSelector || this.hap.Characteristic.VolumeSelector.INCREMENT,
@@ -29,7 +29,7 @@ export class VacuumCleaner extends irdeviceBase {
29
29
 
30
30
  // Initialize Switch property
31
31
  this.Switch = {
32
- Service: accessory.getService(this.hap.Service.Switch)!,
32
+ Service: accessory.getService(this.hap.Service.Switch) as Service,
33
33
  On: accessory.context.On || false,
34
34
  };
35
35
 
@@ -29,7 +29,7 @@ export class WaterHeater extends irdeviceBase {
29
29
 
30
30
  // Initialize Valve property
31
31
  this.Valve = {
32
- Service: accessory.getService(this.hap.Service.Valve)!,
32
+ Service: accessory.getService(this.hap.Service.Valve) as Service,
33
33
  Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
34
34
  };
35
35