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
package/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
  <div align="center">
26
26
 
27
27
  > ## IMPORTANT!!!
28
- >With v2.7.0, Support for anything less than Python v3.11 will be dropped.
28
+ >Python Supported Versions: 3.11, 3.12, and 3.13.
29
29
 
30
30
  </div>
31
31
 
@@ -41,6 +41,12 @@
41
41
  "functionBody": "return model.enableCredentials && model.username && model.username !== '';"
42
42
  }
43
43
  },
44
+ "enableEnergyMonitoring": {
45
+ "title": "Enable Energy Monitoring",
46
+ "type": "boolean",
47
+ "description": "Enable to add energy monitoring characteristics (Volts, Amperes, Watts, KiloWattHours) to supported devices.",
48
+ "default": false
49
+ },
44
50
  "hideHomeKitMatter": {
45
51
  "title": "Hide HomeKit or Matter Devices",
46
52
  "type": "boolean",
@@ -133,6 +139,12 @@
133
139
  "type": "boolean",
134
140
  "description": "Enable detailed logging for Python scripts. Only shows logs when Debug Mode in Homebridge is enabled.",
135
141
  "default": false
142
+ },
143
+ "logEnergyMonitoring": {
144
+ "title": "Log Energy Monitoring Events",
145
+ "type": "boolean",
146
+ "description": "Enable logging of power/energy monitoring characteristic updates (Volts, Amperes, Watts, KiloWattHours).",
147
+ "default": false
136
148
  }
137
149
  }
138
150
  },
@@ -151,6 +163,7 @@
151
163
  "type": "help",
152
164
  "helpvalue": "Username and Password will be required for specific devices only."
153
165
  },
166
+ "enableEnergyMonitoring",
154
167
  {
155
168
  "type": "fieldset",
156
169
  "title": "HomeKit (Optional)",
@@ -195,7 +208,8 @@
195
208
  "key": "manualDevices",
196
209
  "type": "array",
197
210
  "items": [
198
- "manualDevices[].host", "manualDevices[].alias"
211
+ "manualDevices[].host",
212
+ "manualDevices[].alias"
199
213
  ]
200
214
  },
201
215
  {
@@ -246,7 +260,8 @@
246
260
  "items": [
247
261
  "waitTimeUpdate",
248
262
  "pythonPath",
249
- "advancedPythonLogging"
263
+ "advancedPythonLogging",
264
+ "logEnergyMonitoring"
250
265
  ]
251
266
  }
252
267
  ]
@@ -1,3 +1,3 @@
1
1
  import type { HAP, PlatformAccessory, Service } from 'homebridge';
2
- import type HomeKitDevice from './devices/index.js';
3
- export default function platformAccessoryInformation(hap: HAP): (platformAccessory: PlatformAccessory, homekitDevice: HomeKitDevice) => Service | undefined;
2
+ import type HomeKitDevice from './devices/baseDevice.js';
3
+ export default function platformAccessoryInformation(hap: HAP): (accessory: PlatformAccessory, homekitDevice: HomeKitDevice) => Service | undefined;
@@ -1,35 +1,31 @@
1
1
  export default function platformAccessoryInformation(hap) {
2
2
  const { Characteristic, Service: { AccessoryInformation } } = hap;
3
- return (platformAccessory, homekitDevice) => {
4
- const existingInfoService = platformAccessory.getService(AccessoryInformation);
5
- if (existingInfoService) {
6
- if (existingInfoService.getCharacteristic(Characteristic.Name).value !== homekitDevice.name) {
7
- existingInfoService.setCharacteristic(Characteristic.Name, homekitDevice.name);
8
- }
9
- else if (existingInfoService.getCharacteristic(Characteristic.Manufacturer).value !== homekitDevice.manufacturer) {
10
- existingInfoService.setCharacteristic(Characteristic.Manufacturer, homekitDevice.manufacturer);
11
- }
12
- else if (existingInfoService.getCharacteristic(Characteristic.Model).value !== homekitDevice.model) {
13
- existingInfoService.setCharacteristic(Characteristic.Model, homekitDevice.model);
14
- }
15
- else if (existingInfoService.getCharacteristic(Characteristic.SerialNumber).value !== homekitDevice.serialNumber) {
16
- existingInfoService.setCharacteristic(Characteristic.SerialNumber, homekitDevice.serialNumber);
17
- }
18
- else if (existingInfoService.getCharacteristic(Characteristic.FirmwareRevision).value !== homekitDevice.firmwareRevision) {
19
- existingInfoService.setCharacteristic(Characteristic.FirmwareRevision, homekitDevice.firmwareRevision);
20
- }
21
- return existingInfoService;
3
+ return (accessory, homekitDevice) => {
4
+ let infoService = accessory.getService(AccessoryInformation);
5
+ if (!infoService) {
6
+ infoService = accessory.addService(AccessoryInformation);
22
7
  }
23
- else {
24
- const infoService = platformAccessory.addService(AccessoryInformation);
25
- infoService
26
- .setCharacteristic(Characteristic.Name, homekitDevice.name)
27
- .setCharacteristic(Characteristic.Manufacturer, homekitDevice.manufacturer)
28
- .setCharacteristic(Characteristic.Model, homekitDevice.model)
29
- .setCharacteristic(Characteristic.SerialNumber, homekitDevice.serialNumber)
30
- .setCharacteristic(Characteristic.FirmwareRevision, homekitDevice.firmwareRevision);
31
- return infoService;
8
+ const nameCharacteristic = infoService.getCharacteristic(Characteristic.Name);
9
+ const manufacturerCharacteristic = infoService.getCharacteristic(Characteristic.Manufacturer);
10
+ const modelCharacteristic = infoService.getCharacteristic(Characteristic.Model);
11
+ const serialCharacteristic = infoService.getCharacteristic(Characteristic.SerialNumber);
12
+ const firmwareCharacteristic = infoService.getCharacteristic(Characteristic.FirmwareRevision);
13
+ if (nameCharacteristic.value !== homekitDevice.name) {
14
+ infoService.setCharacteristic(Characteristic.Name, homekitDevice.name);
32
15
  }
16
+ if (manufacturerCharacteristic.value !== homekitDevice.manufacturer) {
17
+ infoService.setCharacteristic(Characteristic.Manufacturer, homekitDevice.manufacturer);
18
+ }
19
+ if (modelCharacteristic.value !== homekitDevice.model) {
20
+ infoService.setCharacteristic(Characteristic.Model, homekitDevice.model);
21
+ }
22
+ if (serialCharacteristic.value !== homekitDevice.serialNumber) {
23
+ infoService.setCharacteristic(Characteristic.SerialNumber, homekitDevice.serialNumber);
24
+ }
25
+ if (firmwareCharacteristic.value !== homekitDevice.firmwareRevision) {
26
+ infoService.setCharacteristic(Characteristic.FirmwareRevision, homekitDevice.firmwareRevision);
27
+ }
28
+ return infoService;
33
29
  };
34
30
  }
35
31
  //# sourceMappingURL=accessoryInformation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accessoryInformation.js","sourceRoot":"","sources":["../src/accessoryInformation.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAClD,GAAQ;IAER,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,oBAAoB,EAAE,EAAE,GAAG,GAAG,CAAC;IAElE,OAAO,CAAC,iBAAoC,EAAE,aAA4B,EAAE,EAAE;QAC5E,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;QAC/E,IAAI,mBAAmB,EAAE,CAAC;YACxB,IAAI,mBAAmB,CAAC,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;gBAC5F,mBAAmB,CAAC,iBAAiB,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;YACjF,CAAC;iBAAM,IAAI,mBAAmB,CAAC,iBAAiB,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,KAAK,KAAK,aAAa,CAAC,YAAY,EAAE,CAAC;gBACnH,mBAAmB,CAAC,iBAAiB,CAAC,cAAc,CAAC,YAAY,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;YACjG,CAAC;iBAAM,IAAI,mBAAmB,CAAC,iBAAiB,CAAC,cAAc,CAAC,KAAK,CAAC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AAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,oBAAoB,CAAC,KAAK,KAAK,aAAa,CAAC,YAAY,EAAE,CAAC;YAC9D,WAAW,CAAC,iBAAiB,CAAC,cAAc,CAAC,YAAY,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;QACzF,CAAC;QACD,IAAI,sBAAsB,CAAC,KAAK,KAAK,aAAa,CAAC,gBAAgB,EAAE,CAAC;YACpE,WAAW,CAAC,iBAAiB,CAAC,cAAc,CAAC,gBAAgB,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACjG,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC"}
package/dist/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ConfigDevice } from './devices/kasaDevices.js';
1
+ import type { ConfigDevice } from './devices/deviceTypes.js';
2
2
  export declare class ConfigParseError extends Error {
3
3
  errors?: string[] | null | undefined;
4
4
  unknownError?: unknown | undefined;
@@ -10,6 +10,7 @@ export interface KasaPythonConfigInput {
10
10
  enableCredentials?: boolean;
11
11
  username?: string;
12
12
  password?: string;
13
+ enableEnergyMonitoring?: boolean;
13
14
  hideHomeKitMatter?: boolean;
14
15
  pollingInterval?: number;
15
16
  discoveryPollingInterval?: number;
@@ -21,12 +22,14 @@ export interface KasaPythonConfigInput {
21
22
  waitTimeUpdate?: number;
22
23
  pythonPath?: string;
23
24
  advancedPythonLogging?: boolean;
25
+ logEnergyMonitoring?: boolean;
24
26
  }
25
27
  export type KasaPythonConfig = {
26
28
  name: string;
27
29
  enableCredentials: boolean;
28
30
  username: string;
29
31
  password: string;
32
+ enableEnergyMonitoring: boolean;
30
33
  homekitOptions: {
31
34
  hideHomeKitMatter: boolean;
32
35
  };
@@ -43,6 +46,7 @@ export type KasaPythonConfig = {
43
46
  waitTimeUpdate: number;
44
47
  pythonPath?: string;
45
48
  advancedPythonLogging: boolean;
49
+ logEnergyMonitoring: boolean;
46
50
  };
47
51
  };
48
52
  export declare const defaultConfig: KasaPythonConfig;
package/dist/config.js CHANGED
@@ -30,6 +30,7 @@ export const defaultConfig = {
30
30
  enableCredentials: false,
31
31
  username: '',
32
32
  password: '',
33
+ enableEnergyMonitoring: false,
33
34
  homekitOptions: {
34
35
  hideHomeKitMatter: true,
35
36
  },
@@ -46,6 +47,7 @@ export const defaultConfig = {
46
47
  waitTimeUpdate: 100,
47
48
  pythonPath: '',
48
49
  advancedPythonLogging: false,
50
+ logEnergyMonitoring: false,
49
51
  },
50
52
  };
51
53
  function convertManualDevices(manualDevices) {
@@ -71,6 +73,7 @@ function validateConfig(config) {
71
73
  validateType(config, 'enableCredentials', 'boolean', errors);
72
74
  validateType(config, 'username', 'string', errors);
73
75
  validateType(config, 'password', 'string', errors);
76
+ validateType(config, 'enableEnergyMonitoring', 'boolean', errors);
74
77
  validateType(config, 'hideHomeKitMatter', 'boolean', errors);
75
78
  validateType(config, 'pollingInterval', 'number', errors);
76
79
  validateType(config, 'discoveryPollingInterval', 'number', errors);
@@ -90,6 +93,7 @@ function validateConfig(config) {
90
93
  validateType(config, 'waitTimeUpdate', 'number', errors);
91
94
  validateType(config, 'pythonPath', 'string', errors);
92
95
  validateType(config, 'advancedPythonLogging', 'boolean', errors);
96
+ validateType(config, 'logEnergyMonitoring', 'boolean', errors);
93
97
  return errors;
94
98
  }
95
99
  function validateType(config, key, expectedType, errors) {
@@ -105,28 +109,32 @@ export function parseConfig(config) {
105
109
  if (!isObjectLike(config)) {
106
110
  throw new ConfigParseError('Error parsing config');
107
111
  }
108
- const c = { ...defaultConfig, ...config };
112
+ const parsedConfig = { ...defaultConfig, ...config };
109
113
  return {
110
- name: c.name ?? defaultConfig.name,
111
- enableCredentials: c.enableCredentials ?? defaultConfig.enableCredentials,
112
- username: c.username ?? defaultConfig.username,
113
- password: c.password ?? defaultConfig.password,
114
+ name: parsedConfig.name ?? defaultConfig.name,
115
+ enableCredentials: parsedConfig.enableCredentials ?? defaultConfig.enableCredentials,
116
+ username: parsedConfig.username ?? defaultConfig.username,
117
+ password: parsedConfig.password ?? defaultConfig.password,
118
+ enableEnergyMonitoring: parsedConfig.enableEnergyMonitoring ?? defaultConfig.enableEnergyMonitoring,
114
119
  homekitOptions: {
115
- hideHomeKitMatter: c.hideHomeKitMatter ?? defaultConfig.homekitOptions.hideHomeKitMatter,
120
+ hideHomeKitMatter: parsedConfig.hideHomeKitMatter ?? defaultConfig.homekitOptions.hideHomeKitMatter,
116
121
  },
117
122
  discoveryOptions: {
118
- pollingInterval: (c.pollingInterval ?? defaultConfig.discoveryOptions.pollingInterval) * 1000,
119
- discoveryPollingInterval: (c.discoveryPollingInterval ?? defaultConfig.discoveryOptions.discoveryPollingInterval) * 1000,
120
- offlineInterval: (c.offlineInterval ?? defaultConfig.discoveryOptions.offlineInterval) * 24 * 60 * 60 * 1000,
121
- additionalBroadcasts: c.additionalBroadcasts ?? defaultConfig.discoveryOptions.additionalBroadcasts,
122
- manualDevices: c.manualDevices ? convertManualDevices(c.manualDevices) : defaultConfig.discoveryOptions.manualDevices,
123
- excludeMacAddresses: c.excludeMacAddresses ?? defaultConfig.discoveryOptions.excludeMacAddresses,
124
- includeMacAddresses: c.includeMacAddresses ?? defaultConfig.discoveryOptions.includeMacAddresses,
123
+ pollingInterval: (parsedConfig.pollingInterval ?? defaultConfig.discoveryOptions.pollingInterval) * 1000,
124
+ discoveryPollingInterval: (parsedConfig.discoveryPollingInterval ?? defaultConfig.discoveryOptions.discoveryPollingInterval) * 1000,
125
+ offlineInterval: (parsedConfig.offlineInterval ?? defaultConfig.discoveryOptions.offlineInterval) * 24 * 60 * 60 * 1000,
126
+ additionalBroadcasts: parsedConfig.additionalBroadcasts ?? defaultConfig.discoveryOptions.additionalBroadcasts,
127
+ manualDevices: parsedConfig.manualDevices
128
+ ? convertManualDevices(parsedConfig.manualDevices)
129
+ : defaultConfig.discoveryOptions.manualDevices,
130
+ excludeMacAddresses: parsedConfig.excludeMacAddresses ?? defaultConfig.discoveryOptions.excludeMacAddresses,
131
+ includeMacAddresses: parsedConfig.includeMacAddresses ?? defaultConfig.discoveryOptions.includeMacAddresses,
125
132
  },
126
133
  advancedOptions: {
127
- waitTimeUpdate: c.waitTimeUpdate ?? defaultConfig.advancedOptions.waitTimeUpdate,
128
- pythonPath: c.pythonPath ?? defaultConfig.advancedOptions.pythonPath,
129
- advancedPythonLogging: c.advancedPythonLogging ?? defaultConfig.advancedOptions.advancedPythonLogging,
134
+ waitTimeUpdate: parsedConfig.waitTimeUpdate ?? defaultConfig.advancedOptions.waitTimeUpdate,
135
+ pythonPath: parsedConfig.pythonPath ?? defaultConfig.advancedOptions.pythonPath,
136
+ advancedPythonLogging: parsedConfig.advancedPythonLogging ?? defaultConfig.advancedOptions.advancedPythonLogging,
137
+ logEnergyMonitoring: parsedConfig.logEnergyMonitoring ?? defaultConfig.advancedOptions.logEnergyMonitoring,
130
138
  },
131
139
  };
132
140
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAGhC;IACA;IAHT,YACE,OAAe,EACR,MAAwB,EACxB,YAAsB;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,WAAM,GAAN,MAAM,CAAkB;QACxB,iBAAY,GAAZ,YAAY,CAAU;QAG7B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACjE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;IAEO,aAAa,CACnB,OAAe,EACf,MAAwB,EACxB,YAAsB;QAEtB,IAAI,gBAAgB,GAAG,OAAO,CA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mB,EAAE,YAAY,CAAC,mBAAmB,IAAI,aAAa,CAAC,gBAAgB,CAAC,mBAAmB;YAC3G,mBAAmB,EAAE,YAAY,CAAC,mBAAmB,IAAI,aAAa,CAAC,gBAAgB,CAAC,mBAAmB;SAC5G;QACD,eAAe,EAAE;YACf,cAAc,EAAE,YAAY,CAAC,cAAc,IAAI,aAAa,CAAC,eAAe,CAAC,cAAc;YAC3F,UAAU,EAAE,YAAY,CAAC,UAAU,IAAI,aAAa,CAAC,eAAe,CAAC,UAAU;YAC/E,qBAAqB,EAAE,YAAY,CAAC,qBAAqB,IAAI,aAAa,CAAC,eAAe,CAAC,qBAAqB;YAChH,mBAAmB,EAAE,YAAY,CAAC,mBAAmB,IAAI,aAAa,CAAC,eAAe,CAAC,mBAAmB;SAC3G;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { Categories, Characteristic, CharacteristicValue, HapStatusError, Logger, Nullable, PlatformAccessory, Service, WithUUID } from 'homebridge';
2
+ import { EventEmitter } from 'node:events';
3
+ import DeviceManager from './deviceManager.js';
4
+ import type KasaPythonPlatform from '../platform.js';
5
+ import type { CharacteristicDescriptor, ChildDevice, DescriptorContext, KasaDevice, SysInfo } from './deviceTypes.js';
6
+ import type { KasaPythonAccessoryContext } from '../platform.js';
7
+ export default abstract class HomeKitDevice {
8
+ readonly platform: KasaPythonPlatform;
9
+ kasaDevice: KasaDevice;
10
+ readonly category: Categories;
11
+ readonly categoryName: string;
12
+ readonly log: Logger;
13
+ protected deviceManager: DeviceManager | undefined;
14
+ homebridgeAccessory: PlatformAccessory<KasaPythonAccessoryContext>;
15
+ isUpdating: boolean;
16
+ protected previousSnapshot?: KasaDevice;
17
+ protected pollingInterval?: NodeJS.Timeout;
18
+ protected updateEmitter: EventEmitter<[never]>;
19
+ private static locks;
20
+ protected getSysInfoDeferred: () => Promise<void>;
21
+ private primaryDescriptors;
22
+ private primaryService?;
23
+ constructor(platform: KasaPythonPlatform, kasaDevice: KasaDevice, category: Categories, categoryName: string);
24
+ private initializeAccessory;
25
+ private updateAccessory;
26
+ get id(): string;
27
+ get name(): string;
28
+ get manufacturer(): string;
29
+ get model(): string;
30
+ get serialNumber(): string;
31
+ get firmwareRevision(): string;
32
+ protected extractChildIndex(child: {
33
+ id?: string | number;
34
+ }): number;
35
+ protected makeLockKey(childId?: string | number): string;
36
+ protected withLock<T>(key: string, action: () => Promise<T>): Promise<T>;
37
+ protected shouldSkipUpdate(): boolean;
38
+ protected waitForUpdateOrDiscovery(): Promise<void>;
39
+ protected getSysInfo(): Promise<void>;
40
+ private fetchSysInfoInternal;
41
+ protected refreshAndUpdateCharacteristics(forceUpdate: boolean): Promise<void>;
42
+ startPolling(): Promise<void>;
43
+ stopPolling(): Promise<void>;
44
+ updateAfterPeriodicDiscovery(): void;
45
+ protected setupPrimaryService(): void;
46
+ protected getPrimaryServiceType(): WithUUID<typeof this.platform.Service> | null;
47
+ protected buildPrimaryDescriptors(): CharacteristicDescriptor[];
48
+ protected registerCharacteristic(service: Service, type: WithUUID<new () => Characteristic>, onGet: () => Promise<CharacteristicValue>, onSet?: (value: CharacteristicValue) => Promise<void>): void;
49
+ protected buildDescriptorContext(child?: ChildDevice): DescriptorContext;
50
+ protected updateDeviceField<K extends keyof SysInfo>(key: K, value: SysInfo[K]): void;
51
+ private genericOnGet;
52
+ private genericOnSet;
53
+ private executeDescriptorSet;
54
+ protected updateAllServicesAndCharacteristics(forceUpdate: boolean): Promise<void>;
55
+ protected defaultValueForCharacteristic(type: WithUUID<new () => Characteristic>): CharacteristicValue;
56
+ protected updateIfChanged<T extends CharacteristicValue>(service: Service, characteristic: Characteristic, alias: string, previousValue: T, nextValue: T, label?: string, force?: boolean): void;
57
+ protected addService(serviceCtor: WithUUID<typeof this.platform.Service>, name: string, subType?: string): Service;
58
+ protected updateValue(service: Service, characteristic: Characteristic, deviceAlias: string, value: Nullable<CharacteristicValue> | Error | HapStatusError): void;
59
+ abstract initialize(): Promise<void>;
60
+ abstract identify(): void;
61
+ }