homebridge-tapo 1.5.4 → 1.5.5-beta0
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.
- package/config.schema.json +2 -2
- package/dist/config.d.ts +13 -74
- package/dist/config.js +8 -17
- package/dist/config.js.map +1 -1
- package/dist/platform.d.ts +5 -0
- package/dist/platform.js +19 -10
- package/dist/platform.js.map +1 -1
- package/dist/platformL510EAccessory.d.ts +3 -8
- package/dist/platformL510EAccessory.js +26 -70
- package/dist/platformL510EAccessory.js.map +1 -1
- package/dist/platformL520EAccessory.d.ts +5 -15
- package/dist/platformL520EAccessory.js +36 -117
- package/dist/platformL520EAccessory.js.map +1 -1
- package/dist/platformL530Accessory.d.ts +16 -48
- package/dist/platformL530Accessory.js +83 -275
- package/dist/platformL530Accessory.js.map +1 -1
- package/dist/platformP100Accessory.d.ts +2 -2
- package/dist/platformP100Accessory.js +6 -9
- package/dist/platformP100Accessory.js.map +1 -1
- package/dist/platformP110Accessory.d.ts +3 -18
- package/dist/platformP110Accessory.js +11 -57
- package/dist/platformP110Accessory.js.map +1 -1
- package/dist/platformTPLinkAccessory.d.ts +32 -8
- package/dist/platformTPLinkAccessory.js +118 -61
- package/dist/platformTPLinkAccessory.js.map +1 -1
- package/dist/utils/l510e.js +1 -7
- package/dist/utils/l510e.js.map +1 -1
- package/dist/utils/l520e.js +12 -10
- package/dist/utils/l520e.js.map +1 -1
- package/dist/utils/l530.js +29 -68
- package/dist/utils/l530.js.map +1 -1
- package/dist/utils/newTpLinkCipher.d.ts +1 -1
- package/dist/utils/p100.d.ts +15 -3
- package/dist/utils/p100.js +88 -128
- package/dist/utils/p100.js.map +1 -1
- package/dist/utils/p110.js +19 -38
- package/dist/utils/p110.js.map +1 -1
- package/package.json +8 -8
- package/.idea/hotswap_agent.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/AGENTS.md +0 -125
- package/dist/custom-characteristics/resetConsumptionCharacteristic.d.ts +0 -2
- package/dist/custom-characteristics/resetConsumptionCharacteristic.js +0 -17
- package/dist/custom-characteristics/resetConsumptionCharacteristic.js.map +0 -1
- package/homebridge-tapo-p100.iml +0 -9
- package/scripts/test-p110.ts +0 -142
package/config.schema.json
CHANGED
|
@@ -80,13 +80,13 @@
|
|
|
80
80
|
"updateInterval": {
|
|
81
81
|
"title": "Interval in which the state of the Accessory should be updated (in seconds)",
|
|
82
82
|
"type": "number",
|
|
83
|
-
"default":
|
|
83
|
+
"default": 10,
|
|
84
84
|
"required": false
|
|
85
85
|
},
|
|
86
86
|
"timeout": {
|
|
87
87
|
"title": "Request Timeout for the request sent to the Accessory (in seconds)",
|
|
88
88
|
"type": "number",
|
|
89
|
-
"default":
|
|
89
|
+
"default": 2,
|
|
90
90
|
"required": false
|
|
91
91
|
}
|
|
92
92
|
}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,85 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
1
|
+
/**
|
|
2
|
+
* A device entry from the `devices` array in config.json (see config.schema.json).
|
|
3
|
+
*/
|
|
4
|
+
export type TapoDeviceConfig = {
|
|
6
5
|
name?: string;
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
devices: Array<{
|
|
16
|
-
name?: string;
|
|
17
|
-
host: string;
|
|
18
|
-
type?: string | undefined;
|
|
19
|
-
port?: number | undefined;
|
|
20
|
-
updateInterval?: number | undefined;
|
|
21
|
-
timeout?: number;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* Username used in Tapo app
|
|
25
|
-
*/
|
|
26
|
-
username: string;
|
|
27
|
-
/**
|
|
28
|
-
* Password used in Tapo app
|
|
29
|
-
*/
|
|
30
|
-
password: string;
|
|
31
|
-
/**
|
|
32
|
-
* (seconds) communication timeout
|
|
33
|
-
* @defaultValue 15
|
|
34
|
-
*/
|
|
6
|
+
/** IP address or hostname of the device. */
|
|
7
|
+
host: string;
|
|
8
|
+
/** Plug | PowerPlug | Light | WhiteLight | Colorlight (case-insensitive). Defaults to Plug. */
|
|
9
|
+
type?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
/** (seconds) How often the device state is polled. Defaults to 10. */
|
|
12
|
+
updateInterval?: number;
|
|
13
|
+
/** (seconds) Request timeout for this device. Defaults to 2. */
|
|
35
14
|
timeout?: number;
|
|
36
|
-
/**
|
|
37
|
-
* (milliseconds) The time to wait to combine similar commands for a device before sending a command to a device
|
|
38
|
-
* @defaultValue 100
|
|
39
|
-
*/
|
|
40
|
-
waitTimeUpdate?: number;
|
|
41
|
-
}
|
|
42
|
-
type TapoConfigDefault = {
|
|
43
|
-
name: string;
|
|
44
|
-
username: string;
|
|
45
|
-
password: string;
|
|
46
|
-
pollingInterval: number;
|
|
47
|
-
devices?: Array<{
|
|
48
|
-
name?: string;
|
|
49
|
-
host: string;
|
|
50
|
-
type?: string | 'plug';
|
|
51
|
-
port?: number | undefined;
|
|
52
|
-
updateInterval?: number | 30;
|
|
53
|
-
timeout?: number | 2;
|
|
54
|
-
}>;
|
|
55
|
-
timeout: number;
|
|
56
|
-
waitTimeUpdate: number;
|
|
57
15
|
};
|
|
58
16
|
export type TapoConfig = {
|
|
59
17
|
name: string;
|
|
60
18
|
username: string;
|
|
61
19
|
password: string;
|
|
62
|
-
waitTimeUpdate: number;
|
|
63
|
-
defaultSendOptions: {
|
|
64
|
-
timeout: number;
|
|
65
|
-
};
|
|
66
20
|
discoveryOptions: {
|
|
67
|
-
|
|
68
|
-
deviceOptions: {
|
|
69
|
-
defaultSendOptions: {
|
|
70
|
-
timeout: number;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
devices: Array<{
|
|
74
|
-
name?: string;
|
|
75
|
-
host: string;
|
|
76
|
-
type?: string | undefined;
|
|
77
|
-
port?: number | undefined;
|
|
78
|
-
updateInterval?: number | undefined;
|
|
79
|
-
timeout?: number | undefined;
|
|
80
|
-
}>;
|
|
21
|
+
devices: Array<TapoDeviceConfig> | undefined;
|
|
81
22
|
};
|
|
82
23
|
};
|
|
83
|
-
export declare const defaultConfig: TapoConfigDefault;
|
|
84
24
|
export declare function parseConfig(config: Record<string, unknown>): TapoConfig;
|
|
85
|
-
export {};
|
package/dist/config.js
CHANGED
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
export const defaultConfig = {
|
|
1
|
+
const defaultConfig = {
|
|
3
2
|
name: 'Tapo Smart Platform',
|
|
4
3
|
username: '',
|
|
5
4
|
password: '',
|
|
6
|
-
pollingInterval: 10,
|
|
7
5
|
devices: undefined,
|
|
8
|
-
timeout: 15,
|
|
9
|
-
waitTimeUpdate: 100,
|
|
10
6
|
};
|
|
11
7
|
export function parseConfig(config) {
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
// Like lodash.defaults: only fill keys that are missing or undefined.
|
|
9
|
+
const c = { ...defaultConfig };
|
|
10
|
+
for (const [key, value] of Object.entries(config)) {
|
|
11
|
+
if (value !== undefined) {
|
|
12
|
+
c[key] = value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
16
15
|
return {
|
|
17
16
|
name: c.name,
|
|
18
17
|
username: c.username,
|
|
19
18
|
password: c.password,
|
|
20
|
-
waitTimeUpdate: c.waitTimeUpdate,
|
|
21
|
-
defaultSendOptions,
|
|
22
19
|
discoveryOptions: {
|
|
23
|
-
discoveryInterval: c.pollingInterval * 1000,
|
|
24
|
-
deviceOptions: {
|
|
25
|
-
defaultSendOptions,
|
|
26
|
-
},
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
28
|
-
//@ts-ignore
|
|
29
20
|
devices: c.devices,
|
|
30
21
|
},
|
|
31
22
|
};
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AA0BA,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,qBAAqB;IAC3B,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,SAAgD;CAC1D,CAAC;AAEF,MAAM,UAAU,WAAW,CACzB,MAA+B;IAE/B,sEAAsE;IACtE,MAAM,CAAC,GAA4B,EAAE,GAAG,aAAa,EAAE,CAAC;IACxD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,IAAc;QACtB,QAAQ,EAAE,CAAC,CAAC,QAAkB;QAC9B,QAAQ,EAAE,CAAC,CAAC,QAAkB;QAE9B,gBAAgB,EAAE;YAChB,OAAO,EAAE,CAAC,CAAC,OAA8C;SAC1D;KACF,CAAC;AACJ,CAAC"}
|
package/dist/platform.d.ts
CHANGED
|
@@ -28,4 +28,9 @@ export declare class TapoPlatform implements DynamicPlatformPlugin {
|
|
|
28
28
|
* must not be registered again to prevent "duplicate UUID" errors.
|
|
29
29
|
*/
|
|
30
30
|
discoverDevices(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Unregisters cached accessories that no longer match a configured device, i.e. devices that
|
|
33
|
+
* were removed from the config or whose host/name changed (the UUID is derived from both).
|
|
34
|
+
*/
|
|
35
|
+
private removeStaleAccessories;
|
|
31
36
|
}
|
package/dist/platform.js
CHANGED
|
@@ -29,9 +29,9 @@ export class TapoPlatform {
|
|
|
29
29
|
this.api = api;
|
|
30
30
|
this.Service = api.hap.Service;
|
|
31
31
|
this.Characteristic = api.hap.Characteristic;
|
|
32
|
-
this.log.debug('config.json: %j', config);
|
|
33
32
|
this.config = parseConfig(config);
|
|
34
|
-
|
|
33
|
+
// Never log the password: users routinely paste -D logs into public issues.
|
|
34
|
+
this.log.debug('config: %j', { ...this.config, password: this.config.password ? '***' : '' });
|
|
35
35
|
this.log.debug('Finished initializing platform:', this.config.name);
|
|
36
36
|
this.customCharacteristics = Characteristics(api.hap.Characteristic);
|
|
37
37
|
this.FakeGatoHistoryService = fakegato(this.api);
|
|
@@ -86,7 +86,7 @@ export class TapoPlatform {
|
|
|
86
86
|
if (device.type && device.type.toLowerCase() === 'colorlight') {
|
|
87
87
|
new L530Accessory(this.log, this, existingAccessory, device.timeout ? device.timeout : 2, device.updateInterval);
|
|
88
88
|
}
|
|
89
|
-
else if (device.type && device.type.toLowerCase() === '
|
|
89
|
+
else if (device.type && device.type.toLowerCase() === 'whitelight') {
|
|
90
90
|
new L520EAccessory(this.log, this, existingAccessory, device.timeout ? device.timeout : 2, device.updateInterval);
|
|
91
91
|
}
|
|
92
92
|
else if (device.type && device.type.toLowerCase() === 'light') {
|
|
@@ -101,12 +101,6 @@ export class TapoPlatform {
|
|
|
101
101
|
// update accessory cache with any changes to the accessory details and information
|
|
102
102
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
103
103
|
}
|
|
104
|
-
else if (!device) {
|
|
105
|
-
// it is possible to remove platform accessories at any time using `api.unregisterPlatformAccessories`, eg.:
|
|
106
|
-
// remove platform accessories when no longer present
|
|
107
|
-
this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [existingAccessory]);
|
|
108
|
-
this.log.info('Removing existing accessory from cache:', existingAccessory.displayName);
|
|
109
|
-
}
|
|
110
104
|
}
|
|
111
105
|
else {
|
|
112
106
|
// the accessory does not yet exist, so we need to create it
|
|
@@ -130,7 +124,7 @@ export class TapoPlatform {
|
|
|
130
124
|
accessory.context.device = device;
|
|
131
125
|
new L510EAccessory(this.log, this, accessory, device.timeout ? device.timeout : 2, device.updateInterval);
|
|
132
126
|
}
|
|
133
|
-
else if (device.type && device.type.toLowerCase() === '
|
|
127
|
+
else if (device.type && device.type.toLowerCase() === 'whitelight') {
|
|
134
128
|
// create a new accessory
|
|
135
129
|
accessory = new this.api.platformAccessory(device.name ? device.name : device.host, uuid, 5 /* Categories.LIGHTBULB */);
|
|
136
130
|
// store a copy of the device object in the `accessory.context`
|
|
@@ -159,6 +153,21 @@ export class TapoPlatform {
|
|
|
159
153
|
}
|
|
160
154
|
}
|
|
161
155
|
}
|
|
156
|
+
this.removeStaleAccessories(devices ?? []);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Unregisters cached accessories that no longer match a configured device, i.e. devices that
|
|
160
|
+
* were removed from the config or whose host/name changed (the UUID is derived from both).
|
|
161
|
+
*/
|
|
162
|
+
removeStaleAccessories(devices) {
|
|
163
|
+
const configured = new Set(devices.map(device => this.api.hap.uuid.generate(device.host + (device.name ? device.name : ''))));
|
|
164
|
+
const stale = this.accessories.filter(accessory => !configured.has(accessory.UUID));
|
|
165
|
+
if (stale.length > 0) {
|
|
166
|
+
for (const accessory of stale) {
|
|
167
|
+
this.log.info('Removing accessory no longer in config:', accessory.displayName);
|
|
168
|
+
}
|
|
169
|
+
this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, stale);
|
|
170
|
+
}
|
|
162
171
|
}
|
|
163
172
|
}
|
|
164
173
|
//# sourceMappingURL=platform.js.map
|
package/dist/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAc,MAAM,aAA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AI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9H,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAEpF,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;gBAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,yCAAyC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;YAClF,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,WAAW,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlatformAccessory, CharacteristicValue,
|
|
1
|
+
import { PlatformAccessory, CharacteristicValue, Logger } from 'homebridge';
|
|
2
2
|
import type { TapoPlatform } from './platform.js';
|
|
3
3
|
import L510E from './utils/l510e.js';
|
|
4
4
|
import { TPLinkPlatformAccessory } from './platformTPLinkAccessory.js';
|
|
@@ -19,12 +19,7 @@ export declare class L510EAccessory extends TPLinkPlatformAccessory<L510E> {
|
|
|
19
19
|
* Handle "SET" requests from HomeKit
|
|
20
20
|
* These are sent when the user changes the state of an accessory.
|
|
21
21
|
*/
|
|
22
|
-
setBrightness(value: CharacteristicValue
|
|
23
|
-
|
|
24
|
-
* Handle the "GET" requests from HomeKit
|
|
25
|
-
* These are sent when HomeKit wants to know the current state of the accessory.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
getBrightness(callback: CharacteristicGetCallback): void;
|
|
22
|
+
setBrightness(value: CharacteristicValue): Promise<void>;
|
|
23
|
+
getBrightness(): Promise<CharacteristicValue>;
|
|
29
24
|
protected updateState(interval: number): void;
|
|
30
25
|
}
|
|
@@ -35,75 +35,39 @@ export class L510EAccessory extends TPLinkPlatformAccessory {
|
|
|
35
35
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, sysInfo.hw_id);
|
|
36
36
|
// each service must implement at-minimum the "required characteristics" for the given service type
|
|
37
37
|
// see https://developers.homebridge.io/#/service/Outlet
|
|
38
|
-
// register handlers for the On/Off Characteristic
|
|
39
38
|
this.service.getCharacteristic(this.platform.Characteristic.On)
|
|
40
|
-
.
|
|
41
|
-
.
|
|
42
|
-
// register handlers for the Brightness Characteristic
|
|
39
|
+
.onSet(this.setOn.bind(this))
|
|
40
|
+
.onGet(this.getOn.bind(this));
|
|
43
41
|
this.service.getCharacteristic(this.platform.Characteristic.Brightness)
|
|
44
|
-
.
|
|
45
|
-
.
|
|
42
|
+
.onSet(this.setBrightness.bind(this))
|
|
43
|
+
.onGet(this.getBrightness.bind(this));
|
|
46
44
|
const interval = updateInterval ? updateInterval * 1000 : 10000;
|
|
47
45
|
setTimeout(() => {
|
|
48
46
|
this.updateState(interval);
|
|
49
47
|
}, interval);
|
|
50
48
|
}).catch(() => {
|
|
51
|
-
this.setNoResponse();
|
|
52
49
|
this.log.error('Get Device Info failed');
|
|
50
|
+
this.retryInitialise();
|
|
53
51
|
});
|
|
54
52
|
}
|
|
55
53
|
/**
|
|
56
54
|
* Handle "SET" requests from HomeKit
|
|
57
55
|
* These are sent when the user changes the state of an accessory.
|
|
58
56
|
*/
|
|
59
|
-
setBrightness(value
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// you must call the callback function
|
|
66
|
-
callback(null);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
callback(new Error('unreachable'), false);
|
|
70
|
-
}
|
|
71
|
-
}).catch((error) => {
|
|
72
|
-
this.log.error('Failed to set brightness: ' + error);
|
|
73
|
-
callback(new Error('unreachable'), false);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
callback(null);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Handle the "GET" requests from HomeKit
|
|
82
|
-
* These are sent when HomeKit wants to know the current state of the accessory.
|
|
83
|
-
*
|
|
84
|
-
*/
|
|
85
|
-
getBrightness(callback) {
|
|
86
|
-
this.tpLinkAccessory.getDeviceInfo().then((response) => {
|
|
87
|
-
if (response) {
|
|
88
|
-
const brightness = response.brightness;
|
|
89
|
-
if (brightness !== undefined) {
|
|
90
|
-
this.platform.log.debug('Get Characteristic Brightness ->', brightness);
|
|
91
|
-
// you must call the callback function
|
|
92
|
-
// the first argument should be null if there were no errors
|
|
93
|
-
// the second argument should be the value to return
|
|
94
|
-
// you must call the callback function
|
|
95
|
-
callback(null, brightness);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
callback(new Error('unreachable'), 0);
|
|
99
|
-
}
|
|
57
|
+
async setBrightness(value) {
|
|
58
|
+
const brightness = value;
|
|
59
|
+
return this.setWhenOn('brightness', () => this.tpLinkAccessory.setBrightness(brightness).then((result) => {
|
|
60
|
+
if (result) {
|
|
61
|
+
this.platform.log.debug('Set Characteristic Brightness ->', brightness);
|
|
62
|
+
this.tpLinkAccessory.getSysInfo().brightness = brightness;
|
|
100
63
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
64
|
+
return result;
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
async getBrightness() {
|
|
68
|
+
const brightness = this.cached((sysInfo) => sysInfo.brightness);
|
|
69
|
+
this.platform.log.debug('Get Characteristic Brightness ->', brightness);
|
|
70
|
+
return brightness;
|
|
107
71
|
}
|
|
108
72
|
updateState(interval) {
|
|
109
73
|
this.tpLinkAccessory.getDeviceInfo(true).then((response) => {
|
|
@@ -111,29 +75,21 @@ export class L510EAccessory extends TPLinkPlatformAccessory {
|
|
|
111
75
|
const isOn = response.device_on;
|
|
112
76
|
const brightness = response.brightness;
|
|
113
77
|
this.platform.log.debug('Get Characteristic On ->', isOn);
|
|
114
|
-
if (isOn !== undefined) {
|
|
115
|
-
this.service.updateCharacteristic(this.platform.Characteristic.On, isOn);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
this.setNoResponse();
|
|
119
|
-
interval += 300000;
|
|
120
|
-
}
|
|
121
78
|
if (brightness) {
|
|
122
79
|
this.service.updateCharacteristic(this.platform.Characteristic.Brightness, brightness);
|
|
123
80
|
}
|
|
81
|
+
if (isOn !== undefined) {
|
|
82
|
+
this.service.updateCharacteristic(this.platform.Characteristic.On, isOn);
|
|
83
|
+
this.scheduleNextUpdate(interval);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
124
86
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}, interval);
|
|
87
|
+
this.setNoResponse();
|
|
88
|
+
this.scheduleNextUpdate(interval, true);
|
|
128
89
|
}).catch(() => {
|
|
129
90
|
this.setNoResponse();
|
|
130
|
-
|
|
131
|
-
this.updateState(interval + 300000);
|
|
132
|
-
}, interval);
|
|
91
|
+
this.scheduleNextUpdate(interval, true);
|
|
133
92
|
});
|
|
134
|
-
setTimeout(() => {
|
|
135
|
-
this.updateState(interval);
|
|
136
|
-
}, interval);
|
|
137
93
|
}
|
|
138
94
|
}
|
|
139
95
|
//# sourceMappingURL=platformL510EAccessory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platformL510EAccessory.js","sourceRoot":"","sources":["../src/platformL510EAccessory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;;;GAIG;AACH,MAAM,OA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 +1,4 @@
|
|
|
1
|
-
import { PlatformAccessory, CharacteristicValue,
|
|
1
|
+
import { PlatformAccessory, CharacteristicValue, Logger } from 'homebridge';
|
|
2
2
|
import type { TapoPlatform } from './platform.js';
|
|
3
3
|
import L520E from './utils/l520e.js';
|
|
4
4
|
import { TPLinkPlatformAccessory } from './platformTPLinkAccessory.js';
|
|
@@ -19,23 +19,13 @@ export declare class L520EAccessory extends TPLinkPlatformAccessory<L520E> {
|
|
|
19
19
|
* Handle "SET" requests from HomeKit
|
|
20
20
|
* These are sent when the user changes the state of an accessory.
|
|
21
21
|
*/
|
|
22
|
-
setBrightness(value: CharacteristicValue
|
|
23
|
-
|
|
24
|
-
* Handle the "GET" requests from HomeKit
|
|
25
|
-
* These are sent when HomeKit wants to know the current state of the accessory.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
getBrightness(callback: CharacteristicGetCallback): void;
|
|
22
|
+
setBrightness(value: CharacteristicValue): Promise<void>;
|
|
23
|
+
getBrightness(): Promise<CharacteristicValue>;
|
|
29
24
|
protected updateState(interval: number): void;
|
|
30
25
|
/**
|
|
31
26
|
* Handle "SET" requests from HomeKit
|
|
32
27
|
* These are sent when the user changes the state of an accessory.
|
|
33
28
|
*/
|
|
34
|
-
setColorTemp(value: CharacteristicValue
|
|
35
|
-
|
|
36
|
-
* Handle the "GET" requests from HomeKit
|
|
37
|
-
* These are sent when HomeKit wants to know the current state of the accessory.
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
getColorTemp(callback: CharacteristicGetCallback): void;
|
|
29
|
+
setColorTemp(value: CharacteristicValue): Promise<void>;
|
|
30
|
+
getColorTemp(): Promise<CharacteristicValue>;
|
|
41
31
|
}
|