homebridge-kasa-python 2.7.0-beta.9 → 2.7.0

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 (49) hide show
  1. package/README.md +343 -562
  2. package/config.schema.json +23 -1
  3. package/dist/accessoryInformation.js +28 -13
  4. package/dist/accessoryInformation.js.map +1 -1
  5. package/dist/config.d.ts +6 -0
  6. package/dist/config.js +25 -26
  7. package/dist/config.js.map +1 -1
  8. package/dist/devices/create.js +15 -9
  9. package/dist/devices/create.js.map +1 -1
  10. package/dist/devices/deviceManager.d.ts +5 -3
  11. package/dist/devices/deviceManager.js +32 -66
  12. package/dist/devices/deviceManager.js.map +1 -1
  13. package/dist/devices/homekitLightBulb.d.ts +11 -1
  14. package/dist/devices/homekitLightBulb.js +219 -119
  15. package/dist/devices/homekitLightBulb.js.map +1 -1
  16. package/dist/devices/homekitPlug.d.ts +10 -0
  17. package/dist/devices/homekitPlug.js +181 -82
  18. package/dist/devices/homekitPlug.js.map +1 -1
  19. package/dist/devices/homekitPowerStrip.d.ts +10 -0
  20. package/dist/devices/homekitPowerStrip.js +196 -93
  21. package/dist/devices/homekitPowerStrip.js.map +1 -1
  22. package/dist/devices/homekitSwitch.d.ts +11 -1
  23. package/dist/devices/homekitSwitch.js +188 -92
  24. package/dist/devices/homekitSwitch.js.map +1 -1
  25. package/dist/devices/homekitSwitchWithChildren.d.ts +34 -0
  26. package/dist/devices/homekitSwitchWithChildren.js +365 -0
  27. package/dist/devices/homekitSwitchWithChildren.js.map +1 -0
  28. package/dist/devices/index.d.ts +5 -6
  29. package/dist/devices/index.js +18 -17
  30. package/dist/devices/index.js.map +1 -1
  31. package/dist/devices/kasaDevices.d.ts +4 -11
  32. package/dist/devices/kasaDevices.js +83 -95
  33. package/dist/devices/kasaDevices.js.map +1 -1
  34. package/dist/platform.d.ts +8 -4
  35. package/dist/platform.js +73 -44
  36. package/dist/platform.js.map +1 -1
  37. package/dist/python/kasaApi.py +349 -171
  38. package/dist/python/pythonChecker.d.ts +6 -4
  39. package/dist/python/pythonChecker.js +53 -20
  40. package/dist/python/pythonChecker.js.map +1 -1
  41. package/dist/python/startKasaApi.py +25 -0
  42. package/dist/taskQueue.d.ts +11 -0
  43. package/dist/taskQueue.js +44 -0
  44. package/dist/taskQueue.js.map +1 -0
  45. package/dist/utils.d.ts +1 -1
  46. package/dist/utils.js +8 -4
  47. package/dist/utils.js.map +1 -1
  48. package/package.json +14 -15
  49. package/requirements.txt +3 -3
@@ -1,3 +1,4 @@
1
+ import { EventEmitter } from 'node:events';
1
2
  import HomeKitDevice from './index.js';
2
3
  import { deferAndCombine } from '../utils.js';
3
4
  export default class HomeKitDeviceLightBulb extends HomeKitDevice {
@@ -9,6 +10,8 @@ export default class HomeKitDeviceLightBulb extends HomeKitDevice {
9
10
  hasHSV;
10
11
  previousKasaDevice;
11
12
  pollingInterval;
13
+ updateEmitter = new EventEmitter();
14
+ static locks = new Map();
12
15
  constructor(platform, kasaDevice) {
13
16
  super(platform, kasaDevice, 5 /* Categories.LIGHTBULB */, 'LIGHTBULB');
14
17
  this.kasaDevice = kasaDevice;
@@ -20,7 +23,7 @@ export default class HomeKitDeviceLightBulb extends HomeKitDevice {
20
23
  this.getSysInfo = deferAndCombine(async () => {
21
24
  if (this.deviceManager) {
22
25
  this.previousKasaDevice = JSON.parse(JSON.stringify(this.kasaDevice));
23
- this.kasaDevice.sys_info = await this.deviceManager.getSysInfo(this.deviceConfig);
26
+ this.kasaDevice.sys_info = await this.deviceManager.getSysInfo(this.kasaDevice.sys_info.host);
24
27
  this.log.debug(`Updated sys_info for device: ${this.kasaDevice.sys_info.alias}`);
25
28
  }
26
29
  else {
@@ -28,53 +31,84 @@ export default class HomeKitDeviceLightBulb extends HomeKitDevice {
28
31
  }
29
32
  }, platform.config.advancedOptions.waitTimeUpdate);
30
33
  this.startPolling();
34
+ platform.periodicDeviceDiscoveryEmitter.on('periodicDeviceDiscoveryComplete', () => {
35
+ this.updateEmitter.emit('periodicDeviceDiscoveryComplete');
36
+ });
37
+ }
38
+ async withLock(key, action) {
39
+ let lock = HomeKitDeviceLightBulb.locks.get(key);
40
+ if (!lock) {
41
+ lock = Promise.resolve();
42
+ }
43
+ const currentLock = lock.then(async () => {
44
+ try {
45
+ return await action();
46
+ }
47
+ finally {
48
+ if (HomeKitDeviceLightBulb.locks.get(key) === currentLock) {
49
+ HomeKitDeviceLightBulb.locks.delete(key);
50
+ }
51
+ }
52
+ });
53
+ HomeKitDeviceLightBulb.locks.set(key, currentLock.then(() => { }));
54
+ return currentLock;
31
55
  }
32
56
  checkService() {
33
- const { Lightbulb } = this.platform.Service;
34
- const service = this.homebridgeAccessory.getService(Lightbulb) ?? this.addService(Lightbulb, this.name);
57
+ const serviceType = this.getServiceType();
58
+ const service = this.homebridgeAccessory.getService(serviceType) ?? this.addService(serviceType, this.name);
35
59
  this.checkCharacteristics(service);
36
- return service;
60
+ }
61
+ getServiceType() {
62
+ const { Lightbulb } = this.platform.Service;
63
+ return Lightbulb;
37
64
  }
38
65
  checkCharacteristics(service) {
39
- const characteristics = [
40
- {
41
- type: this.platform.Characteristic.On,
42
- name: this.platform.getCharacteristicName(this.platform.Characteristic.On),
43
- },
44
- this.hasBrightness && {
66
+ const characteristics = this.getCharacteristics();
67
+ characteristics.forEach(({ type, name }) => {
68
+ this.getOrAddCharacteristic(service, type, name);
69
+ });
70
+ }
71
+ getCharacteristics() {
72
+ const characteristics = [];
73
+ characteristics.push({
74
+ type: this.platform.Characteristic.On,
75
+ name: this.platform.getCharacteristicName(this.platform.Characteristic.On),
76
+ });
77
+ if (this.hasBrightness) {
78
+ characteristics.push({
45
79
  type: this.platform.Characteristic.Brightness,
46
80
  name: this.platform.getCharacteristicName(this.platform.Characteristic.Brightness),
47
- },
48
- this.hasColorTemp && {
81
+ });
82
+ }
83
+ if (this.hasColorTemp) {
84
+ characteristics.push({
49
85
  type: this.platform.Characteristic.ColorTemperature,
50
86
  name: this.platform.getCharacteristicName(this.platform.Characteristic.ColorTemperature),
51
- },
52
- this.hasHSV && {
87
+ });
88
+ }
89
+ if (this.hasHSV) {
90
+ characteristics.push({
53
91
  type: this.platform.Characteristic.Hue,
54
92
  name: this.platform.getCharacteristicName(this.platform.Characteristic.Hue),
55
- },
56
- this.hasHSV && {
93
+ }, {
57
94
  type: this.platform.Characteristic.Saturation,
58
95
  name: this.platform.getCharacteristicName(this.platform.Characteristic.Saturation),
59
- },
60
- ].filter(Boolean);
61
- characteristics.forEach(({ type, name }) => {
62
- this.getOrAddCharacteristic(service, type, name);
63
- });
96
+ });
97
+ }
98
+ return characteristics;
64
99
  }
65
100
  getOrAddCharacteristic(service, characteristicType, characteristicName) {
66
101
  const characteristic = service.getCharacteristic(characteristicType) ??
67
102
  service.addCharacteristic(characteristicType);
68
103
  characteristic.onGet(this.handleOnGet.bind(this, service, characteristicType, characteristicName));
69
104
  characteristic.onSet(this.handleOnSet.bind(this, service, characteristicType, characteristicName));
70
- return characteristic;
71
105
  }
72
106
  async handleOnGet(service, characteristicType, characteristicName) {
107
+ if (this.kasaDevice.offline || this.platform.isShuttingDown) {
108
+ this.log.warn(`Device is offline or platform is shutting down, cannot get value for characteristic ${characteristicName}`);
109
+ return this.getDefaultValue(characteristicType);
110
+ }
73
111
  try {
74
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
75
- this.log.warn(`Device is offline or platform is shutting down, cannot set value for characteristic ${characteristicName}`);
76
- return this.getDefaultValue(characteristicType);
77
- }
78
112
  let characteristicValue = service.getCharacteristic(characteristicType).value;
79
113
  if (!characteristicValue) {
80
114
  characteristicValue = this.getInitialValue(characteristicType);
@@ -87,8 +121,20 @@ export default class HomeKitDeviceLightBulb extends HomeKitDevice {
87
121
  this.log.error(`Error getting current value for characteristic ${characteristicName} for device: ${this.name}:`, error);
88
122
  this.kasaDevice.offline = true;
89
123
  this.stopPolling();
124
+ return this.getDefaultValue(characteristicType);
90
125
  }
91
- return this.getDefaultValue(characteristicType);
126
+ }
127
+ getDefaultValue(characteristicType) {
128
+ const zeroValueCharacteristics = [
129
+ this.platform.Characteristic.Brightness,
130
+ this.platform.Characteristic.ColorTemperature,
131
+ this.platform.Characteristic.Hue,
132
+ this.platform.Characteristic.Saturation,
133
+ ];
134
+ if (zeroValueCharacteristics.includes(characteristicType)) {
135
+ return 0;
136
+ }
137
+ return false;
92
138
  }
93
139
  getInitialValue(characteristicType) {
94
140
  if (characteristicType === this.platform.Characteristic.On) {
@@ -108,112 +154,165 @@ export default class HomeKitDeviceLightBulb extends HomeKitDevice {
108
154
  }
109
155
  return this.getDefaultValue(characteristicType);
110
156
  }
111
- getDefaultValue(characteristicType) {
112
- const zeroValueCharacteristics = [
113
- this.platform.Characteristic.Brightness,
114
- this.platform.Characteristic.ColorTemperature,
115
- this.platform.Characteristic.Hue,
116
- this.platform.Characteristic.Saturation,
117
- ];
118
- if (zeroValueCharacteristics.includes(characteristicType)) {
119
- return 0;
120
- }
121
- return false;
122
- }
123
157
  async handleOnSet(service, characteristicType, characteristicName, value) {
124
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
125
- this.log.warn(`Device is offline or platform is shutting down, cannot set value for characteristic ${characteristicName}`);
126
- return;
127
- }
128
- if (this.deviceManager) {
129
- try {
130
- this.isUpdating = true;
131
- this.log.debug(`Setting value for characteristic ${characteristicName} to ${value}`);
132
- const characteristicMap = {
133
- Brightness: 'brightness',
134
- On: 'state',
135
- ColorTemperature: 'color_temp',
136
- Hue: 'hue',
137
- Saturation: 'saturation',
138
- };
139
- const characteristicKey = characteristicMap[characteristicName ?? ''];
140
- if (!characteristicKey) {
141
- throw new Error(`Characteristic key not found for ${characteristicName}`);
142
- }
143
- await this.deviceManager.controlDevice(this.deviceConfig, characteristicKey, value);
144
- this.kasaDevice.sys_info[characteristicKey] = value;
145
- this.updateValue(service, service.getCharacteristic(characteristicType), this.name, value);
146
- this.previousKasaDevice = JSON.parse(JSON.stringify(this.kasaDevice));
147
- this.log.debug(`Set value for characteristic ${characteristicName} to ${value} successfully`);
148
- }
149
- catch (error) {
150
- this.log.error(`Error setting current value for characteristic ${characteristicName} for device: ${this.name}:`, error);
151
- this.kasaDevice.offline = true;
152
- this.stopPolling();
158
+ const lockKey = `${this.kasaDevice.sys_info.device_id}`;
159
+ await this.withLock(lockKey, async () => {
160
+ if (this.kasaDevice.offline || this.platform.isShuttingDown) {
161
+ this.log.warn(`Device is offline or platform is shutting down, cannot set value for characteristic ${characteristicName}`);
162
+ return;
153
163
  }
154
- finally {
155
- this.isUpdating = false;
164
+ if (this.isUpdating || this.platform.periodicDeviceDiscovering) {
165
+ await Promise.race([
166
+ new Promise((resolve) => this.updateEmitter.once('updateComplete', resolve)),
167
+ new Promise((resolve) => this.updateEmitter.once('periodicDeviceDiscoveryComplete', resolve)),
168
+ ]);
156
169
  }
157
- }
158
- else {
159
- throw new Error('Device manager is undefined.');
160
- }
170
+ const task = async () => {
171
+ if (this.deviceManager) {
172
+ try {
173
+ this.isUpdating = true;
174
+ this.log.debug(`Setting value for characteristic ${characteristicName} to ${value}`);
175
+ const characteristicKey = this.getCharacteristicKey(characteristicName);
176
+ if (!characteristicKey) {
177
+ throw new Error(`Characteristic key not found for ${characteristicName}`);
178
+ }
179
+ await this.deviceManager.controlDevice(this.kasaDevice.sys_info.host, characteristicKey, value);
180
+ this.kasaDevice.sys_info[characteristicKey] = value;
181
+ this.updateValue(service, service.getCharacteristic(characteristicType), this.name, value);
182
+ this.previousKasaDevice = JSON.parse(JSON.stringify(this.kasaDevice));
183
+ this.log.debug(`Set value for characteristic ${characteristicName} to ${value} successfully`);
184
+ }
185
+ catch (error) {
186
+ this.log.error(`Error setting current value for characteristic ${characteristicName} for device: ${this.name}:`, error);
187
+ this.kasaDevice.offline = true;
188
+ this.stopPolling();
189
+ }
190
+ finally {
191
+ this.isUpdating = false;
192
+ this.updateEmitter.emit('updateComplete');
193
+ }
194
+ }
195
+ else {
196
+ throw new Error('Device manager is undefined.');
197
+ }
198
+ };
199
+ await task();
200
+ });
201
+ }
202
+ getCharacteristicKey(characteristicName) {
203
+ const characteristicMap = {
204
+ On: 'state',
205
+ Brightness: 'brightness',
206
+ ColorTemperature: 'color_temp',
207
+ Hue: 'hue',
208
+ Saturation: 'saturation',
209
+ };
210
+ return characteristicMap[characteristicName ?? ''];
161
211
  }
162
212
  async updateState() {
163
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
164
- this.stopPolling();
165
- return;
166
- }
167
- if (this.isUpdating || this.platform.periodicDeviceDiscovering) {
168
- return;
169
- }
170
- this.isUpdating = true;
171
- const task = (async () => {
172
- try {
173
- await this.getSysInfo();
174
- const service = this.homebridgeAccessory.getService(this.platform.Service.Lightbulb);
175
- if (service && this.previousKasaDevice) {
176
- const { state, brightness, color_temp, hsv } = this.kasaDevice.sys_info;
177
- const prevState = this.previousKasaDevice.sys_info;
178
- if (prevState.state !== state) {
179
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.On), this.name, state ?? false);
180
- this.log.debug(`Updated state for device: ${this.name} to state: ${state}`);
213
+ const lockKey = `${this.kasaDevice.sys_info.device_id}`;
214
+ await this.withLock(lockKey, async () => {
215
+ if (this.kasaDevice.offline || this.platform.isShuttingDown) {
216
+ this.stopPolling();
217
+ return;
218
+ }
219
+ if (this.isUpdating || this.platform.periodicDeviceDiscovering) {
220
+ let periodicDiscoveryComplete = false;
221
+ await Promise.race([
222
+ new Promise((resolve) => this.updateEmitter.once('updateComplete', resolve)),
223
+ new Promise((resolve) => {
224
+ this.updateEmitter.once('periodicDeviceDiscoveryComplete', () => {
225
+ periodicDiscoveryComplete = true;
226
+ resolve();
227
+ });
228
+ }),
229
+ ]);
230
+ if (periodicDiscoveryComplete) {
231
+ if (this.pollingInterval) {
232
+ await new Promise((resolve) => setTimeout(resolve, this.platform.config.discoveryOptions.pollingInterval));
181
233
  }
182
- if (this.hasBrightness && prevState.brightness !== brightness) {
183
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.Brightness), this.name, brightness ?? 0);
184
- this.log.debug(`Updated brightness for device: ${this.name} to brightness: ${brightness}`);
234
+ else {
235
+ return;
185
236
  }
186
- if (this.hasColorTemp && prevState.color_temp !== color_temp) {
187
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.ColorTemperature), this.name, color_temp ?? 0);
188
- this.log.debug(`Updated color_temp for device: ${this.name} to color_temp: ${color_temp}`);
237
+ }
238
+ }
239
+ this.isUpdating = true;
240
+ const task = async () => {
241
+ try {
242
+ await this.getSysInfo();
243
+ const service = this.getService();
244
+ if (service && this.previousKasaDevice) {
245
+ this.updateDeviceState(service);
189
246
  }
190
- if (this.hasHSV) {
191
- if (prevState.hsv?.hue !== hsv?.hue) {
192
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.Hue), this.name, hsv?.hue ?? 0);
193
- this.log.debug(`Updated hue for device: ${this.name} to hue: ${hsv?.hue}`);
194
- }
195
- if (prevState.hsv?.saturation !== hsv?.saturation) {
196
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.Saturation), this.name, hsv?.saturation ?? 0);
197
- this.log.debug(`Updated saturation for device: ${this.name} to saturation: ${hsv?.saturation}`);
198
- }
247
+ else {
248
+ this.log.warn(`Service not found for device: ${this.name} or previous Kasa device is undefined`);
199
249
  }
200
250
  }
201
- else {
202
- this.log.warn(`Service not found for device: ${this.name} or previous Kasa device is undefined`);
251
+ catch (error) {
252
+ this.log.error('Error updating device state:', error);
253
+ this.kasaDevice.offline = true;
254
+ this.stopPolling();
255
+ }
256
+ finally {
257
+ this.isUpdating = false;
258
+ this.updateEmitter.emit('updateComplete');
203
259
  }
260
+ };
261
+ await task();
262
+ });
263
+ }
264
+ getService() {
265
+ return this.homebridgeAccessory.getService(this.platform.Service.Lightbulb);
266
+ }
267
+ updateDeviceState(service) {
268
+ const { state, brightness, color_temp, hsv } = this.kasaDevice.sys_info;
269
+ const prevState = this.previousKasaDevice.sys_info;
270
+ if (prevState.state !== state) {
271
+ this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.On), this.name, state ?? false);
272
+ this.log.debug(`Updated state for device: ${this.name} to state: ${state}`);
273
+ }
274
+ if (this.hasBrightness && prevState.brightness !== brightness) {
275
+ this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.Brightness), this.name, brightness ?? 0);
276
+ this.log.debug(`Updated brightness for device: ${this.name} to brightness: ${brightness}`);
277
+ }
278
+ if (this.hasColorTemp && prevState.color_temp !== color_temp) {
279
+ this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.ColorTemperature), this.name, color_temp ?? 0);
280
+ this.log.debug(`Updated color_temp for device: ${this.name} to color_temp: ${color_temp}`);
281
+ }
282
+ if (this.hasHSV) {
283
+ if (prevState.hsv?.hue !== hsv?.hue) {
284
+ this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.Hue), this.name, hsv?.hue ?? 0);
285
+ this.log.debug(`Updated hue for device: ${this.name} to hue: ${hsv?.hue}`);
204
286
  }
205
- catch (error) {
206
- this.log.error('Error updating device state:', error);
207
- this.kasaDevice.offline = true;
208
- this.stopPolling();
287
+ if (prevState.hsv?.saturation !== hsv?.saturation) {
288
+ this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.Saturation), this.name, hsv?.saturation ?? 0);
289
+ this.log.debug(`Updated saturation for device: ${this.name} to saturation: ${hsv?.saturation}`);
209
290
  }
210
- finally {
211
- this.isUpdating = false;
291
+ }
292
+ }
293
+ updateAfterPeriodicDiscovery() {
294
+ const serviceType = this.getServiceType();
295
+ const service = this.homebridgeAccessory.getService(serviceType);
296
+ if (service) {
297
+ this.updateCharacteristics(service);
298
+ }
299
+ else {
300
+ this.log.debug(`Service not found for device: ${this.name}`);
301
+ }
302
+ }
303
+ updateCharacteristics(service) {
304
+ const characteristics = this.getCharacteristics();
305
+ characteristics.forEach(({ type, name }) => {
306
+ const characteristic = service.getCharacteristic(type);
307
+ if (characteristic) {
308
+ const characteristicKey = this.getCharacteristicKey(name);
309
+ if (this.kasaDevice.sys_info[characteristicKey] !== undefined) {
310
+ const value = this.kasaDevice.sys_info[characteristicKey];
311
+ this.log.debug(`Setting value for characteristic ${name} to ${value}`);
312
+ this.updateValue(service, characteristic, this.name, value);
313
+ }
212
314
  }
213
- })();
214
- this.platform.ongoingTasks.push(task);
215
- await task;
216
- this.platform.ongoingTasks = this.platform.ongoingTasks.filter(t => t !== task);
315
+ });
217
316
  }
218
317
  startPolling() {
219
318
  if (this.kasaDevice.offline || this.platform.isShuttingDown) {
@@ -228,6 +327,7 @@ export default class HomeKitDeviceLightBulb extends HomeKitDevice {
228
327
  if (this.kasaDevice.offline || this.platform.isShuttingDown) {
229
328
  if (this.isUpdating) {
230
329
  this.isUpdating = false;
330
+ this.updateEmitter.emit('updateComplete');
231
331
  }
232
332
  this.stopPolling();
233
333
  }
@@ -1 +1 @@
1
- {"version":3,"file":"homekitLightBulb.js","sourceRoot":"","sources":["../../src/devices/homekitLightBulb.ts"],"names":[],"mappings":"AAGA,OAAO,aAAa,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,aAAa;IAWtD;IAVF,UAAU,GAAY,KAAK,CAAC;IAC3B,UAAU,CAAsB;IAChC,aAAa,CAAU;IACvB,YAAY,CAAU;IACtB,MAAM,CAAU;IAChB,kBAAkB,CAAyB;IAC3C,eAAe,CAA6B;IAEpD,YACE,QAA4B,EACrB,UAAqB;QAE5B,KAAK,CACH,QAAQ,EACR,UAAU,gCAEV,WAAW,CACZ,CAAC;QAPK,eAAU,GAAV,UAAU,CAAW;QAQ5B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,mDAAmD,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/F,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC;QAC/D,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,U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CAAC,eAAe,CAAC,CAAC;YACpC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;YACjC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC"}
@@ -7,14 +7,24 @@ export default class HomeKitDevicePlug extends HomeKitDevice {
7
7
  private previousKasaDevice;
8
8
  private getSysInfo;
9
9
  private pollingInterval;
10
+ private updateEmitter;
11
+ private static locks;
10
12
  constructor(platform: KasaPythonPlatform, kasaDevice: Plug);
13
+ private withLock;
11
14
  private checkService;
15
+ private getServiceType;
12
16
  private checkCharacteristics;
17
+ private getCharacteristics;
13
18
  private getOrAddCharacteristic;
14
19
  private handleOnGet;
15
20
  private getInitialValue;
16
21
  private handleOnSet;
22
+ private getCharacteristicKey;
17
23
  protected updateState(): Promise<void>;
24
+ private getService;
25
+ private updateDeviceState;
26
+ updateAfterPeriodicDiscovery(): void;
27
+ private updateCharacteristics;
18
28
  startPolling(): void;
19
29
  stopPolling(): void;
20
30
  identify(): void;