homebridge-kasa-python 2.9.1 → 3.0.0-beta.1

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 (57) hide show
  1. package/README.md +1 -1
  2. package/config.schema.json +17 -2
  3. package/dist/accessoryInformation.d.ts +2 -2
  4. package/dist/accessoryInformation.js +24 -28
  5. package/dist/accessoryInformation.js.map +1 -1
  6. package/dist/config.d.ts +5 -1
  7. package/dist/config.js +24 -16
  8. package/dist/config.js.map +1 -1
  9. package/dist/devices/baseDevice.d.ts +61 -0
  10. package/dist/devices/baseDevice.js +361 -0
  11. package/dist/devices/baseDevice.js.map +1 -0
  12. package/dist/devices/baseParent.d.ts +19 -0
  13. package/dist/devices/baseParent.js +150 -0
  14. package/dist/devices/baseParent.js.map +1 -0
  15. package/dist/devices/create.d.ts +3 -3
  16. package/dist/devices/create.js +21 -27
  17. package/dist/devices/create.js.map +1 -1
  18. package/dist/devices/descriptorHelpers.d.ts +14 -0
  19. package/dist/devices/descriptorHelpers.js +146 -0
  20. package/dist/devices/descriptorHelpers.js.map +1 -0
  21. package/dist/devices/deviceManager.d.ts +13 -13
  22. package/dist/devices/deviceManager.js +115 -137
  23. package/dist/devices/deviceManager.js.map +1 -1
  24. package/dist/devices/{kasaDevices.d.ts → deviceTypes.d.ts} +58 -42
  25. package/dist/devices/deviceTypes.js +20 -0
  26. package/dist/devices/deviceTypes.js.map +1 -0
  27. package/dist/devices/homekitLightBulb.d.ts +7 -28
  28. package/dist/devices/homekitLightBulb.js +42 -365
  29. package/dist/devices/homekitLightBulb.js.map +1 -1
  30. package/dist/devices/homekitPlug.d.ts +6 -25
  31. package/dist/devices/homekitPlug.js +21 -322
  32. package/dist/devices/homekitPlug.js.map +1 -1
  33. package/dist/devices/homekitPowerStrip.d.ts +6 -26
  34. package/dist/devices/homekitPowerStrip.js +25 -345
  35. package/dist/devices/homekitPowerStrip.js.map +1 -1
  36. package/dist/devices/homekitSwitch.d.ts +5 -26
  37. package/dist/devices/homekitSwitch.js +18 -302
  38. package/dist/devices/homekitSwitch.js.map +1 -1
  39. package/dist/devices/homekitSwitchWithChildren.d.ts +5 -29
  40. package/dist/devices/homekitSwitchWithChildren.js +24 -371
  41. package/dist/devices/homekitSwitchWithChildren.js.map +1 -1
  42. package/dist/energyCharacteristics.d.ts +8 -0
  43. package/dist/energyCharacteristics.js +88 -0
  44. package/dist/energyCharacteristics.js.map +1 -0
  45. package/dist/platform.d.ts +4 -2
  46. package/dist/platform.js +68 -63
  47. package/dist/platform.js.map +1 -1
  48. package/dist/python/kasaApi.py +68 -55
  49. package/dist/python/pythonChecker.js +2 -2
  50. package/dist/python/pythonChecker.js.map +1 -1
  51. package/package.json +15 -15
  52. package/requirements.txt +2 -2
  53. package/dist/devices/index.d.ts +0 -33
  54. package/dist/devices/index.js +0 -100
  55. package/dist/devices/index.js.map +0 -1
  56. package/dist/devices/kasaDevices.js +0 -102
  57. package/dist/devices/kasaDevices.js.map +0 -1
@@ -1,356 +1,36 @@
1
- import { EventEmitter } from 'node:events';
2
- import HomeKitDevice from './index.js';
3
- import { deferAndCombine } from '../utils.js';
4
- export default class HomeKitDevicePowerStrip extends HomeKitDevice {
1
+ import HomeKitParentDevice from './baseParent.js';
2
+ import { buildOnDescriptor, buildOutletInUseDescriptor, buildEnergyDescriptors, } from './descriptorHelpers.js';
3
+ export default class HomeKitDevicePowerStrip extends HomeKitParentDevice {
5
4
  kasaDevice;
6
- isUpdating = false;
7
- previousKasaDevice;
8
- getSysInfo;
9
- pollingInterval;
10
- updateEmitter = new EventEmitter();
11
- static locks = new Map();
5
+ hasEnergy;
12
6
  constructor(platform, kasaDevice) {
13
7
  super(platform, kasaDevice, 7 /* Categories.OUTLET */, 'OUTLET');
14
8
  this.kasaDevice = kasaDevice;
15
- this.log.debug(`Initializing HomeKitDevicePowerStrip for device: ${kasaDevice.sys_info.alias}`);
16
- this.kasaDevice.sys_info.children?.forEach((child) => {
17
- const index = this.extractChildIndex(child);
18
- this.checkService(child, index);
19
- });
20
- this.getSysInfo = deferAndCombine(async () => {
21
- if (!this.deviceManager) {
22
- this.log.warn('Device manager is not available');
23
- return;
24
- }
25
- const host = this.kasaDevice.sys_info?.host;
26
- if (!host) {
27
- this.log.warn('No host found in sys_info for device');
28
- return;
29
- }
30
- try {
31
- this.previousKasaDevice = { ...this.kasaDevice };
32
- const updatedSysInfo = await this.deviceManager.getSysInfo(host);
33
- if (!updatedSysInfo) {
34
- this.log.warn('getSysInfo returned undefined');
35
- return;
36
- }
37
- this.kasaDevice.sys_info = updatedSysInfo;
38
- this.log.debug(`Updated sys_info for device: ${updatedSysInfo.alias ?? host}`);
39
- }
40
- catch (err) {
41
- const errorMsg = 'Error updating sys_info:';
42
- if (err instanceof Error) {
43
- this.log.error(`${errorMsg} ${err.message}`);
44
- }
45
- else {
46
- this.log.error(`${errorMsg} ${String(err)}`);
47
- }
48
- }
49
- }, platform.config.advancedOptions.waitTimeUpdate);
50
- platform.periodicDeviceDiscoveryEmitter.on('periodicDeviceDiscoveryComplete', () => {
51
- this.updateEmitter.emit('periodicDeviceDiscoveryComplete');
52
- });
9
+ this.hasEnergy = !!kasaDevice.feature_info.energy;
10
+ this.setupChildServices();
53
11
  }
54
12
  async initialize() {
55
- this.log.debug(`Initializing polling for device: ${this.kasaDevice.sys_info.alias}`);
56
13
  await this.startPolling();
57
14
  }
58
- async withLock(key, action) {
59
- let lock = HomeKitDevicePowerStrip.locks.get(key);
60
- if (!lock) {
61
- lock = Promise.resolve();
62
- }
63
- const currentLock = lock.then(async () => {
64
- try {
65
- return await action();
66
- }
67
- finally {
68
- if (HomeKitDevicePowerStrip.locks.get(key) === currentLock) {
69
- HomeKitDevicePowerStrip.locks.delete(key);
70
- }
71
- }
72
- });
73
- HomeKitDevicePowerStrip.locks.set(key, currentLock.then(() => { }));
74
- return currentLock;
75
- }
76
- checkService(child, index) {
77
- const serviceType = this.getServiceType();
78
- const service = this.homebridgeAccessory.getServiceById(serviceType, `child-${index + 1}`) ??
79
- this.addService(serviceType, child.alias, `child-${index + 1}`);
80
- const oldService = this.homebridgeAccessory.getServiceById(serviceType, `outlet-${index + 1}`);
81
- if (oldService) {
82
- this.homebridgeAccessory.removeService(oldService);
83
- }
84
- this.checkCharacteristics(service, child);
85
- }
86
- getServiceType() {
87
- const { Outlet } = this.platform.Service;
88
- return Outlet;
89
- }
90
- checkCharacteristics(service, child) {
91
- const characteristics = this.getCharacteristics();
92
- characteristics.forEach(({ type, name }) => {
93
- this.getOrAddCharacteristic(service, type, name, child);
94
- });
95
- }
96
- getCharacteristics() {
97
- const characteristics = [];
98
- characteristics.push({
99
- type: this.platform.Characteristic.On,
100
- name: this.platform.getCharacteristicName(this.platform.Characteristic.On),
101
- }, {
102
- type: this.platform.Characteristic.OutletInUse,
103
- name: this.platform.getCharacteristicName(this.platform.Characteristic.OutletInUse),
104
- });
105
- return characteristics;
106
- }
107
- getOrAddCharacteristic(service, characteristicType, characteristicName, child) {
108
- const characteristic = service.getCharacteristic(characteristicType) ??
109
- service.addCharacteristic(characteristicType);
110
- characteristic.onGet(this.handleOnGet.bind(this, service, characteristicType, characteristicName, child));
111
- if (characteristicType === this.platform.Characteristic.On) {
112
- characteristic.onSet(this.handleOnSet.bind(this, service, characteristicType, characteristicName, child));
113
- }
114
- }
115
- async handleOnGet(service, characteristicType, characteristicName, child) {
116
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
117
- this.log.warn(`Device is offline or platform is shutting down, cannot get value for characteristic ${characteristicName}`);
118
- return false;
119
- }
120
- try {
121
- let characteristicValue = service.getCharacteristic(characteristicType).value;
122
- if (!characteristicValue) {
123
- characteristicValue = this.getInitialValue(characteristicType, child);
124
- service.getCharacteristic(characteristicType).updateValue(characteristicValue);
125
- }
126
- this.log.debug(`Got value for characteristic ${characteristicName}: ${characteristicValue}`);
127
- return characteristicValue ?? false;
128
- }
129
- catch (error) {
130
- this.log.error(`Error getting current value for characteristic ${characteristicName} for device: ${child.alias}:`, error);
131
- this.kasaDevice.offline = true;
132
- await this.stopPolling();
133
- return false;
134
- }
135
- }
136
- getInitialValue(characteristicType, child) {
137
- if (this.kasaDevice.feature_info.energy && this.kasaDevice.feature_info.energy === true && child.energy) {
138
- if (characteristicType === this.platform.Characteristic.On) {
139
- return child.state ?? false;
140
- }
141
- if (characteristicType === this.platform.Characteristic.OutletInUse) {
142
- return (child.energy.power ?? 0) > 1;
143
- }
144
- }
145
- else {
146
- if (characteristicType === this.platform.Characteristic.On || characteristicType === this.platform.Characteristic.OutletInUse) {
147
- return child.state ?? false;
148
- }
149
- }
150
- return false;
151
- }
152
- async handleOnSet(service, characteristicType, characteristicName, child, value) {
153
- const lockKey = `${this.kasaDevice.sys_info.device_id}:${child.id}`;
154
- await this.withLock(lockKey, async () => {
155
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
156
- this.log.warn(`Device is offline or platform is shutting down, cannot set value for characteristic ${characteristicName}`);
157
- return;
158
- }
159
- const task = async () => {
160
- if (this.deviceManager) {
161
- try {
162
- this.isUpdating = true;
163
- this.log.debug(`Setting value for characteristic ${characteristicName} to ${value}`);
164
- const characteristicKey = this.getCharacteristicKey(characteristicName);
165
- if (!characteristicKey) {
166
- throw new Error(`Characteristic key not found for ${characteristicName}`);
167
- }
168
- const childNumber = this.extractChildIndex(child);
169
- await this.deviceManager.controlDevice(this.kasaDevice.sys_info.host, characteristicKey, value, childNumber);
170
- child[characteristicKey] = value;
171
- const childIndex = this.kasaDevice.sys_info.children?.findIndex(c => c.id === child.id);
172
- if (childIndex !== undefined && childIndex !== -1) {
173
- this.kasaDevice.sys_info.children[childIndex] = { ...child };
174
- }
175
- this.updateValue(service, service.getCharacteristic(characteristicType), child.alias, value);
176
- if (this.kasaDevice.feature_info.energy && this.kasaDevice.feature_info.energy === true && child.energy) {
177
- const outlet_in_use = (Number(child.energy.power ?? 0) > 1);
178
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.OutletInUse), child.alias, outlet_in_use);
179
- }
180
- else {
181
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.OutletInUse), child.alias, child.state ?? false);
182
- }
183
- this.previousKasaDevice = JSON.parse(JSON.stringify(this.kasaDevice));
184
- this.log.debug(`Set value for characteristic ${characteristicName} to ${value} successfully`);
185
- }
186
- catch (error) {
187
- this.log.error(`Error setting current value for characteristic ${characteristicName} for device: ${child.alias}:`, error);
188
- this.kasaDevice.offline = true;
189
- await this.stopPolling();
190
- }
191
- finally {
192
- this.isUpdating = false;
193
- this.updateEmitter.emit('updateComplete');
194
- }
195
- }
196
- else {
197
- throw new Error('Device manager is undefined.');
198
- }
199
- };
200
- await task();
201
- });
202
- }
203
- getCharacteristicKey(characteristicName) {
204
- const characteristicMap = {
205
- On: 'state',
206
- };
207
- return characteristicMap[characteristicName ?? ''];
208
- }
209
- async updateState() {
210
- const lockKey = `${this.kasaDevice.sys_info.device_id}`;
211
- await this.withLock(lockKey, async () => {
212
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
213
- await this.stopPolling();
214
- return;
215
- }
216
- if (this.isUpdating || this.platform.periodicDeviceDiscovering) {
217
- let periodicDiscoveryComplete = false;
218
- await Promise.race([
219
- new Promise((resolve) => this.updateEmitter.once('updateComplete', resolve)),
220
- new Promise((resolve) => {
221
- this.updateEmitter.once('periodicDeviceDiscoveryComplete', () => {
222
- periodicDiscoveryComplete = true;
223
- resolve();
224
- });
225
- }),
226
- ]);
227
- if (periodicDiscoveryComplete) {
228
- if (this.pollingInterval) {
229
- await new Promise((resolve) => setTimeout(resolve, this.platform.config.discoveryOptions.pollingInterval));
230
- }
231
- else {
232
- return;
233
- }
234
- }
235
- }
236
- this.isUpdating = true;
237
- const task = async () => {
238
- try {
239
- await this.getSysInfo();
240
- this.kasaDevice.sys_info.children?.forEach((child) => {
241
- const childNumber = this.extractChildIndex(child);
242
- const service = this.getService(childNumber);
243
- if (service && this.previousKasaDevice) {
244
- this.updateChildState(service, child);
245
- }
246
- else {
247
- this.log.warn(`Service not found for child device: ${child.alias} or previous Kasa device is undefined`);
248
- }
249
- });
250
- }
251
- catch (error) {
252
- this.log.error('Error updating device state:', error);
253
- this.kasaDevice.offline = true;
254
- await this.stopPolling();
255
- }
256
- finally {
257
- this.isUpdating = false;
258
- this.updateEmitter.emit('updateComplete');
259
- }
260
- };
261
- await task();
262
- });
263
- }
264
- getService(childNumber) {
265
- return this.homebridgeAccessory.getServiceById(this.platform.Service.Outlet, `child-${childNumber + 1}`);
266
- }
267
- updateChildState(service, child) {
268
- const previousChild = this.previousKasaDevice?.sys_info.children?.find(c => c.id === child.id);
269
- if (previousChild) {
270
- if (previousChild.state !== child.state) {
271
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.On), child.alias, child.state);
272
- if (this.kasaDevice.feature_info.energy && this.kasaDevice.feature_info.energy === true && child.energy) {
273
- const outlet_in_use = (Number(child.energy.power ?? 0) > 1);
274
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.OutletInUse), child.alias, outlet_in_use);
275
- }
276
- else {
277
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.OutletInUse), child.alias, child.state ?? false);
278
- }
279
- this.log.debug(`Updated state for child device: ${child.alias} to ${child.state}`);
280
- }
281
- }
282
- }
283
- updateAfterPeriodicDiscovery() {
284
- this.kasaDevice.sys_info.children?.forEach((child) => {
285
- const serviceType = this.getServiceType();
286
- const index = this.extractChildIndex(child);
287
- const service = this.homebridgeAccessory.getServiceById(serviceType, `child-${index + 1}`);
288
- if (service) {
289
- this.updateCharacteristics(service, child);
290
- }
291
- else {
292
- this.log.debug(`Service not found for child device: ${child.alias}`);
293
- }
294
- });
295
- }
296
- updateCharacteristics(service, child) {
297
- const characteristics = this.getCharacteristics();
298
- characteristics.forEach(({ type, name }) => {
299
- if (type === this.platform.Characteristic.On) {
300
- const characteristic = service.getCharacteristic(type);
301
- if (characteristic) {
302
- const characteristicKey = this.getCharacteristicKey(name);
303
- if (child[characteristicKey] !== undefined) {
304
- const value = child[characteristicKey];
305
- this.log.debug(`Setting value for characteristic ${name} to ${value}`);
306
- this.updateValue(service, characteristic, child.alias, value);
307
- if (this.kasaDevice.feature_info.energy && this.kasaDevice.feature_info.energy === true && child.energy) {
308
- const outlet_in_use = (Number(child.energy.power ?? 0) > 1);
309
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.OutletInUse), child.alias, outlet_in_use);
310
- }
311
- else {
312
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.OutletInUse), child.alias, child.state ?? false);
313
- }
314
- }
315
- }
316
- }
317
- });
318
- }
319
- async startPolling() {
320
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
321
- await this.stopPolling();
322
- return;
323
- }
324
- if (this.pollingInterval) {
325
- clearInterval(this.pollingInterval);
326
- }
327
- this.log.debug('Starting polling for device:', this.name);
328
- this.pollingInterval = setInterval(async () => {
329
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
330
- if (this.isUpdating) {
331
- this.isUpdating = false;
332
- this.updateEmitter.emit('updateComplete');
333
- }
334
- await this.stopPolling();
335
- }
336
- else {
337
- await this.updateState();
338
- }
339
- }, this.platform.config.discoveryOptions.pollingInterval);
340
- }
341
- async stopPolling() {
342
- if (this.pollingInterval) {
343
- clearInterval(this.pollingInterval);
344
- this.pollingInterval = undefined;
345
- this.log.debug('Stopped polling');
346
- }
347
- if (this.isUpdating) {
348
- this.log.debug('Waiting for ongoing polling task to complete for device:', this.name);
349
- await new Promise((resolve) => {
350
- this.isUpdating = false;
351
- this.updateEmitter.once('updateComplete', resolve);
352
- });
353
- }
15
+ getChildServiceType(_child) {
16
+ void _child;
17
+ return this.platform.Service.Outlet;
18
+ }
19
+ buildChildDescriptors(_child) {
20
+ void _child;
21
+ const C = this.platform.Characteristic;
22
+ const energyChars = this.platform.energyCharacteristics;
23
+ const list = [
24
+ buildOnDescriptor(C, async (value, context) => {
25
+ const idx = this.extractChildIndex(context.child ?? {});
26
+ await this.deviceManager.controlDevice(context.device.host, 'state', value, idx);
27
+ }),
28
+ buildOutletInUseDescriptor(C, this.hasEnergy),
29
+ ];
30
+ if (this.platform.config.enableEnergyMonitoring && energyChars && _child.energy) {
31
+ list.push(...buildEnergyDescriptors(energyChars));
32
+ }
33
+ return list;
354
34
  }
355
35
  identify() {
356
36
  this.log.info('identify');
@@ -1 +1 @@
1
- {"version":3,"file":"homekitPowerStrip.js","sourceRoot":"","sources":["../../src/devices/homekitPowerStrip.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,aAAa,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,aAAa;IAUvD;IATF,UAAU,GAAY,KAAK,CAAC;IAC3B,kBAAkB,CAAyB;IAC3C,UAAU,CAAsB;IAChC,eAAe,CAA6B;IAC5C,aAAa,GAAiB,IAAI,YAAY,EAAE,CAAC;IACjD,MAAM,CAAC,KAAK,GAA+B,IAAI,GAAG,EAAE,CAAC;IAE7D,YACE,QAA4B,EACrB,UAAsB;QAE7B,KAAK,CACH,QAAQ,EACR,UAAU,6BAEV,QAAQ,CACT,CAAC;QAPK,eAAU,GAAV,UAAU,CAAY;QAQ7B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,oDAAoD,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAkB,EAAE,EAAE;YAChE,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC5C,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,GAAG,eAAe,CAAC,KAAK,IAAI,EAAE;YAC3C,IAAI,CAAC,IAAI,CAAC,aAA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AAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;CACF"}
@@ -1,34 +1,13 @@
1
- import HomeKitDevice from './index.js';
1
+ import HomeKitDevice from './baseDevice.js';
2
2
  import type KasaPythonPlatform from '../platform.js';
3
- import type { Switch } from './kasaDevices.js';
3
+ import type { Switch, CharacteristicDescriptor } from './deviceTypes.js';
4
4
  export default class HomeKitDeviceSwitch extends HomeKitDevice {
5
5
  kasaDevice: Switch;
6
- isUpdating: boolean;
7
- private previousKasaDevice;
8
- private getSysInfo;
9
6
  private hasBrightness;
10
- private pollingInterval;
11
- private updateEmitter;
12
- private static locks;
13
7
  constructor(platform: KasaPythonPlatform, kasaDevice: Switch);
14
8
  initialize(): Promise<void>;
15
- private withLock;
16
- private checkService;
17
- private getServiceType;
18
- private checkCharacteristics;
19
- private getCharacteristics;
20
- private getOrAddCharacteristic;
21
- private handleOnGet;
22
- private getDefaultValue;
23
- private getInitialValue;
24
- private handleOnSet;
25
- private getCharacteristicKey;
26
- protected updateState(): Promise<void>;
27
- private getService;
28
- private updateDeviceState;
29
- updateAfterPeriodicDiscovery(): void;
30
- private updateCharacteristics;
31
- startPolling(): Promise<void>;
32
- stopPolling(): Promise<void>;
9
+ protected getPrimaryServiceType(): typeof import("hap-nodejs/dist/lib/definitions/ServiceDefinitions.js").Lightbulb;
10
+ protected buildPrimaryDescriptors(): CharacteristicDescriptor[];
11
+ protected updateAllServicesAndCharacteristics(forceUpdate: boolean): Promise<void>;
33
12
  identify(): void;
34
13
  }