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,388 +1,41 @@
1
- import { EventEmitter } from 'node:events';
2
- import HomeKitDevice from './index.js';
3
- import { deferAndCombine } from '../utils.js';
4
- export default class HomeKitDeviceSwitchWithChildren extends HomeKitDevice {
1
+ import HomeKitParentDevice from './baseParent.js';
2
+ import { buildOnDescriptor, buildBrightnessDescriptor, buildFanActiveDescriptor, buildFanRotationDescriptor, } from './descriptorHelpers.js';
3
+ export default class HomeKitDeviceSwitchWithChildren extends HomeKitParentDevice {
5
4
  kasaDevice;
6
- isUpdating = false;
7
- previousKasaDevice;
8
- getSysInfo;
9
- pollingInterval;
10
- updateEmitter = new EventEmitter();
11
- static locks = new Map();
12
5
  constructor(platform, kasaDevice) {
13
6
  super(platform, kasaDevice, 8 /* Categories.SWITCH */, 'SWITCH');
14
7
  this.kasaDevice = kasaDevice;
15
- this.log.debug(`Initializing HomeKitDeviceSwitchWithChildren 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
- });
8
+ this.setupChildServices();
53
9
  }
54
10
  async initialize() {
55
- this.log.debug(`Initializing polling for device: ${this.kasaDevice.sys_info.alias}`);
56
11
  await this.startPolling();
57
12
  }
58
- async withLock(key, action) {
59
- let lock = HomeKitDeviceSwitchWithChildren.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 (HomeKitDeviceSwitchWithChildren.locks.get(key) === currentLock) {
69
- HomeKitDeviceSwitchWithChildren.locks.delete(key);
70
- }
71
- }
72
- });
73
- HomeKitDeviceSwitchWithChildren.locks.set(key, currentLock.then(() => { }));
74
- return currentLock;
75
- }
76
- checkService(child, index) {
77
- const serviceType = this.getServiceType(child);
78
- const service = this.homebridgeAccessory.getServiceById(serviceType, `child-${index + 1}`) ??
79
- this.addService(serviceType, child.alias, `child-${index + 1}`);
80
- this.checkCharacteristics(service, child);
81
- }
82
- getServiceType(child) {
13
+ getChildServiceType(child) {
83
14
  const { Lightbulb, Fanv2 } = this.platform.Service;
84
15
  return child.fan_speed_level !== undefined ? Fanv2 : Lightbulb;
85
16
  }
86
- checkCharacteristics(service, child) {
87
- const characteristics = this.getCharacteristics(child);
88
- characteristics.forEach(({ type, name }) => {
89
- this.getOrAddCharacteristic(service, type, name, child);
90
- });
91
- }
92
- getCharacteristics(child) {
93
- const characteristics = [];
17
+ buildChildDescriptors(child) {
18
+ const C = this.platform.Characteristic;
19
+ const descriptors = [];
94
20
  if (child.fan_speed_level !== undefined) {
95
- characteristics.push({
96
- type: this.platform.Characteristic.RotationSpeed,
97
- name: this.platform.getCharacteristicName(this.platform.Characteristic.RotationSpeed),
98
- }, {
99
- type: this.platform.Characteristic.Active,
100
- name: this.platform.getCharacteristicName(this.platform.Characteristic.Active),
101
- });
21
+ descriptors.push(buildFanActiveDescriptor(C, async (active, context) => {
22
+ const idx = this.extractChildIndex(context.child ?? {});
23
+ await this.deviceManager.controlDevice(context.device.host, 'state', active, idx);
24
+ }), buildFanRotationDescriptor(C, async (percent, context) => {
25
+ const idx = this.extractChildIndex(context.child ?? {});
26
+ await this.deviceManager.controlDevice(context.device.host, 'fan_speed_level', percent, idx);
27
+ }));
102
28
  }
103
29
  if (child.brightness !== undefined) {
104
- characteristics.push({
105
- type: this.platform.Characteristic.On,
106
- name: this.platform.getCharacteristicName(this.platform.Characteristic.On),
107
- }, {
108
- type: this.platform.Characteristic.Brightness,
109
- name: this.platform.getCharacteristicName(this.platform.Characteristic.Brightness),
110
- });
111
- }
112
- return characteristics;
113
- }
114
- getOrAddCharacteristic(service, characteristicType, characteristicName, child) {
115
- const characteristic = service.getCharacteristic(characteristicType) ??
116
- service.addCharacteristic(characteristicType);
117
- characteristic.onGet(this.handleOnGet.bind(this, service, characteristicType, characteristicName, child));
118
- characteristic.onSet(this.handleOnSet.bind(this, service, characteristicType, characteristicName, child));
119
- }
120
- async handleOnGet(service, characteristicType, characteristicName, child) {
121
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
122
- this.log.warn(`Device is offline or platform is shutting down, cannot get value for characteristic ${characteristicName}`);
123
- return this.getDefaultValue(characteristicType);
124
- }
125
- try {
126
- let characteristicValue = service.getCharacteristic(characteristicType).value;
127
- if (!characteristicValue) {
128
- characteristicValue = this.getInitialValue(characteristicType, child);
129
- service.getCharacteristic(characteristicType).updateValue(characteristicValue);
130
- }
131
- this.log.debug(`Got value for characteristic ${characteristicName}: ${characteristicValue}`);
132
- return characteristicValue ?? this.getDefaultValue(characteristicType);
133
- }
134
- catch (error) {
135
- this.log.error(`Error getting current value for characteristic ${characteristicName} for device: ${child.alias}:`, error);
136
- this.kasaDevice.offline = true;
137
- await this.stopPolling();
138
- return this.getDefaultValue(characteristicType);
139
- }
140
- }
141
- getDefaultValue(characteristicType) {
142
- const zeroValueCharacteristics = [
143
- this.platform.Characteristic.Brightness,
144
- this.platform.Characteristic.RotationSpeed,
145
- ];
146
- if (zeroValueCharacteristics.includes(characteristicType)) {
147
- return 0;
148
- }
149
- else if (characteristicType === this.platform.Characteristic.Active) {
150
- return this.platform.Characteristic.Active.INACTIVE;
151
- }
152
- return false;
153
- }
154
- getInitialValue(characteristicType, child) {
155
- if (characteristicType === this.platform.Characteristic.Active) {
156
- return child.state ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE;
157
- }
158
- else if (characteristicType === this.platform.Characteristic.Brightness) {
159
- return child.brightness ?? 0;
160
- }
161
- else if (characteristicType === this.platform.Characteristic.RotationSpeed) {
162
- return this.mapRotationSpeedToValue(child.fan_speed_level) ?? 0;
163
- }
164
- else if (characteristicType === this.platform.Characteristic.On) {
165
- return child.state ?? false;
166
- }
167
- return false;
168
- }
169
- mapRotationSpeedToValue(value) {
170
- return value * 25;
171
- }
172
- async handleOnSet(service, characteristicType, characteristicName, child, value) {
173
- const lockKey = `${this.kasaDevice.sys_info.device_id}:${child.id}`;
174
- await this.withLock(lockKey, async () => {
175
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
176
- this.log.warn(`Device is offline or platform is shutting down, cannot set value for characteristic ${characteristicName}`);
177
- return;
178
- }
179
- const task = async () => {
180
- if (this.deviceManager) {
181
- try {
182
- this.isUpdating = true;
183
- this.log.debug(`Setting value for characteristic ${characteristicName} to ${value}`);
184
- const characteristicKey = this.getCharacteristicKey(characteristicName);
185
- if (!characteristicKey) {
186
- throw new Error(`Characteristic key not found for ${characteristicName}`);
187
- }
188
- const childNumber = this.extractChildIndex(child);
189
- const controlValue = this.getControlValue(characteristicName, value);
190
- await this.deviceManager.controlDevice(this.kasaDevice.sys_info.host, characteristicKey, controlValue, childNumber);
191
- child[characteristicKey] = controlValue;
192
- const childIndex = this.kasaDevice.sys_info.children?.findIndex(c => c.id === child.id);
193
- if (childIndex !== undefined && childIndex !== -1) {
194
- this.kasaDevice.sys_info.children[childIndex] = { ...child };
195
- }
196
- this.updateValue(service, service.getCharacteristic(characteristicType), child.alias, value);
197
- this.previousKasaDevice = JSON.parse(JSON.stringify(this.kasaDevice));
198
- this.log.debug(`Set value for characteristic ${characteristicName} to ${value} successfully`);
199
- }
200
- catch (error) {
201
- this.log.error(`Error setting current value for characteristic ${characteristicName} for device: ${child.alias}:`, error);
202
- this.kasaDevice.offline = true;
203
- await this.stopPolling();
204
- }
205
- finally {
206
- this.isUpdating = false;
207
- this.updateEmitter.emit('updateComplete');
208
- }
209
- }
210
- else {
211
- throw new Error('Device manager is undefined.');
212
- }
213
- };
214
- await task();
215
- });
216
- }
217
- getCharacteristicKey(characteristicName) {
218
- const characteristicMap = {
219
- Active: 'state',
220
- Brightness: 'brightness',
221
- RotationSpeed: 'fan_speed_level',
222
- On: 'state',
223
- };
224
- return characteristicMap[characteristicName ?? ''];
225
- }
226
- getControlValue(characteristicName, value) {
227
- if (characteristicName === 'Active') {
228
- return value === 1 ? true : false;
229
- }
230
- else if (characteristicName === 'RotationSpeed') {
231
- return this.mapRotationSpeedToValue(value);
232
- }
233
- return value;
234
- }
235
- async updateState() {
236
- const lockKey = `${this.kasaDevice.sys_info.device_id}`;
237
- await this.withLock(lockKey, async () => {
238
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
239
- await this.stopPolling();
240
- return;
241
- }
242
- if (this.isUpdating || this.platform.periodicDeviceDiscovering) {
243
- let periodicDiscoveryComplete = false;
244
- await Promise.race([
245
- new Promise((resolve) => this.updateEmitter.once('updateComplete', resolve)),
246
- new Promise((resolve) => {
247
- this.updateEmitter.once('periodicDeviceDiscoveryComplete', () => {
248
- periodicDiscoveryComplete = true;
249
- resolve();
250
- });
251
- }),
252
- ]);
253
- if (periodicDiscoveryComplete) {
254
- if (this.pollingInterval) {
255
- await new Promise((resolve) => setTimeout(resolve, this.platform.config.discoveryOptions.pollingInterval));
256
- }
257
- else {
258
- return;
259
- }
260
- }
261
- }
262
- this.isUpdating = true;
263
- const task = async () => {
264
- try {
265
- await this.getSysInfo();
266
- this.kasaDevice.sys_info.children?.forEach((child) => {
267
- const childNumber = this.extractChildIndex(child);
268
- const service = this.getService(child, childNumber);
269
- if (service && this.previousKasaDevice) {
270
- this.updateChildState(service, child);
271
- }
272
- else {
273
- this.log.warn(`Service not found for child device: ${child.alias} or previous Kasa device is undefined`);
274
- }
275
- });
276
- }
277
- catch (error) {
278
- this.log.error('Error updating device state:', error);
279
- this.kasaDevice.offline = true;
280
- await this.stopPolling();
281
- }
282
- finally {
283
- this.isUpdating = false;
284
- this.updateEmitter.emit('updateComplete');
285
- }
286
- };
287
- await task();
288
- });
289
- }
290
- getService(child, childNumber) {
291
- if (child.brightness !== undefined) {
292
- return this.homebridgeAccessory.getServiceById(this.platform.Service.Lightbulb, `child-${childNumber + 1}`);
293
- }
294
- else if (child.fan_speed_level !== undefined) {
295
- return this.homebridgeAccessory.getServiceById(this.platform.Service.Fanv2, `child-${childNumber + 1}`);
296
- }
297
- return undefined;
298
- }
299
- updateChildState(service, child) {
300
- const previousChild = this.previousKasaDevice?.sys_info.children?.find(c => c.id === child.id);
301
- if (previousChild) {
302
- if (previousChild.state !== child.state) {
303
- if (service.UUID === this.platform.Service.Lightbulb.UUID) {
304
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.On), child.alias, child.state);
305
- this.log.debug(`Updated state for child device: ${child.alias} to ${child.state}`);
306
- }
307
- else if (service.UUID === this.platform.Service.Fanv2.UUID) {
308
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.Active), child.alias, child.state ? this.platform.Characteristic.Active.ACTIVE : this.platform.Characteristic.Active.INACTIVE);
309
- this.log.debug(`Updated active state for child device: ${child.alias} to ${child.state ? 'ACTIVE' : 'INACTIVE'}`);
310
- }
311
- }
312
- if (child.brightness !== undefined && previousChild.brightness !== child.brightness) {
313
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.Brightness), child.alias, child.brightness);
314
- this.log.debug(`Updated brightness for child device: ${child.alias} to ${child.brightness}`);
315
- }
316
- if (child.fan_speed_level !== undefined && previousChild.fan_speed_level !== child.fan_speed_level) {
317
- const updateValue = this.mapRotationSpeedToValue(child.fan_speed_level);
318
- this.updateValue(service, service.getCharacteristic(this.platform.Characteristic.RotationSpeed), child.alias, updateValue);
319
- this.log.debug(`Updated fan speed for child device: ${child.alias} to ${updateValue}`);
320
- }
321
- }
322
- }
323
- updateAfterPeriodicDiscovery() {
324
- this.kasaDevice.sys_info.children?.forEach((child) => {
325
- const serviceType = this.getServiceType(child);
326
- const index = this.extractChildIndex(child);
327
- const service = this.homebridgeAccessory.getServiceById(serviceType, `child-${index + 1}`);
328
- if (service) {
329
- this.updateCharacteristics(service, child);
330
- }
331
- else {
332
- this.log.debug(`Service not found for child device: ${child.alias}`);
333
- }
334
- });
335
- }
336
- updateCharacteristics(service, child) {
337
- const characteristics = this.getCharacteristics(child);
338
- characteristics.forEach(({ type, name }) => {
339
- const characteristic = service.getCharacteristic(type);
340
- if (characteristic) {
341
- const characteristicKey = this.getCharacteristicKey(name);
342
- if (child[characteristicKey] !== undefined) {
343
- const value = child[characteristicKey];
344
- const controlValue = this.getControlValue(name, value);
345
- this.log.debug(`Setting value for characteristic ${name} to ${controlValue}`);
346
- this.updateValue(service, characteristic, child.alias, controlValue);
347
- }
348
- }
349
- });
350
- }
351
- async startPolling() {
352
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
353
- await this.stopPolling();
354
- return;
355
- }
356
- if (this.pollingInterval) {
357
- clearInterval(this.pollingInterval);
358
- }
359
- this.log.debug('Starting polling for device:', this.name);
360
- this.pollingInterval = setInterval(async () => {
361
- if (this.kasaDevice.offline || this.platform.isShuttingDown) {
362
- if (this.isUpdating) {
363
- this.isUpdating = false;
364
- this.updateEmitter.emit('updateComplete');
365
- }
366
- await this.stopPolling();
367
- }
368
- else {
369
- await this.updateState();
370
- }
371
- }, this.platform.config.discoveryOptions.pollingInterval);
372
- }
373
- async stopPolling() {
374
- if (this.pollingInterval) {
375
- clearInterval(this.pollingInterval);
376
- this.pollingInterval = undefined;
377
- this.log.debug('Stopped polling');
378
- }
379
- if (this.isUpdating) {
380
- this.log.debug('Waiting for ongoing polling task to complete for device:', this.name);
381
- await new Promise((resolve) => {
382
- this.isUpdating = false;
383
- this.updateEmitter.once('updateComplete', resolve);
384
- });
385
- }
30
+ descriptors.push(buildOnDescriptor(C, async (value, context) => {
31
+ const idx = this.extractChildIndex(context.child ?? {});
32
+ await this.deviceManager.controlDevice(context.device.host, 'state', value, idx);
33
+ }), buildBrightnessDescriptor(C, async (value, context) => {
34
+ const idx = this.extractChildIndex(context.child ?? {});
35
+ await this.deviceManager.controlDevice(context.device.host, 'brightness', value, idx);
36
+ }));
37
+ }
38
+ return descriptors;
386
39
  }
387
40
  identify() {
388
41
  this.log.info('identify');
@@ -1 +1 @@
1
- {"version":3,"file":"homekitSwitchWithChildren.js","sourceRoot":"","sources":["../../src/devices/homekitSwitchWithChildren.ts"],"names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U,KAAK,SAAS,EAAE,CAAC;YACnC,WAAW,CAAC,IAAI,CACd,iBAAiB,CACf,CAAC,EACD,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBACvB,MAAM,GAAG,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;gBACxD,MAAM,IAAI,CAAC,aAAc,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;YACpF,CAAC,CACF,EACD,yBAAyB,CACvB,CAAC,EACD,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBACvB,MAAM,GAAG,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;gBACxD,MAAM,IAAI,CAAC,aAAc,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;YACzF,CAAC,CACF,CACF,CAAC;QACJ,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import type { Characteristic, HAP, WithUUID } from 'homebridge';
2
+ export declare function createEnergyCharacteristics(hap: HAP): EnergyCharacteristics;
3
+ export interface EnergyCharacteristics {
4
+ Volts: WithUUID<new () => Characteristic>;
5
+ Amperes: WithUUID<new () => Characteristic>;
6
+ Watts: WithUUID<new () => Characteristic>;
7
+ KiloWattHours: WithUUID<new () => Characteristic>;
8
+ }
@@ -0,0 +1,88 @@
1
+ const EnergyCharacteristicValues = {
2
+ VOLTS: {
3
+ name: 'Volts',
4
+ uuid: 'E863F10A-079E-48FF-8F27-9C2605A29F52',
5
+ },
6
+ AMPERES: {
7
+ name: 'Amperes',
8
+ uuid: 'E863F126-079E-48FF-8F27-9C2605A29F52',
9
+ },
10
+ WATTS: {
11
+ name: 'Watts',
12
+ uuid: 'E863F10D-079E-48FF-8F27-9C2605A29F52',
13
+ },
14
+ KILOWATTHOURS: {
15
+ name: 'KiloWattHours',
16
+ uuid: 'E863F10C-079E-48FF-8F27-9C2605A29F52',
17
+ },
18
+ };
19
+ export function createEnergyCharacteristics(hap) {
20
+ const { Characteristic, Formats, Perms } = hap;
21
+ const Volts = class extends Characteristic {
22
+ static UUID = EnergyCharacteristicValues.VOLTS.uuid;
23
+ static name = EnergyCharacteristicValues.VOLTS.name;
24
+ constructor() {
25
+ super(Volts.name, Volts.UUID, {
26
+ format: "float" /* Formats.FLOAT */,
27
+ unit: undefined,
28
+ minValue: 0,
29
+ maxValue: 65535,
30
+ minStep: 0.1,
31
+ perms: ["pr" /* Perms.PAIRED_READ */, "ev" /* Perms.NOTIFY */],
32
+ });
33
+ this.value = this.getDefaultValue();
34
+ }
35
+ };
36
+ const Amperes = class extends Characteristic {
37
+ static UUID = EnergyCharacteristicValues.AMPERES.uuid;
38
+ static name = EnergyCharacteristicValues.AMPERES.name;
39
+ constructor() {
40
+ super(Amperes.name, Amperes.UUID, {
41
+ format: "float" /* Formats.FLOAT */,
42
+ unit: undefined,
43
+ minValue: 0,
44
+ maxValue: 65535,
45
+ minStep: 0.01,
46
+ perms: ["pr" /* Perms.PAIRED_READ */, "ev" /* Perms.NOTIFY */],
47
+ });
48
+ this.value = this.getDefaultValue();
49
+ }
50
+ };
51
+ const Watts = class extends Characteristic {
52
+ static UUID = EnergyCharacteristicValues.WATTS.uuid;
53
+ static name = EnergyCharacteristicValues.WATTS.name;
54
+ constructor() {
55
+ super(Watts.name, Watts.UUID, {
56
+ format: "float" /* Formats.FLOAT */,
57
+ unit: undefined,
58
+ minValue: 0,
59
+ maxValue: 65535,
60
+ minStep: 0.1,
61
+ perms: ["pr" /* Perms.PAIRED_READ */, "ev" /* Perms.NOTIFY */],
62
+ });
63
+ this.value = this.getDefaultValue();
64
+ }
65
+ };
66
+ const KiloWattHours = class extends Characteristic {
67
+ static UUID = EnergyCharacteristicValues.KILOWATTHOURS.uuid;
68
+ static name = EnergyCharacteristicValues.KILOWATTHOURS.name;
69
+ constructor() {
70
+ super(KiloWattHours.name, KiloWattHours.UUID, {
71
+ format: "float" /* Formats.FLOAT */,
72
+ unit: undefined,
73
+ minValue: 0,
74
+ maxValue: 65535,
75
+ minStep: 0.001,
76
+ perms: ["pr" /* Perms.PAIRED_READ */, "ev" /* Perms.NOTIFY */],
77
+ });
78
+ this.value = this.getDefaultValue();
79
+ }
80
+ };
81
+ return {
82
+ Volts: Volts,
83
+ Amperes: Amperes,
84
+ Watts: Watts,
85
+ KiloWattHours: KiloWattHours,
86
+ };
87
+ }
88
+ //# sourceMappingURL=energyCharacteristics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"energyCharacteristics.js","sourceRoot":"","sources":["../src/energyCharacteristics.ts"],"names":[],"mappings":"AAEA,MAAM,0BAA0B,GAAG;IACjC,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,sCAAsC;KAC7C;IACD,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,sCAAsC;KAC7C;IACD,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,sCAAsC;KAC7C;IACD,aAAa,EAAE;QACb,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,sCAAsC;KAC7C;CACF,CAAC;AAEF,MAAM,UAAU,2BAA2B,CAAC,GAAQ;IAClD,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;IAE/C,MAAM,KAAK,GAAG,KAAM,SAAQ,cAAc;QACxC,MAAM,CAAU,IAAI,GAAW,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC;QACrE,MAAM,CAAU,IAAI,GAAW,0BAA0B,CAAC,KAAK,CA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AiC;aACzC,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACtC,CAAC;KACF,CAAC;IAEF,MAAM,aAAa,GAAG,KAAM,SAAQ,cAAc;QAChD,MAAM,CAAU,IAAI,GAAW,0BAA0B,CAAC,aAAa,CAAC,IAAI,CAAC;QAC7E,MAAM,CAAU,IAAI,GAAW,0BAA0B,CAAC,aAAa,CAAC,IAAI,CAAC;QAE7E;YACE,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE;gBAC5C,MAAM,6BAAe;gBACrB,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,uDAAiC;aACzC,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACtC,CAAC;KACF,CAAC;IAEF,OAAO;QACL,KAAK,EAAE,KAA2C;QAClD,OAAO,EAAE,OAA6C;QACtD,KAAK,EAAE,KAA2C;QAClD,aAAa,EAAE,aAAmD;KACnE,CAAC;AACJ,CAAC"}
@@ -3,6 +3,7 @@ import { EventEmitter } from 'node:events';
3
3
  import DeviceManager from './devices/deviceManager.js';
4
4
  import { TaskQueue } from './taskQueue.js';
5
5
  import type { KasaPythonConfig } from './config.js';
6
+ import type { EnergyCharacteristics } from './energyCharacteristics.js';
6
7
  export type KasaPythonAccessoryContext = {
7
8
  deviceId?: string;
8
9
  lastSeen?: Date;
@@ -12,6 +13,7 @@ export default class KasaPythonPlatform implements DynamicPlatformPlugin {
12
13
  readonly log: Logging;
13
14
  readonly api: API;
14
15
  readonly Characteristic: typeof Characteristic;
16
+ readonly energyCharacteristics: EnergyCharacteristics | undefined;
15
17
  readonly configuredAccessories: Map<string, PlatformAccessory<KasaPythonAccessoryContext>>;
16
18
  readonly offlineAccessories: Map<string, PlatformAccessory<KasaPythonAccessoryContext>>;
17
19
  readonly Service: typeof Service;
@@ -60,8 +62,8 @@ export default class KasaPythonPlatform implements DynamicPlatformPlugin {
60
62
  name?: string | null;
61
63
  displayName?: string | null;
62
64
  }>): string | undefined;
63
- registerPlatformAccessory(platformAccessory: PlatformAccessory<KasaPythonAccessoryContext>): void;
64
- configureAccessory(platformAccessory: PlatformAccessory<KasaPythonAccessoryContext>): void;
65
+ registerPlatformAccessory(accessory: PlatformAccessory<KasaPythonAccessoryContext>): void;
66
+ configureAccessory(accessory: PlatformAccessory<KasaPythonAccessoryContext>): void;
65
67
  private foundDevice;
66
68
  private createHomeKitDevice;
67
69
  }