@switchbot/homebridge-switchbot 3.7.1-beta.2 → 3.7.1-beta.21

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 (199) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +14 -0
  3. package/assets/security-privacy-bluetooth.png +0 -0
  4. package/config.schema.json +74 -2
  5. package/dist/device/blindtilt.d.ts +21 -9
  6. package/dist/device/blindtilt.d.ts.map +1 -1
  7. package/dist/device/blindtilt.js +167 -96
  8. package/dist/device/blindtilt.js.map +1 -1
  9. package/dist/device/bot-old.d.ts +132 -0
  10. package/dist/device/bot-old.d.ts.map +1 -0
  11. package/dist/device/bot-old.js +1482 -0
  12. package/dist/device/bot-old.js.map +1 -0
  13. package/dist/device/bot.d.ts +10 -9
  14. package/dist/device/bot.d.ts.map +1 -1
  15. package/dist/device/bot.js +186 -187
  16. package/dist/device/bot.js.map +1 -1
  17. package/dist/device/ceilinglight.d.ts +14 -13
  18. package/dist/device/ceilinglight.d.ts.map +1 -1
  19. package/dist/device/ceilinglight.js +87 -97
  20. package/dist/device/ceilinglight.js.map +1 -1
  21. package/dist/device/colorbulb.d.ts +13 -12
  22. package/dist/device/colorbulb.d.ts.map +1 -1
  23. package/dist/device/colorbulb.js +92 -105
  24. package/dist/device/colorbulb.js.map +1 -1
  25. package/dist/device/contact.d.ts +6 -5
  26. package/dist/device/contact.d.ts.map +1 -1
  27. package/dist/device/contact.js +71 -68
  28. package/dist/device/contact.js.map +1 -1
  29. package/dist/device/curtain.d.ts +17 -5
  30. package/dist/device/curtain.d.ts.map +1 -1
  31. package/dist/device/curtain.js +184 -118
  32. package/dist/device/curtain.js.map +1 -1
  33. package/dist/device/device.d.ts +18 -18
  34. package/dist/device/device.d.ts.map +1 -1
  35. package/dist/device/device.js +33 -36
  36. package/dist/device/device.js.map +1 -1
  37. package/dist/device/fan.d.ts +9 -8
  38. package/dist/device/fan.d.ts.map +1 -1
  39. package/dist/device/fan.js +94 -101
  40. package/dist/device/fan.js.map +1 -1
  41. package/dist/device/hub.d.ts +6 -5
  42. package/dist/device/hub.d.ts.map +1 -1
  43. package/dist/device/hub.js +69 -65
  44. package/dist/device/hub.js.map +1 -1
  45. package/dist/device/humidifier.d.ts +6 -5
  46. package/dist/device/humidifier.d.ts.map +1 -1
  47. package/dist/device/humidifier.js +89 -104
  48. package/dist/device/humidifier.js.map +1 -1
  49. package/dist/device/iosensor.d.ts +6 -5
  50. package/dist/device/iosensor.d.ts.map +1 -1
  51. package/dist/device/iosensor.js +72 -66
  52. package/dist/device/iosensor.js.map +1 -1
  53. package/dist/device/lightstrip.d.ts +7 -6
  54. package/dist/device/lightstrip.d.ts.map +1 -1
  55. package/dist/device/lightstrip.js +85 -99
  56. package/dist/device/lightstrip.js.map +1 -1
  57. package/dist/device/lock.d.ts +10 -9
  58. package/dist/device/lock.d.ts.map +1 -1
  59. package/dist/device/lock.js +89 -79
  60. package/dist/device/lock.js.map +1 -1
  61. package/dist/device/meter.d.ts +6 -5
  62. package/dist/device/meter.d.ts.map +1 -1
  63. package/dist/device/meter.js +72 -65
  64. package/dist/device/meter.js.map +1 -1
  65. package/dist/device/meterplus.d.ts +6 -5
  66. package/dist/device/meterplus.d.ts.map +1 -1
  67. package/dist/device/meterplus.js +72 -64
  68. package/dist/device/meterplus.js.map +1 -1
  69. package/dist/device/motion.d.ts +6 -5
  70. package/dist/device/motion.d.ts.map +1 -1
  71. package/dist/device/motion.js +65 -58
  72. package/dist/device/motion.js.map +1 -1
  73. package/dist/device/plug.d.ts +13 -12
  74. package/dist/device/plug.d.ts.map +1 -1
  75. package/dist/device/plug.js +68 -52
  76. package/dist/device/plug.js.map +1 -1
  77. package/dist/device/robotvacuumcleaner.d.ts +12 -11
  78. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  79. package/dist/device/robotvacuumcleaner.js +93 -82
  80. package/dist/device/robotvacuumcleaner.js.map +1 -1
  81. package/dist/device/waterdetector.d.ts +6 -5
  82. package/dist/device/waterdetector.d.ts.map +1 -1
  83. package/dist/device/waterdetector.js +73 -63
  84. package/dist/device/waterdetector.js.map +1 -1
  85. package/dist/homebridge-ui/server.js +2 -2
  86. package/dist/homebridge-ui/server.js.map +1 -1
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +0 -4
  89. package/dist/index.js.map +1 -1
  90. package/dist/irdevice/airconditioner.d.ts +8 -8
  91. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  92. package/dist/irdevice/airconditioner.js +61 -105
  93. package/dist/irdevice/airconditioner.js.map +1 -1
  94. package/dist/irdevice/airpurifier.d.ts +10 -10
  95. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  96. package/dist/irdevice/airpurifier.js +22 -42
  97. package/dist/irdevice/airpurifier.js.map +1 -1
  98. package/dist/irdevice/camera.d.ts +9 -9
  99. package/dist/irdevice/camera.d.ts.map +1 -1
  100. package/dist/irdevice/camera.js +15 -25
  101. package/dist/irdevice/camera.js.map +1 -1
  102. package/dist/irdevice/fan.d.ts +8 -8
  103. package/dist/irdevice/fan.d.ts.map +1 -1
  104. package/dist/irdevice/fan.js +21 -40
  105. package/dist/irdevice/fan.js.map +1 -1
  106. package/dist/irdevice/irdevice.d.ts +11 -11
  107. package/dist/irdevice/irdevice.d.ts.map +1 -1
  108. package/dist/irdevice/irdevice.js +14 -22
  109. package/dist/irdevice/irdevice.js.map +1 -1
  110. package/dist/irdevice/light.d.ts +9 -9
  111. package/dist/irdevice/light.d.ts.map +1 -1
  112. package/dist/irdevice/light.js +24 -47
  113. package/dist/irdevice/light.js.map +1 -1
  114. package/dist/irdevice/other.d.ts +9 -9
  115. package/dist/irdevice/other.d.ts.map +1 -1
  116. package/dist/irdevice/other.js +40 -83
  117. package/dist/irdevice/other.js.map +1 -1
  118. package/dist/irdevice/tv.d.ts +9 -9
  119. package/dist/irdevice/tv.d.ts.map +1 -1
  120. package/dist/irdevice/tv.js +29 -54
  121. package/dist/irdevice/tv.js.map +1 -1
  122. package/dist/irdevice/vacuumcleaner.d.ts +5 -5
  123. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  124. package/dist/irdevice/vacuumcleaner.js +11 -21
  125. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  126. package/dist/irdevice/waterheater.d.ts +5 -5
  127. package/dist/irdevice/waterheater.d.ts.map +1 -1
  128. package/dist/irdevice/waterheater.js +11 -22
  129. package/dist/irdevice/waterheater.js.map +1 -1
  130. package/dist/platform.d.ts +24 -23
  131. package/dist/platform.d.ts.map +1 -1
  132. package/dist/platform.js +509 -723
  133. package/dist/platform.js.map +1 -1
  134. package/dist/settings.d.ts +5 -2
  135. package/dist/settings.d.ts.map +1 -1
  136. package/dist/settings.js.map +1 -1
  137. package/dist/types/bledevicestatus.d.ts +9 -9
  138. package/dist/types/bledevicestatus.d.ts.map +1 -1
  139. package/dist/types/devicelist.d.ts +6 -6
  140. package/dist/types/devicelist.d.ts.map +1 -1
  141. package/dist/types/deviceresponse.d.ts +4 -4
  142. package/dist/types/deviceresponse.d.ts.map +1 -1
  143. package/dist/types/devicestatus.d.ts +2 -2
  144. package/dist/types/devicestatus.d.ts.map +1 -1
  145. package/dist/types/devicewebhookstatus.d.ts +5 -5
  146. package/dist/types/devicewebhookstatus.d.ts.map +1 -1
  147. package/dist/types/irdevicelist.d.ts +4 -4
  148. package/dist/types/irdevicelist.d.ts.map +1 -1
  149. package/dist/types/pushbody.d.ts +2 -2
  150. package/dist/types/pushbody.d.ts.map +1 -1
  151. package/dist/utils.d.ts +4 -4
  152. package/dist/utils.d.ts.map +1 -1
  153. package/dist/utils.js +9 -13
  154. package/dist/utils.js.map +1 -1
  155. package/eslint.config.js +48 -93
  156. package/package.json +64 -57
  157. package/src/device/blindtilt.ts +537 -456
  158. package/src/device/bot-old.ts +1540 -0
  159. package/src/device/bot.ts +732 -725
  160. package/src/device/ceilinglight.ts +359 -368
  161. package/src/device/colorbulb.ts +441 -453
  162. package/src/device/contact.ts +229 -226
  163. package/src/device/curtain.ts +526 -444
  164. package/src/device/device.ts +206 -208
  165. package/src/device/fan.ts +336 -345
  166. package/src/device/hub.ts +213 -214
  167. package/src/device/humidifier.ts +326 -347
  168. package/src/device/iosensor.ts +211 -209
  169. package/src/device/lightstrip.ts +391 -404
  170. package/src/device/lock.ts +292 -282
  171. package/src/device/meter.ts +212 -210
  172. package/src/device/meterplus.ts +212 -209
  173. package/src/device/motion.ts +198 -190
  174. package/src/device/plug.ts +203 -182
  175. package/src/device/robotvacuumcleaner.ts +280 -269
  176. package/src/device/waterdetector.ts +198 -189
  177. package/src/homebridge-ui/server.ts +16 -15
  178. package/src/index.ts +5 -6
  179. package/src/irdevice/airconditioner.ts +277 -326
  180. package/src/irdevice/airpurifier.ts +124 -143
  181. package/src/irdevice/camera.ts +58 -64
  182. package/src/irdevice/fan.ts +106 -123
  183. package/src/irdevice/irdevice.ts +116 -119
  184. package/src/irdevice/light.ts +119 -143
  185. package/src/irdevice/other.ts +417 -461
  186. package/src/irdevice/tv.ts +155 -177
  187. package/src/irdevice/vacuumcleaner.ts +54 -60
  188. package/src/irdevice/waterheater.ts +56 -63
  189. package/src/platform.ts +1491 -1681
  190. package/src/settings.ts +172 -169
  191. package/src/types/bledevicestatus.ts +252 -256
  192. package/src/types/devicelist.ts +79 -79
  193. package/src/types/deviceresponse.ts +12 -13
  194. package/src/types/devicestatus.ts +124 -124
  195. package/src/types/devicewebhookstatus.ts +126 -131
  196. package/src/types/irdevicelist.ts +10 -10
  197. package/src/types/pushbody.ts +5 -5
  198. package/src/utils.ts +64 -65
  199. package/tsconfig.json +10 -9
@@ -2,19 +2,25 @@
2
2
  *
3
3
  * meterplus.ts: @switchbot/homebridge-switchbot.
4
4
  */
5
- import { Units } from 'homebridge';
6
- import { deviceBase } from './device.js';
7
- import { Subject, interval, skipWhile } from 'rxjs';
8
- import { convertUnits, validHumidity } from '../utils.js';
9
- import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
10
-
11
- import type { devicesConfig } from '../settings.js';
12
- import type { device } from '../types/devicelist.js';
13
- import type { SwitchBotPlatform } from '../platform.js';
14
- import type { meterPlusServiceData } from '../types/bledevicestatus.js';
15
- import type { meterPlusStatus } from '../types/devicestatus.js';
16
- import type { meterPlusWebhookContext } from '../types/devicewebhookstatus.js';
17
- import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
5
+ import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
6
+
7
+ import type { SwitchBotPlatform } from '../platform.js'
8
+ import type { devicesConfig } from '../settings.js'
9
+ import type { meterPlusServiceData } from '../types/bledevicestatus.js'
10
+ import type { device } from '../types/devicelist.js'
11
+ import type { meterPlusStatus } from '../types/devicestatus.js'
12
+ import type { meterPlusWebhookContext } from '../types/devicewebhookstatus.js'
13
+
14
+ import { Units } from 'homebridge'
15
+ /*
16
+ * For Testing Locally:
17
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
18
+ */
19
+ import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot'
20
+ import { interval, skipWhile, Subject } from 'rxjs'
21
+
22
+ import { convertUnits, validHumidity } from '../utils.js'
23
+ import { deviceBase } from './device.js'
18
24
 
19
25
  /**
20
26
  * Platform Accessory
@@ -24,239 +30,237 @@ import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge
24
30
  export class MeterPlus extends deviceBase {
25
31
  // Services
26
32
  private Battery: {
27
- Name: CharacteristicValue;
28
- Service: Service;
29
- BatteryLevel: CharacteristicValue;
30
- StatusLowBattery: CharacteristicValue;
31
- };
33
+ Name: CharacteristicValue
34
+ Service: Service
35
+ BatteryLevel: CharacteristicValue
36
+ StatusLowBattery: CharacteristicValue
37
+ }
32
38
 
33
39
  private HumiditySensor?: {
34
- Name: CharacteristicValue;
35
- Service: Service;
36
- CurrentRelativeHumidity: CharacteristicValue;
37
- };
40
+ Name: CharacteristicValue
41
+ Service: Service
42
+ CurrentRelativeHumidity: CharacteristicValue
43
+ }
38
44
 
39
45
  private TemperatureSensor?: {
40
- Name: CharacteristicValue;
41
- Service: Service;
42
- CurrentTemperature: CharacteristicValue;
43
- };
46
+ Name: CharacteristicValue
47
+ Service: Service
48
+ CurrentTemperature: CharacteristicValue
49
+ }
44
50
 
45
51
  // OpenAPI
46
- deviceStatus!: meterPlusStatus;
52
+ deviceStatus!: meterPlusStatus
47
53
 
48
- //Webhook
49
- webhookContext!: meterPlusWebhookContext;
54
+ // Webhook
55
+ webhookContext!: meterPlusWebhookContext
50
56
 
51
57
  // BLE
52
- serviceData!: meterPlusServiceData;
58
+ serviceData!: meterPlusServiceData
53
59
 
54
60
  // Updates
55
- meterUpdateInProgress!: boolean;
56
- doMeterUpdate: Subject<void>;
61
+ meterUpdateInProgress!: boolean
62
+ doMeterUpdate: Subject<void>
57
63
 
58
64
  constructor(
59
65
  readonly platform: SwitchBotPlatform,
60
66
  accessory: PlatformAccessory,
61
67
  device: device & devicesConfig,
62
68
  ) {
63
- super(platform, accessory, device);
69
+ super(platform, accessory, device)
64
70
  // Set category
65
- accessory.category = this.hap.Categories.SENSOR;
71
+ accessory.category = this.hap.Categories.SENSOR
66
72
 
67
73
  // this is subject we use to track when we need to POST changes to the SwitchBot API
68
- this.doMeterUpdate = new Subject();
69
- this.meterUpdateInProgress = false;
74
+ this.doMeterUpdate = new Subject()
75
+ this.meterUpdateInProgress = false
70
76
 
71
77
  // Initialize Battery Service
72
- accessory.context.Battery = accessory.context.Battery ?? {};
78
+ accessory.context.Battery = accessory.context.Battery ?? {}
73
79
  this.Battery = {
74
80
  Name: `${accessory.displayName} Battery`,
75
81
  Service: accessory.getService(this.hap.Service.Battery) ?? accessory.addService(this.hap.Service.Battery) as Service,
76
82
  BatteryLevel: accessory.context.BatteryLevel ?? 100,
77
83
  StatusLowBattery: accessory.context.StatusLowBattery ?? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
78
- };
79
- accessory.context.Battery = this.Battery as object;
84
+ }
85
+ accessory.context.Battery = this.Battery as object
80
86
 
81
87
  // Initialize Battery Characteristics
82
- this.Battery.Service
83
- .setCharacteristic(this.hap.Characteristic.Name, this.Battery.Name)
84
- .setCharacteristic(this.hap.Characteristic.ChargingState, this.hap.Characteristic.ChargingState.NOT_CHARGEABLE)
85
- .getCharacteristic(this.hap.Characteristic.BatteryLevel)
86
- .onGet(() => {
87
- return this.Battery.BatteryLevel;
88
- });
89
-
90
- this.Battery.Service
91
- .getCharacteristic(this.hap.Characteristic.StatusLowBattery)
92
- .onGet(() => {
93
- return this.Battery.StatusLowBattery;
94
- });
88
+ this.Battery.Service.setCharacteristic(this.hap.Characteristic.Name, this.Battery.Name).setCharacteristic(this.hap.Characteristic.ChargingState, this.hap.Characteristic.ChargingState.NOT_CHARGEABLE).getCharacteristic(this.hap.Characteristic.BatteryLevel).onGet(() => {
89
+ return this.Battery.BatteryLevel
90
+ })
91
+
92
+ this.Battery.Service.getCharacteristic(this.hap.Characteristic.StatusLowBattery).onGet(() => {
93
+ return this.Battery.StatusLowBattery
94
+ })
95
95
 
96
96
  // Initialize Temperature Sensor Service
97
97
  if (device.meter?.hide_temperature) {
98
98
  if (this.TemperatureSensor) {
99
- this.debugLog('Removing Temperature Sensor Service');
100
- this.TemperatureSensor.Service = this.accessory.getService(this.hap.Service.TemperatureSensor) as Service;
101
- accessory.removeService(this.TemperatureSensor.Service);
99
+ this.debugLog('Removing Temperature Sensor Service')
100
+ this.TemperatureSensor.Service = this.accessory.getService(this.hap.Service.TemperatureSensor) as Service
101
+ accessory.removeService(this.TemperatureSensor.Service)
102
102
  }
103
103
  } else {
104
- accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {};
104
+ accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {}
105
105
  this.TemperatureSensor = {
106
106
  Name: `${accessory.displayName} Temperature Sensor`,
107
107
  Service: accessory.getService(this.hap.Service.TemperatureSensor) ?? this.accessory.addService(this.hap.Service.TemperatureSensor) as Service,
108
108
  CurrentTemperature: accessory.context.CurrentTemperature ?? 30,
109
- };
110
- accessory.context.TemperatureSensor = this.TemperatureSensor as object;
109
+ }
110
+ accessory.context.TemperatureSensor = this.TemperatureSensor as object
111
111
 
112
112
  // Initialize Temperature Sensor Characteristics
113
- this.TemperatureSensor.Service
114
- .setCharacteristic(this.hap.Characteristic.Name, this.TemperatureSensor.Name)
115
- .getCharacteristic(this.hap.Characteristic.CurrentTemperature)
116
- .setProps({
117
- unit: Units['CELSIUS'],
118
- validValueRanges: [-273.15, 100],
119
- minValue: -273.15,
120
- maxValue: 100,
121
- minStep: 0.1,
122
- })
123
- .onGet(() => {
124
- return this.TemperatureSensor!.CurrentTemperature!;
125
- });
113
+ this.TemperatureSensor.Service.setCharacteristic(this.hap.Characteristic.Name, this.TemperatureSensor.Name).getCharacteristic(this.hap.Characteristic.CurrentTemperature).setProps({
114
+ unit: Units.CELSIUS,
115
+ validValueRanges: [-273.15, 100],
116
+ minValue: -273.15,
117
+ maxValue: 100,
118
+ minStep: 0.1,
119
+ }).onGet(() => {
120
+ return this.TemperatureSensor!.CurrentTemperature!
121
+ })
126
122
  }
127
123
  // Initialize Humidity Sensor Service
128
124
  if (device.meter?.hide_humidity) {
129
125
  if (this.HumiditySensor) {
130
- this.debugLog('Removing Humidity Sensor Service');
131
- this.HumiditySensor.Service = this.accessory.getService(this.hap.Service.HumiditySensor) as Service;
132
- accessory.removeService(this.HumiditySensor.Service);
126
+ this.debugLog('Removing Humidity Sensor Service')
127
+ this.HumiditySensor.Service = this.accessory.getService(this.hap.Service.HumiditySensor) as Service
128
+ accessory.removeService(this.HumiditySensor.Service)
133
129
  }
134
130
  } else {
135
- accessory.context.HumiditySensor = accessory.context.HumiditySensor ?? {};
131
+ accessory.context.HumiditySensor = accessory.context.HumiditySensor ?? {}
136
132
  this.HumiditySensor = {
137
133
  Name: `${accessory.displayName} Humidity Sensor`,
138
134
  Service: accessory.getService(this.hap.Service.HumiditySensor) ?? this.accessory.addService(this.hap.Service.HumiditySensor) as Service,
139
135
  CurrentRelativeHumidity: accessory.context.CurrentRelativeHumidity ?? 50,
140
- };
141
- accessory.context.HumiditySensor = this.HumiditySensor as object;
136
+ }
137
+ accessory.context.HumiditySensor = this.HumiditySensor as object
142
138
 
143
139
  // Initialize Humidity Sensor Characteristics
144
- this.HumiditySensor.Service
145
- .setCharacteristic(this.hap.Characteristic.Name, this.HumiditySensor.Name)
146
- .getCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity)
147
- .setProps({
148
- minStep: 0.1,
149
- })
150
- .onGet(() => {
151
- return this.HumiditySensor!.CurrentRelativeHumidity!;
152
- });
140
+ this.HumiditySensor.Service.setCharacteristic(this.hap.Characteristic.Name, this.HumiditySensor.Name).getCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity).setProps({
141
+ minStep: 0.1,
142
+ }).onGet(() => {
143
+ return this.HumiditySensor!.CurrentRelativeHumidity!
144
+ })
153
145
  }
154
146
 
155
147
  // Retrieve initial values and updateHomekit
156
- this.debugLog('Retrieve initial values and update Homekit');
157
- this.refreshStatus();
148
+ try {
149
+ this.debugLog('Retrieve initial values and update Homekit')
150
+ this.refreshStatus()
151
+ } catch (e: any) {
152
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`)
153
+ }
154
+
155
+ // regisiter webhook event handler if enabled
156
+ try {
157
+ this.debugLog('Registering Webhook Event Handler')
158
+ this.registerWebhook()
159
+ } catch (e: any) {
160
+ this.errorLog(`failed to registerWebhook, Error: ${e}`)
161
+ }
158
162
 
159
- //regisiter webhook event handler
160
- this.debugLog('Registering Webhook Event Handler');
161
- this.registerWebhook();
163
+ // regisiter platform BLE event handler if enabled
164
+ try {
165
+ this.debugLog('Registering Platform BLE Event Handler')
166
+ this.registerPlatformBLE()
167
+ } catch (e: any) {
168
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`)
169
+ }
162
170
 
163
171
  // Start an update interval
164
172
  interval(this.deviceRefreshRate * 1000)
165
173
  .pipe(skipWhile(() => this.meterUpdateInProgress))
166
174
  .subscribe(async () => {
167
- await this.refreshStatus();
168
- });
175
+ await this.refreshStatus()
176
+ })
169
177
  }
170
178
 
171
179
  async BLEparseStatus(): Promise<void> {
172
- await this.debugLog('BLEparseStatus');
173
- await this.debugLog(`(temperature, humidity) = BLE:(${this.serviceData.temperature.c}, ${this.serviceData.humidity}),`
174
- + ` current:(${this.TemperatureSensor?.CurrentTemperature}, ${this.HumiditySensor?.CurrentRelativeHumidity})`);
180
+ await this.debugLog('BLEparseStatus')
181
+ await this.debugLog(`(temperature, humidity) = BLE:(${this.serviceData.temperature.c}, ${this.serviceData.humidity}), current:(${this.TemperatureSensor?.CurrentTemperature}, ${this.HumiditySensor?.CurrentRelativeHumidity})`)
175
182
 
176
183
  // CurrentRelativeHumidity
177
184
  if (!this.device.iosensor?.hide_humidity && this.HumiditySensor?.Service) {
178
- this.HumiditySensor.CurrentRelativeHumidity = validHumidity(this.serviceData.humidity, 0, 100);
179
- await this.debugLog(`CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}%`);
185
+ this.HumiditySensor.CurrentRelativeHumidity = validHumidity(this.serviceData.humidity, 0, 100)
186
+ await this.debugLog(`CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}%`)
180
187
  }
181
188
  // Current Temperature
182
189
  if (!this.device.meter?.hide_temperature && this.TemperatureSensor?.Service) {
183
- const CELSIUS = this.serviceData.temperature.c < 0 ? 0 : this.serviceData.temperature.c > 100 ? 100 : this.serviceData.temperature.c;
184
- this.TemperatureSensor.CurrentTemperature = CELSIUS;
185
- await this.debugLog(`CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}°c`);
190
+ const CELSIUS = this.serviceData.temperature.c < 0 ? 0 : this.serviceData.temperature.c > 100 ? 100 : this.serviceData.temperature.c
191
+ this.TemperatureSensor.CurrentTemperature = CELSIUS
192
+ await this.debugLog(`CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}°c`)
186
193
  }
187
194
  // BatteryLevel
188
- this.Battery.BatteryLevel = this.serviceData.battery;
189
- await this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`);
195
+ this.Battery.BatteryLevel = this.serviceData.battery
196
+ await this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
190
197
  // StatusLowBattery
191
198
  this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
192
- ? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW : this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
193
- await this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`);
199
+ ? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
200
+ : this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
201
+ await this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
194
202
  }
195
203
 
196
204
  async openAPIparseStatus(): Promise<void> {
197
- await this.debugLog('openAPIparseStatus');
198
- await this.debugLog(`(temperature, humidity) = OpenAPI:(${this.deviceStatus.temperature}, ${this.deviceStatus.humidity}),`
199
- + ` current:(${this.TemperatureSensor?.CurrentTemperature}, ${this.HumiditySensor?.CurrentRelativeHumidity})`);
205
+ await this.debugLog('openAPIparseStatus')
206
+ await this.debugLog(`(temperature, humidity) = OpenAPI:(${this.deviceStatus.temperature}, ${this.deviceStatus.humidity}), current:(${this.TemperatureSensor?.CurrentTemperature}, ${this.HumiditySensor?.CurrentRelativeHumidity})`)
200
207
 
201
208
  // CurrentRelativeHumidity
202
209
  if (!this.device.meter?.hide_humidity && this.HumiditySensor?.Service) {
203
- this.HumiditySensor.CurrentRelativeHumidity = this.deviceStatus.humidity;
204
- await this.debugLog(`CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}%`);
210
+ this.HumiditySensor.CurrentRelativeHumidity = this.deviceStatus.humidity
211
+ await this.debugLog(`CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}%`)
205
212
  }
206
213
 
207
214
  // CurrentTemperature
208
215
  if (!this.device.meter?.hide_temperature && this.TemperatureSensor?.Service) {
209
- this.TemperatureSensor.CurrentTemperature = this.deviceStatus.temperature;
210
- await this.debugLog(`CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}°c`);
216
+ this.TemperatureSensor.CurrentTemperature = this.deviceStatus.temperature
217
+ await this.debugLog(`CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}°c`)
211
218
  }
212
219
 
213
220
  // BatteryLevel
214
- this.Battery.BatteryLevel = this.deviceStatus.battery;
215
- await this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`);
221
+ this.Battery.BatteryLevel = this.deviceStatus.battery
222
+ await this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
216
223
 
217
224
  // StatusLowBattery
218
225
  this.Battery.StatusLowBattery = this.Battery.BatteryLevel < 10
219
- ? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW : this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
220
- await this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`);
226
+ ? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW
227
+ : this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL
228
+ await this.debugLog(`StatusLowBattery: ${this.Battery.StatusLowBattery}`)
221
229
 
222
230
  // FirmwareVersion
223
231
  if (this.deviceStatus.version) {
224
- const version = this.deviceStatus.version.toString();
225
- this.debugLog(`Firmware Version: ${version.replace(/^V|-.*$/g, '')}`);
226
- const deviceVersion = version.replace(/^V|-.*$/g, '') ?? '0.0.0';
232
+ const version = this.deviceStatus.version.toString()
233
+ this.debugLog(`Firmware Version: ${version.replace(/^V|-.*$/g, '')}`)
234
+ const deviceVersion = version.replace(/^V|-.*$/g, '') ?? '0.0.0'
227
235
  this.accessory
228
236
  .getService(this.hap.Service.AccessoryInformation)!
229
237
  .setCharacteristic(this.hap.Characteristic.HardwareRevision, deviceVersion)
230
238
  .setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
231
239
  .getCharacteristic(this.hap.Characteristic.FirmwareRevision)
232
- .updateValue(deviceVersion);
233
- this.accessory.context.version = deviceVersion;
234
- this.debugSuccessLog(`v: ${this.accessory.context.version}`);
240
+ .updateValue(deviceVersion)
241
+ this.accessory.context.version = deviceVersion
242
+ this.debugSuccessLog(`v: ${this.accessory.context.version}`)
235
243
  }
236
244
  }
237
245
 
238
246
  async parseStatusWebhook(): Promise<void> {
239
- await this.debugLog('parseStatusWebhook');
240
- await this.debugLog(`(scale, temperature, humidity) = Webhook:(${this.webhookContext.scale}, ${convertUnits(this.webhookContext.temperature,
241
- this.webhookContext.scale, this.device.meter?.convertUnitTo)}, ${this.webhookContext.humidity}),`
242
- + ` current:(${this.TemperatureSensor?.CurrentTemperature}, ${this.HumiditySensor?.CurrentRelativeHumidity})`);
247
+ await this.debugLog('parseStatusWebhook')
248
+ await this.debugLog(`(scale, temperature, humidity) = Webhook:(${this.webhookContext.scale}, ${convertUnits(this.webhookContext.temperature, this.webhookContext.scale, this.device.meter?.convertUnitTo)}, ${this.webhookContext.humidity}) current:(${this.TemperatureSensor?.CurrentTemperature}, ${this.HumiditySensor?.CurrentRelativeHumidity})`)
243
249
  // Check if the scale is not CELSIUS
244
250
  if (this.webhookContext.scale !== 'CELSIUS' && this.device.hub?.convertUnitTo === undefined) {
245
- await this.warnLog(`received a non-CELSIUS Webhook scale: ${this.webhookContext.scale}, Use the *convertUnitsTo* config under Hub settings,`
246
- + ' if displaying incorrectly in HomeKit.');
251
+ await this.warnLog(`received a non-CELSIUS Webhook scale: ${this.webhookContext.scale}, Use the *convertUnitsTo* config under Hub settings, if displaying incorrectly in HomeKit.`)
247
252
  }
248
253
 
249
254
  // CurrentRelativeHumidity
250
255
  if (!this.device.meter?.hide_humidity && this.HumiditySensor?.Service) {
251
- this.HumiditySensor.CurrentRelativeHumidity = this.webhookContext.humidity;
252
- await this.debugLog(`CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}`);
256
+ this.HumiditySensor.CurrentRelativeHumidity = this.webhookContext.humidity
257
+ await this.debugLog(`CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}`)
253
258
  }
254
259
 
255
260
  // CurrentTemperature
256
261
  if (!this.device.meter?.hide_temperature && this.TemperatureSensor?.Service) {
257
- this.TemperatureSensor.CurrentTemperature = convertUnits(this.webhookContext.temperature, this.webhookContext.scale,
258
- this.device.hub?.convertUnitTo);
259
- await this.debugLog(`CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}`);
262
+ this.TemperatureSensor.CurrentTemperature = convertUnits(this.webhookContext.temperature, this.webhookContext.scale, this.device.hub?.convertUnitTo)
263
+ await this.debugLog(`CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}`)
260
264
  }
261
265
  }
262
266
 
@@ -265,93 +269,97 @@ export class MeterPlus extends deviceBase {
265
269
  */
266
270
  async refreshStatus(): Promise<void> {
267
271
  if (!this.device.enableCloudService && this.OpenAPI) {
268
- await this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`);
269
- } else if (this.BLE || this.config.options?.BLE) {
270
- await this.BLERefreshStatus();
272
+ await this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
273
+ } else if (this.BLE) {
274
+ await this.BLERefreshStatus()
271
275
  } else if (this.OpenAPI && this.platform.config.credentials?.token) {
272
- await this.openAPIRefreshStatus();
276
+ await this.openAPIRefreshStatus()
273
277
  } else {
274
- await this.offlineOff();
275
- await this.debugWarnLog(`Connection Type: ${this.device.connectionType}, refreshStatus will not happen.`);
278
+ await this.offlineOff()
279
+ await this.debugWarnLog(`Connection Type: ${this.device.connectionType}, refreshStatus will not happen.`)
276
280
  }
277
281
  }
278
282
 
279
283
  async BLERefreshStatus(): Promise<void> {
280
- await this.debugLog('BLERefreshStatus');
284
+ await this.debugLog('BLERefreshStatus')
285
+ const switchbot = await this.switchbotBLE()
286
+ if (switchbot === undefined) {
287
+ await this.BLERefreshConnection(switchbot)
288
+ } else {
289
+ // Start to monitor advertisement packets
290
+ (async () => {
291
+ // Start to monitor advertisement packets
292
+ const serviceData = await this.monitorAdvertisementPackets(switchbot) as meterPlusServiceData
293
+ // Update HomeKit
294
+ if (serviceData.model === SwitchBotBLEModel.MeterPlus && serviceData.modelName === SwitchBotBLEModelName.MeterPlus) {
295
+ this.serviceData = serviceData
296
+ await this.BLEparseStatus()
297
+ await this.updateHomeKitCharacteristics()
298
+ } else {
299
+ await this.errorLog(`failed to get serviceData, serviceData: ${serviceData}`)
300
+ await this.BLERefreshConnection(switchbot)
301
+ }
302
+ })()
303
+ }
304
+ }
305
+
306
+ async registerPlatformBLE(): Promise<void> {
307
+ await this.debugLog('registerPlatformBLE')
281
308
  if (this.config.options?.BLE) {
282
- await this.debugLog('is listening to Platform BLE.');
283
- this.device.bleMac = this.device.deviceId!.match(/.{1,2}/g)!.join(':').toLowerCase();
284
- await this.debugLog(`bleMac: ${this.device.bleMac}`);
309
+ await this.debugLog('is listening to Platform BLE.')
310
+ this.device.bleMac = this.device.deviceId!.match(/.{1,2}/g)!.join(':').toLowerCase()
311
+ await this.debugLog(`bleMac: ${this.device.bleMac}`)
285
312
  this.platform.bleEventHandler[this.device.bleMac] = async (context: meterPlusServiceData) => {
286
313
  try {
287
- await this.debugLog(`received BLE: ${JSON.stringify(context)}`);
288
- this.serviceData = context;
289
- await this.BLEparseStatus();
290
- await this.updateHomeKitCharacteristics();
314
+ await this.debugLog(`received BLE: ${JSON.stringify(context)}`)
315
+ this.serviceData = context
316
+ await this.BLEparseStatus()
317
+ await this.updateHomeKitCharacteristics()
291
318
  } catch (e: any) {
292
- await this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e}`);
319
+ await this.errorLog(`failed to handle BLE. Received: ${JSON.stringify(context)} Error: ${e}`)
293
320
  }
294
- };
295
- } else {
296
- await this.debugLog('is using Device BLE Scanning.');
297
- const switchbot = await this.switchbotBLE();
298
- if (switchbot === undefined) {
299
- await this.BLERefreshConnection(switchbot);
300
- } else {
301
- // Start to monitor advertisement packets
302
- (async () => {
303
- // Start to monitor advertisement packets
304
- const serviceData = await this.monitorAdvertisementPackets(switchbot) as meterPlusServiceData;
305
- // Update HomeKit
306
- if (serviceData.model === SwitchBotBLEModel.MeterPlus && serviceData.modelName === SwitchBotBLEModelName.MeterPlus) {
307
- this.serviceData = serviceData;
308
- await this.BLEparseStatus();
309
- await this.updateHomeKitCharacteristics();
310
- } else {
311
- await this.errorLog(`failed to get serviceData, serviceData: ${serviceData}`);
312
- await this.BLERefreshConnection(switchbot);
313
- }
314
- })();
315
321
  }
322
+ } else {
323
+ await this.debugLog('is not listening to Platform BLE')
316
324
  }
317
325
  }
318
326
 
319
327
  async openAPIRefreshStatus(): Promise<void> {
320
- await this.debugLog('openAPIRefreshStatus');
328
+ await this.debugLog('openAPIRefreshStatus')
321
329
  try {
322
- const { body, statusCode } = await this.deviceRefreshStatus();
323
- const deviceStatus: any = await body.json();
324
- await this.debugLog(`statusCode: ${statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);;
330
+ const { body, statusCode } = await this.deviceRefreshStatus()
331
+ const deviceStatus: any = await body.json()
332
+ await this.debugLog(`statusCode: ${statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
325
333
  if (await this.successfulStatusCodes(statusCode, deviceStatus)) {
326
- await this.debugSuccessLog(`statusCode: ${statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
327
- this.deviceStatus = deviceStatus.body;
328
- await this.openAPIparseStatus();
329
- await this.updateHomeKitCharacteristics();
334
+ await this.debugSuccessLog(`statusCode: ${statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
335
+ this.deviceStatus = deviceStatus.body
336
+ await this.openAPIparseStatus()
337
+ await this.updateHomeKitCharacteristics()
330
338
  } else {
331
- await this.debugWarnLog(`statusCode: ${statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`);
332
- await this.debugWarnLog(statusCode, deviceStatus);
339
+ await this.debugWarnLog(`statusCode: ${statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
340
+ await this.debugWarnLog(statusCode, deviceStatus)
333
341
  }
334
342
  } catch (e: any) {
335
- await this.apiError(e);
336
- await this.errorLog(`failed openAPIRefreshStatus with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`);
343
+ await this.apiError(e)
344
+ await this.errorLog(`failed openAPIRefreshStatus with ${this.device.connectionType} Connection, Error Message: ${JSON.stringify(e.message)}`)
337
345
  }
338
346
  }
339
347
 
340
348
  async registerWebhook() {
341
349
  if (this.device.webhook) {
342
- await this.debugLog('is listening webhook.');
350
+ await this.debugLog('is listening webhook.')
343
351
  this.platform.webhookEventHandler[this.device.deviceId] = async (context: meterPlusWebhookContext) => {
344
352
  try {
345
- await this.debugLog(`received Webhook: ${JSON.stringify(context)}`);
346
- this.webhookContext = context;
347
- await this.parseStatusWebhook();
348
- await this.updateHomeKitCharacteristics();
353
+ await this.debugLog(`received Webhook: ${JSON.stringify(context)}`)
354
+ this.webhookContext = context
355
+ await this.parseStatusWebhook()
356
+ await this.updateHomeKitCharacteristics()
349
357
  } catch (e: any) {
350
- await this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e}`);
358
+ await this.errorLog(`failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e}`)
351
359
  }
352
- };
360
+ }
353
361
  } else {
354
- await this.debugLog('is not listening webhook.');
362
+ await this.debugLog('is not listening webhook.')
355
363
  }
356
364
  }
357
365
 
@@ -361,52 +369,47 @@ export class MeterPlus extends deviceBase {
361
369
  async updateHomeKitCharacteristics(): Promise<void> {
362
370
  // CurrentRelativeHumidity
363
371
  if (!this.device.meter?.hide_humidity && this.HumiditySensor?.Service) {
364
- await this.updateCharacteristic(this.HumiditySensor.Service, this.hap.Characteristic.CurrentRelativeHumidity,
365
- this.HumiditySensor.CurrentRelativeHumidity, 'CurrentRelativeHumidity');
372
+ await this.updateCharacteristic(this.HumiditySensor.Service, this.hap.Characteristic.CurrentRelativeHumidity, this.HumiditySensor.CurrentRelativeHumidity, 'CurrentRelativeHumidity')
366
373
  }
367
374
  // CurrentTemperature
368
375
  if (!this.device.meter?.hide_temperature && this.TemperatureSensor?.Service) {
369
- await this.updateCharacteristic(this.TemperatureSensor.Service, this.hap.Characteristic.CurrentTemperature,
370
- this.TemperatureSensor.CurrentTemperature, 'CurrentTemperature');
376
+ await this.updateCharacteristic(this.TemperatureSensor.Service, this.hap.Characteristic.CurrentTemperature, this.TemperatureSensor.CurrentTemperature, 'CurrentTemperature')
371
377
  }
372
378
  // BatteryLevel
373
- await this.updateCharacteristic(this.Battery.Service, this.hap.Characteristic.BatteryLevel,
374
- this.Battery.BatteryLevel, 'BatteryLevel');
379
+ await this.updateCharacteristic(this.Battery.Service, this.hap.Characteristic.BatteryLevel, this.Battery.BatteryLevel, 'BatteryLevel')
375
380
  // StatusLowBattery
376
- await this.updateCharacteristic(this.Battery.Service, this.hap.Characteristic.StatusLowBattery,
377
- this.Battery.StatusLowBattery, 'StatusLowBattery');
381
+ await this.updateCharacteristic(this.Battery.Service, this.hap.Characteristic.StatusLowBattery, this.Battery.StatusLowBattery, 'StatusLowBattery')
378
382
  }
379
383
 
380
384
  async BLERefreshConnection(switchbot: any): Promise<void> {
381
- await this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
385
+ await this.errorLog(`wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`)
382
386
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
383
- await this.warnLog('Using OpenAPI Connection to Refresh Status');
384
- await this.openAPIRefreshStatus();
387
+ await this.warnLog('Using OpenAPI Connection to Refresh Status')
388
+ await this.openAPIRefreshStatus()
385
389
  }
386
390
  }
387
391
 
388
392
  async offlineOff(): Promise<void> {
389
393
  if (this.device.offline) {
390
394
  if (!this.device.meter?.hide_humidity && this.HumiditySensor?.Service) {
391
- this.HumiditySensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, 50);
395
+ this.HumiditySensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, 50)
392
396
  }
393
397
  if (!this.device.meter?.hide_temperature && this.TemperatureSensor?.Service) {
394
- this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, 30);
398
+ this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, 30)
395
399
  }
396
- this.Battery.Service.updateCharacteristic(this.hap.Characteristic.BatteryLevel, 100);
397
- this.Battery.Service.updateCharacteristic(this.hap.Characteristic.StatusLowBattery,
398
- this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL);
400
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.BatteryLevel, 100)
401
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.StatusLowBattery, this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL)
399
402
  }
400
403
  }
401
404
 
402
405
  async apiError(e: any): Promise<void> {
403
406
  if (!this.device.meter?.hide_humidity && this.HumiditySensor?.Service) {
404
- this.HumiditySensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, e);
407
+ this.HumiditySensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, e)
405
408
  }
406
409
  if (!this.device.meter?.hide_temperature && this.TemperatureSensor?.Service) {
407
- this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e);
410
+ this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e)
408
411
  }
409
- this.Battery.Service.updateCharacteristic(this.hap.Characteristic.BatteryLevel, e);
410
- this.Battery.Service.updateCharacteristic(this.hap.Characteristic.StatusLowBattery, e);
412
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.BatteryLevel, e)
413
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.StatusLowBattery, e)
411
414
  }
412
415
  }