homebridge-tapo 1.4.17 → 1.5.0-beta3

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 (48) hide show
  1. package/README.md +2 -2
  2. package/config.schema.json +8 -4
  3. package/dist/custom-characteristics/resetConsumptionCharacteristic.d.ts +3 -0
  4. package/dist/custom-characteristics/resetConsumptionCharacteristic.d.ts.map +1 -0
  5. package/dist/custom-characteristics/resetConsumptionCharacteristic.js +22 -0
  6. package/dist/custom-characteristics/resetConsumptionCharacteristic.js.map +1 -0
  7. package/dist/homekit-device/types.d.ts +3 -1
  8. package/dist/homekit-device/types.d.ts.map +1 -1
  9. package/dist/platform.d.ts.map +1 -1
  10. package/dist/platform.js +12 -0
  11. package/dist/platform.js.map +1 -1
  12. package/dist/platformL510EAccessory.d.ts +1 -0
  13. package/dist/platformL510EAccessory.d.ts.map +1 -1
  14. package/dist/platformL510EAccessory.js +40 -26
  15. package/dist/platformL510EAccessory.js.map +1 -1
  16. package/dist/platformL520EAccessory.d.ts +54 -0
  17. package/dist/platformL520EAccessory.d.ts.map +1 -0
  18. package/dist/platformL520EAccessory.js +264 -0
  19. package/dist/platformL520EAccessory.js.map +1 -0
  20. package/dist/platformL530Accessory.d.ts +6 -0
  21. package/dist/platformL530Accessory.d.ts.map +1 -1
  22. package/dist/platformL530Accessory.js +87 -54
  23. package/dist/platformL530Accessory.js.map +1 -1
  24. package/dist/platformP100Accessory.d.ts +1 -0
  25. package/dist/platformP100Accessory.d.ts.map +1 -1
  26. package/dist/platformP100Accessory.js +40 -26
  27. package/dist/platformP100Accessory.js.map +1 -1
  28. package/dist/platformP110Accessory.d.ts +6 -0
  29. package/dist/platformP110Accessory.d.ts.map +1 -1
  30. package/dist/platformP110Accessory.js +70 -29
  31. package/dist/platformP110Accessory.js.map +1 -1
  32. package/dist/utils/l520e.d.ts +20 -0
  33. package/dist/utils/l520e.d.ts.map +1 -0
  34. package/dist/utils/l520e.js +61 -0
  35. package/dist/utils/l520e.js.map +1 -0
  36. package/dist/utils/l530.d.ts +2 -6
  37. package/dist/utils/l530.d.ts.map +1 -1
  38. package/dist/utils/l530.js +2 -32
  39. package/dist/utils/l530.js.map +1 -1
  40. package/dist/utils/newTpLinkCipher.d.ts +19 -0
  41. package/dist/utils/newTpLinkCipher.d.ts.map +1 -0
  42. package/dist/utils/newTpLinkCipher.js +57 -0
  43. package/dist/utils/newTpLinkCipher.js.map +1 -0
  44. package/dist/utils/p100.d.ts +14 -2
  45. package/dist/utils/p100.d.ts.map +1 -1
  46. package/dist/utils/p100.js +167 -0
  47. package/dist/utils/p100.js.map +1 -1
  48. package/package.json +2 -1
package/README.md CHANGED
@@ -40,8 +40,8 @@ The available fields in the config.json file are:
40
40
  - `name`: [required] The name of each device
41
41
  - `host`: [required] The host (local IP address) of each device
42
42
  - `type`: [optional] Plug, PowerPlug, Light or Colorlight. Use Plug for P100 or P105, PowerPlug for P110, Light for L510E and Colorlight for L530. If not provided, default is Plug.
43
- - `updateInterval`: [optional] miliseconds. Set the update interval for the plugin. Determines how often the plugin will request the state from the Tapo Device.
44
- - `timeout`: [optional] miliseconds. Sets the request timeout header for the requests to the Tapo Device.
43
+ - `updateInterval`: [optional] seconds. Set the update interval for the plugin. Determines how often the plugin will request the state from the Tapo Device.
44
+ - `timeout`: [optional] seconds. Sets the request timeout header for the requests to the Tapo Device.
45
45
 
46
46
  Example:
47
47
 
@@ -55,19 +55,23 @@
55
55
  "type": "string",
56
56
  "default": "plug",
57
57
  "oneOf": [{
58
- "title": "Plug",
58
+ "title": "P100",
59
59
  "enum": ["Plug"]
60
60
  },
61
61
  {
62
- "title": "Plug (with Power monitoring)",
62
+ "title": "P110",
63
63
  "enum": ["PowerPlug"]
64
64
  },
65
65
  {
66
- "title": "Light",
66
+ "title": "L510",
67
67
  "enum": ["Light"]
68
68
  },
69
69
  {
70
- "title": "Colorlight",
70
+ "title": "L520",
71
+ "enum": ["WhiteLight"]
72
+ },
73
+ {
74
+ "title": "L530",
71
75
  "enum": ["Colorlight"]
72
76
  }
73
77
  ],
@@ -0,0 +1,3 @@
1
+ import { Characteristic, WithUUID } from 'homebridge';
2
+ export default function resetConsumption(DefaultCharacteristic: typeof Characteristic): WithUUID<new () => Characteristic>;
3
+ //# sourceMappingURL=resetConsumptionCharacteristic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resetConsumptionCharacteristic.d.ts","sourceRoot":"","sources":["../../src/custom-characteristics/resetConsumptionCharacteristic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAkB,QAAQ,EAAQ,MAAM,YAAY,CAAC;AAE3E,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,qBAAqB,EAAE,OAAO,cAAc,GAC3C,QAAQ,CAAC,UAAU,cAAc,CAAC,CAgBpC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function resetConsumption(DefaultCharacteristic) {
4
+ var _a;
5
+ return _a = class ResetConsumptionCharacteristic extends DefaultCharacteristic {
6
+ constructor() {
7
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
8
+ // @ts-ignore: unable to override class constructor parameters as its a type and not a value
9
+ super('Reset Total', ResetConsumptionCharacteristic.UUID, {
10
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
11
+ // @ts-ignore: custom unit
12
+ format: "uint32" /* UINT32 */,
13
+ unit: "seconds" /* SECONDS */,
14
+ perms: ["pr" /* PAIRED_READ */, "ev" /* NOTIFY */, "pw" /* PAIRED_WRITE */],
15
+ });
16
+ }
17
+ },
18
+ _a.UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52',
19
+ _a;
20
+ }
21
+ exports.default = resetConsumption;
22
+ //# sourceMappingURL=resetConsumptionCharacteristic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resetConsumptionCharacteristic.js","sourceRoot":"","sources":["../../src/custom-characteristics/resetConsumptionCharacteristic.ts"],"names":[],"mappings":";;AAEA,SAAwB,gBAAgB,CACtC,qBAA4C;;IAE5C,YAAO,MAAM,8BAA+B,SAAQ,qBAAqB;YAGvE;gBACE,6DAA6D;gBAC7D,4FAA4F;gBAC5F,KAAK,CAAC,aAAa,EAAE,8BAA8B,CAAC,IAAI,EAAE;oBACxD,6DAA6D;oBAC7D,0BAA0B;oBAC1B,MAAM,uBAAgB;oBACtB,IAAI,yBAAe;oBACnB,KAAK,EAAE,oEAAqD;iBAC7D,CAAC,CAAC;YACL,CAAC;SACF;QAbiB,OAAI,GAAG,sCAAuC;WAa9D;AACJ,CAAC;AAlBD,mCAkBC"}
@@ -16,8 +16,10 @@ export declare type PlugSysinfo = CommonSysinfo & {
16
16
  export declare type LightSysinfo = PlugSysinfo & {
17
17
  brightness: number;
18
18
  };
19
- export declare type ColorLightSysinfo = LightSysinfo & {
19
+ export declare type ColorTempLightSysinfo = LightSysinfo & {
20
20
  color_temp: number;
21
+ };
22
+ export declare type ColorLightSysinfo = ColorTempLightSysinfo & {
21
23
  hue: number;
22
24
  saturation: number;
23
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/homekit-device/types.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEJ,oBAAY,WAAW,GAAG,aAAa,GAAE;IACrC,IAAI,EAAE,gBAAgB,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAC,MAAM,CAAC;CACpB,CAAC;AAEJ,oBAAY,YAAY,GAAG,WAAW,GAAE;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEJ,oBAAY,iBAAiB,GAAG,YAAY,GAAE;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEJ,oBAAY,eAAe,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/homekit-device/types.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEJ,oBAAY,WAAW,GAAG,aAAa,GAAE;IACrC,IAAI,EAAE,gBAAgB,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAC,MAAM,CAAC;CACpB,CAAC;AAEJ,oBAAY,YAAY,GAAG,WAAW,GAAE;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEJ,oBAAY,qBAAqB,GAAG,YAAY,GAAE;IAC9C,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEJ,oBAAY,iBAAiB,GAAG,qBAAqB,GAAE;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEJ,oBAAY,eAAe,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":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B;IACpF,SAAgB,sBAAsB,MAAC;IAGvC,SAAgB,WAAW,EAAE,iBAAiB,EAAE,CAAM;IAEtD,SAAgB,MAAM,EAAE,UAAU,CAAC;IAE5B,qBAAqB,EAAE;QAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,UAAU,cAAc,CAAC,CAAC;KACnD,CAAC;gBAGgB,GAAG,EAAE,MAAM,EAC3B,MAAM,EAAE,cAAc,EACN,GAAG,EAAE,GAAG;IAmB1B;;;OAGG;IACH,kBAAkB,CAAC,SAAS,EAAE,iBAAiB;IAO/C;;;;OAIG;IACH,eAAe;CAsGhB"}
package/dist/platform.js CHANGED
@@ -11,6 +11,7 @@ const platformL530Accessory_1 = require("./platformL530Accessory");
11
11
  const fakegato_history_1 = __importDefault(require("fakegato-history"));
12
12
  const platformP110Accessory_1 = require("./platformP110Accessory");
13
13
  const custom_characteristics_1 = __importDefault(require("./custom-characteristics"));
14
+ const platformL520EAccessory_1 = require("./platformL520EAccessory");
14
15
  /**
15
16
  * TapoPlatform
16
17
  * This class is the main constructor for your plugin, this is where you should
@@ -81,6 +82,9 @@ class TapoPlatform {
81
82
  if (device.type && device.type.toLowerCase() === 'colorlight') {
82
83
  new platformL530Accessory_1.L530Accessory(this.log, this, existingAccessory, device.timeout ? device.timeout : 2, device.updateInterval);
83
84
  }
85
+ else if (device.type && device.type.toLowerCase() === 'whiteLight') {
86
+ new platformL520EAccessory_1.L520EAccessory(this.log, this, existingAccessory, device.timeout ? device.timeout : 2, device.updateInterval);
87
+ }
84
88
  else if (device.type && device.type.toLowerCase() === 'light') {
85
89
  new platformL510EAccessory_1.L510EAccessory(this.log, this, existingAccessory, device.timeout ? device.timeout : 2, device.updateInterval);
86
90
  }
@@ -122,6 +126,14 @@ class TapoPlatform {
122
126
  accessory.context.device = device;
123
127
  new platformL510EAccessory_1.L510EAccessory(this.log, this, accessory, device.timeout ? device.timeout : 2, device.updateInterval);
124
128
  }
129
+ else if (device.type && device.type.toLowerCase() === 'whiteLight') {
130
+ // create a new accessory
131
+ accessory = new this.api.platformAccessory(device.name ? device.name : device.host, uuid, 5 /* LIGHTBULB */);
132
+ // store a copy of the device object in the `accessory.context`
133
+ // the `context` property can be used to store any data about the accessory you may need
134
+ accessory.context.device = device;
135
+ new platformL520EAccessory_1.L520EAccessory(this.log, this, accessory, device.timeout ? device.timeout : 2, device.updateInterval);
136
+ }
125
137
  else if (device.type && device.type.toLowerCase() === 'powerplug') {
126
138
  // create a new accessory
127
139
  accessory = new this.api.platformAccessory(device.name ? device.name : device.host, uuid, 7 /* OUTLET */);
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";;;;;AAYA,yCAAwD;AACxD,mEAAwD;AACxD,qCAAmD;AACnD,qEAA0D;AAC1D,mEAAwD;AACxD,wEAAwC;AACxC,mEAAwD;AACxD,sFAAuD;AAEvD;;;;GAIG;AACH,MAAqB,YAAY;IAc/B,YACkB,GAAW,EAC3B,MAAsB,EACN,GAAQ;QAFR,QAAG,GAAH,GAAG,CAAQ;QAEX,QAAG,GAAH,GAAG,CAAK;QAhBV,YAAO,GAAmB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QAC/C,mBAAc,GAA0B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;QAGpF,oDAAoD;QACpC,gBAAW,GAAwB,EAAE,CAAC;QAapD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,oBAAW,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iCAAiC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC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G,+DAA+D;wBAC/D,wFAAwF;wBACxF,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;wBAClC,IAAI,qCAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;qBAC1G;oBAED,sCAAsC;oBACtC,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,sBAAW,EAAE,wBAAa,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;iBAC/E;aACF;SACF;IACH,CAAC;CACF;AA1JD,+BA0JC"}
@@ -14,6 +14,7 @@ export declare class L510EAccessory {
14
14
  private service;
15
15
  private l510e;
16
16
  constructor(log: Logger, platform: TapoPlatform, accessory: PlatformAccessory, timeout: number, updateInterval?: number | undefined);
17
+ private init;
17
18
  /**
18
19
  * Handle "SET" requests from HomeKit
19
20
  * These are sent when the user changes the state of an accessory.
@@ -1 +1 @@
1
- {"version":3,"file":"platformL510EAccessory.d.ts","sourceRoot":"","sources":["../src/platformL510EAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,iBAAiB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC3I,OAAO,YAAY,MAAM,YAAY,CAAC;AAGtC;;;;GAIG;AACH,qBAAa,cAAc;aAMP,GAAG,EAAE,MAAM;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IATlC,OAAO,CAAC,OAAO,CAAU;IAEzB,OAAO,CAAC,KAAK,CAAQ;gBAGH,GAAG,EAAE,MAAM,EACV,QAAQ,EAAE,YAAY,EACtB,SA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C,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,yBAAyB;IAkB7E;;;;OAIG;IACH,aAAa,CAAC,QAAQ,EAAE,yBAAyB;IAwBjD,OAAO,CAAC,WAAW;IAkCnB,OAAO,CAAC,aAAa;CAItB"}
@@ -20,35 +20,23 @@ class L510EAccessory {
20
20
  this.log.debug('Start adding accessory: ' + accessory.context.device.host);
21
21
  this.l510e = new l510e_1.default(this.log, accessory.context.device.host, platform.config.username, platform.config.password, this.timeout);
22
22
  this.l510e.handshake().then(() => {
23
- this.l510e.login().then(() => {
24
- this.l510e.getDeviceInfo().then((sysInfo) => {
25
- // set accessory information
26
- this.accessory.getService(this.platform.Service.AccessoryInformation)
27
- .setCharacteristic(this.platform.Characteristic.Manufacturer, 'TP-Link')
28
- .setCharacteristic(this.platform.Characteristic.Model, 'Tapo L510E')
29
- .setCharacteristic(this.platform.Characteristic.SerialNumber, sysInfo.hw_id);
30
- // each service must implement at-minimum the "required characteristics" for the given service type
31
- // see https://developers.homebridge.io/#/service/Outlet
32
- // register handlers for the On/Off Characteristic
33
- this.service.getCharacteristic(this.platform.Characteristic.On)
34
- .on('set', this.setOn.bind(this)) // SET - bind to the `setOn` method below
35
- .on('get', this.getOn.bind(this)); // GET - bind to the `getOn` method below
36
- // register handlers for the Brightness Characteristic
37
- this.service.getCharacteristic(this.platform.Characteristic.Brightness)
38
- .on('set', this.setBrightness.bind(this)) // SET - bind to the `setBrightness` method below
39
- .on('get', this.getBrightness.bind(this)); // GET - bind to the `getBrightness` method below
40
- const interval = updateInterval ? updateInterval * 1000 : 30000;
41
- setTimeout(() => {
42
- this.updateState(interval);
43
- }, interval);
23
+ if (this.l510e.is_klap) {
24
+ this.l510e.handshake_new().then(() => {
25
+ this.init(platform, updateInterval);
44
26
  }).catch(() => {
45
27
  this.setNoResponse();
46
- this.log.error('Get Device Info failed');
28
+ this.log.error('KLAP Handshake failed');
29
+ this.l510e.is_klap = false;
47
30
  });
48
- }).catch(() => {
49
- this.setNoResponse();
50
- this.log.error('Login failed');
51
- });
31
+ }
32
+ else {
33
+ this.l510e.login().then(() => {
34
+ this.init(platform, updateInterval);
35
+ }).catch(() => {
36
+ this.setNoResponse();
37
+ this.log.error('Login failed');
38
+ });
39
+ }
52
40
  }).catch(() => {
53
41
  this.setNoResponse();
54
42
  this.log.error('Handshake failed');
@@ -59,6 +47,32 @@ class L510EAccessory {
59
47
  // we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
60
48
  this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.context.device.name);
61
49
  }
50
+ init(platform, updateInterval) {
51
+ this.l510e.getDeviceInfo().then((sysInfo) => {
52
+ // set accessory information
53
+ this.accessory.getService(this.platform.Service.AccessoryInformation)
54
+ .setCharacteristic(this.platform.Characteristic.Manufacturer, 'TP-Link')
55
+ .setCharacteristic(this.platform.Characteristic.Model, 'Tapo L510E')
56
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, sysInfo.hw_id);
57
+ // each service must implement at-minimum the "required characteristics" for the given service type
58
+ // see https://developers.homebridge.io/#/service/Outlet
59
+ // register handlers for the On/Off Characteristic
60
+ this.service.getCharacteristic(this.platform.Characteristic.On)
61
+ .on('set', this.setOn.bind(this)) // SET - bind to the `setOn` method below
62
+ .on('get', this.getOn.bind(this)); // GET - bind to the `getOn` method below
63
+ // register handlers for the Brightness Characteristic
64
+ this.service.getCharacteristic(this.platform.Characteristic.Brightness)
65
+ .on('set', this.setBrightness.bind(this)) // SET - bind to the `setBrightness` method below
66
+ .on('get', this.getBrightness.bind(this)); // GET - bind to the `getBrightness` method below
67
+ const interval = updateInterval ? updateInterval * 1000 : 30000;
68
+ setTimeout(() => {
69
+ this.updateState(interval);
70
+ }, interval);
71
+ }).catch(() => {
72
+ this.setNoResponse();
73
+ this.log.error('Get Device Info failed');
74
+ });
75
+ }
62
76
  /**
63
77
  * Handle "SET" requests from HomeKit
64
78
  * These are sent when the user changes the state of an accessory.
@@ -1 +1 @@
1
- {"version":3,"file":"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;QAEH,UAAU,CAAC,GAAE,EAAE;YACb,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,EAAE,QAAQ,CAAC,CAAC;IACf,CAAC;IAEO,aAAa;QACnB,YAAY;QACZ,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/F,CAAC;CACF;AApND,wCAoNC"}
@@ -0,0 +1,54 @@
1
+ import { PlatformAccessory, CharacteristicValue, CharacteristicSetCallback, CharacteristicGetCallback, Logger } from 'homebridge';
2
+ import TapoPlatform from './platform';
3
+ /**
4
+ * L510E Accessory
5
+ * An instance of this class is created for each accessory your platform registers
6
+ * Each accessory may expose multiple services of different service types.
7
+ */
8
+ export declare class L520EAccessory {
9
+ readonly log: Logger;
10
+ private readonly platform;
11
+ private readonly accessory;
12
+ private readonly timeout;
13
+ private readonly updateInterval?;
14
+ private service;
15
+ private l520e;
16
+ constructor(log: Logger, platform: TapoPlatform, accessory: PlatformAccessory, timeout: number, updateInterval?: number | undefined);
17
+ private init;
18
+ /**
19
+ * Handle "SET" requests from HomeKit
20
+ * These are sent when the user changes the state of an accessory.
21
+ */
22
+ setOn(value: CharacteristicValue, callback: CharacteristicSetCallback): void;
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
+ getOn(callback: CharacteristicGetCallback): void;
29
+ /**
30
+ * Handle "SET" requests from HomeKit
31
+ * These are sent when the user changes the state of an accessory.
32
+ */
33
+ setBrightness(value: CharacteristicValue, callback: CharacteristicSetCallback): void;
34
+ /**
35
+ * Handle the "GET" requests from HomeKit
36
+ * These are sent when HomeKit wants to know the current state of the accessory.
37
+ *
38
+ */
39
+ getBrightness(callback: CharacteristicGetCallback): void;
40
+ private updateState;
41
+ /**
42
+ * Handle "SET" requests from HomeKit
43
+ * These are sent when the user changes the state of an accessory.
44
+ */
45
+ setColorTemp(value: CharacteristicValue, callback: CharacteristicSetCallback): void;
46
+ /**
47
+ * Handle the "GET" requests from HomeKit
48
+ * These are sent when HomeKit wants to know the current state of the accessory.
49
+ *
50
+ */
51
+ getColorTemp(callback: CharacteristicGetCallback): void;
52
+ private setNoResponse;
53
+ }
54
+ //# sourceMappingURL=platformL520EAccessory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformL520EAccessory.d.ts","sourceRoot":"","sources":["../src/platformL520EAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,iBAAiB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC3I,OAAO,YAAY,MAAM,YAAY,CAAC;AAGtC;;;;GAIG;AACH,qBAAa,cAAc;aAMP,GAAG,EAAE,MAAM;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IATlC,OAAO,CAAC,OAAO,CAAU;IAEzB,OAAO,CAAC,KAAK,CAAQ;gBAGH,GAAG,EAAE,MAAM,EACV,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,oBAAQ;IAmC1C,OAAO,CAAC,IAAI;IA0CZ;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,yBAAyB;IAarE;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,yBAAyB;IAyBzC;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,yBAAyB;IAkB7E;;;;OAIG;IACH,aAAa,CAAC,QAAQ,EAAE,yBAAyB;IAwBjD,OAAO,CAAC,WAAW;IAkCnB;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,yBAAyB;IAoB5E;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,yBAAyB;IAoBhD,OAAO,CAAC,aAAa;CAItB"}
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.L520EAccessory = void 0;
7
+ const l520e_1 = __importDefault(require("./utils/l520e"));
8
+ /**
9
+ * L510E Accessory
10
+ * An instance of this class is created for each accessory your platform registers
11
+ * Each accessory may expose multiple services of different service types.
12
+ */
13
+ class L520EAccessory {
14
+ constructor(log, platform, accessory, timeout, updateInterval) {
15
+ this.log = log;
16
+ this.platform = platform;
17
+ this.accessory = accessory;
18
+ this.timeout = timeout;
19
+ this.updateInterval = updateInterval;
20
+ this.log.debug('Start adding accessory: ' + accessory.context.device.host);
21
+ this.l520e = new l520e_1.default(this.log, accessory.context.device.host, platform.config.username, platform.config.password, this.timeout);
22
+ this.l520e.handshake().then(() => {
23
+ if (this.l520e.is_klap) {
24
+ this.l520e.handshake_new().then(() => {
25
+ this.init(platform, updateInterval);
26
+ }).catch(() => {
27
+ this.setNoResponse();
28
+ this.log.error('KLAP Handshake failed');
29
+ this.l520e.is_klap = false;
30
+ });
31
+ }
32
+ else {
33
+ this.l520e.login().then(() => {
34
+ this.init(platform, updateInterval);
35
+ }).catch(() => {
36
+ this.setNoResponse();
37
+ this.log.error('Login failed');
38
+ });
39
+ }
40
+ }).catch(() => {
41
+ this.setNoResponse();
42
+ this.log.error('Handshake failed');
43
+ });
44
+ // get the Outlet service if it exists, otherwise create a new Outlet service
45
+ this.service = this.accessory.getService(this.platform.Service.Lightbulb) || this.accessory.addService(this.platform.Service.Lightbulb);
46
+ // set the service name, this is what is displayed as the default name on the Home app
47
+ // we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
48
+ this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.context.device.name);
49
+ }
50
+ init(platform, updateInterval) {
51
+ this.l520e.getDeviceInfo().then((sysInfo) => {
52
+ // set accessory information
53
+ this.accessory.getService(this.platform.Service.AccessoryInformation)
54
+ .setCharacteristic(this.platform.Characteristic.Manufacturer, 'TP-Link')
55
+ .setCharacteristic(this.platform.Characteristic.Model, 'Tapo L520E')
56
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, sysInfo.hw_id);
57
+ // each service must implement at-minimum the "required characteristics" for the given service type
58
+ // see https://developers.homebridge.io/#/service/Outlet
59
+ // register handlers for the On/Off Characteristic
60
+ this.service.getCharacteristic(this.platform.Characteristic.On)
61
+ .on('set', this.setOn.bind(this)) // SET - bind to the `setOn` method below
62
+ .on('get', this.getOn.bind(this)); // GET - bind to the `getOn` method below
63
+ // register handlers for the Brightness Characteristic
64
+ this.service.getCharacteristic(this.platform.Characteristic.Brightness)
65
+ .on('set', this.setBrightness.bind(this)) // SET - bind to the `setBrightness` method below
66
+ .on('get', this.getBrightness.bind(this)); // GET - bind to the `getBrightness` method below
67
+ // register handlers for the ColorTemperature Characteristic
68
+ this.service.getCharacteristic(this.platform.Characteristic.ColorTemperature)
69
+ .on('set', this.setColorTemp.bind(this)) // SET - bind to the `setColorTemp` method below
70
+ .on('get', this.getColorTemp.bind(this))
71
+ .setProps({
72
+ minValue: 154,
73
+ maxValue: 400,
74
+ minStep: 1,
75
+ }); // GET - bind to the `getColorTemp` method below
76
+ const interval = updateInterval ? updateInterval * 1000 : 30000;
77
+ setTimeout(() => {
78
+ this.updateState(interval);
79
+ }, interval);
80
+ }).catch(() => {
81
+ this.setNoResponse();
82
+ this.log.error('Get Device Info failed');
83
+ });
84
+ }
85
+ /**
86
+ * Handle "SET" requests from HomeKit
87
+ * These are sent when the user changes the state of an accessory.
88
+ */
89
+ setOn(value, callback) {
90
+ this.l520e.setPowerState(value).then((result) => {
91
+ if (result) {
92
+ this.platform.log.debug('Set Characteristic On ->', value);
93
+ this.l520e.getSysInfo().device_on = value;
94
+ // you must call the callback function
95
+ callback(null);
96
+ }
97
+ else {
98
+ callback(new Error('unreachable'), false);
99
+ }
100
+ });
101
+ }
102
+ /**
103
+ * Handle the "GET" requests from HomeKit
104
+ * These are sent when HomeKit wants to know the current state of the accessory.
105
+ *
106
+ */
107
+ getOn(callback) {
108
+ // implement your own code to check if the device is on
109
+ this.l520e.getDeviceInfo().then((response) => {
110
+ if (response) {
111
+ const isOn = response.device_on;
112
+ this.platform.log.debug('Get Characteristic On ->', isOn);
113
+ // you must call the callback function
114
+ // the first argument should be null if there were no errors
115
+ // the second argument should be the value to return
116
+ // you must call the callback function
117
+ if (isOn !== undefined) {
118
+ callback(null, isOn);
119
+ }
120
+ else {
121
+ callback(new Error('unreachable'), isOn);
122
+ }
123
+ }
124
+ else {
125
+ callback(new Error('unreachable'), false);
126
+ }
127
+ }).catch(() => {
128
+ callback(new Error('unreachable'), false);
129
+ });
130
+ }
131
+ /**
132
+ * Handle "SET" requests from HomeKit
133
+ * These are sent when the user changes the state of an accessory.
134
+ */
135
+ setBrightness(value, callback) {
136
+ if (this.l520e.getSysInfo().device_on) {
137
+ this.l520e.setBrightness(value).then((result) => {
138
+ if (result) {
139
+ this.platform.log.debug('Set Characteristic Brightness ->', value);
140
+ this.l520e.getSysInfo().brightness = value;
141
+ // you must call the callback function
142
+ callback(null);
143
+ }
144
+ else {
145
+ callback(new Error('unreachable'), false);
146
+ }
147
+ });
148
+ }
149
+ else {
150
+ callback(null);
151
+ }
152
+ }
153
+ /**
154
+ * Handle the "GET" requests from HomeKit
155
+ * These are sent when HomeKit wants to know the current state of the accessory.
156
+ *
157
+ */
158
+ getBrightness(callback) {
159
+ this.l520e.getDeviceInfo().then((response) => {
160
+ if (response) {
161
+ const brightness = response.brightness;
162
+ if (brightness !== undefined) {
163
+ this.platform.log.debug('Get Characteristic Brightness ->', brightness);
164
+ // you must call the callback function
165
+ // the first argument should be null if there were no errors
166
+ // the second argument should be the value to return
167
+ // you must call the callback function
168
+ callback(null, brightness);
169
+ }
170
+ else {
171
+ callback(new Error('unreachable'), 0);
172
+ }
173
+ }
174
+ else {
175
+ callback(new Error('unreachable'), 0);
176
+ }
177
+ }).catch(() => {
178
+ callback(new Error('unreachable'), 0);
179
+ });
180
+ }
181
+ updateState(interval) {
182
+ this.l520e.getDeviceInfo().then((response) => {
183
+ if (response) {
184
+ const isOn = response.device_on;
185
+ const brightness = response.brightness;
186
+ this.platform.log.debug('Get Characteristic On ->', isOn);
187
+ if (isOn !== undefined) {
188
+ this.service.updateCharacteristic(this.platform.Characteristic.On, isOn);
189
+ }
190
+ else {
191
+ this.setNoResponse();
192
+ interval += 300000;
193
+ }
194
+ if (brightness) {
195
+ this.service.updateCharacteristic(this.platform.Characteristic.Brightness, brightness);
196
+ }
197
+ }
198
+ setTimeout(() => {
199
+ this.updateState(interval + 300000);
200
+ }, interval);
201
+ }).catch(() => {
202
+ this.setNoResponse();
203
+ setTimeout(() => {
204
+ this.updateState(interval + 300000);
205
+ }, interval);
206
+ });
207
+ setTimeout(() => {
208
+ this.updateState(interval);
209
+ }, interval);
210
+ }
211
+ /**
212
+ * Handle "SET" requests from HomeKit
213
+ * These are sent when the user changes the state of an accessory.
214
+ */
215
+ setColorTemp(value, callback) {
216
+ this.log.debug('Color Temp Homekit :' + value);
217
+ if (this.l520e.getSysInfo().device_on) {
218
+ this.l520e.setColorTemp(value).then((result) => {
219
+ if (result) {
220
+ this.l520e.getSysInfo().color_temp = value;
221
+ this.platform.log.debug('Set Characteristic Color Temperature ->', value);
222
+ // you must call the callback function
223
+ callback(null);
224
+ }
225
+ else {
226
+ callback(new Error('unreachable'), false);
227
+ }
228
+ });
229
+ }
230
+ else {
231
+ // you must call the callback function
232
+ callback(null);
233
+ }
234
+ }
235
+ /**
236
+ * Handle the "GET" requests from HomeKit
237
+ * These are sent when HomeKit wants to know the current state of the accessory.
238
+ *
239
+ */
240
+ getColorTemp(callback) {
241
+ this.l520e.getColorTemp().then((response) => {
242
+ if (response !== undefined) {
243
+ const color_temp = response;
244
+ this.platform.log.debug('Get Characteristic Color Temperature ->', color_temp);
245
+ // you must call the callback function
246
+ // the first argument should be null if there were no errors
247
+ // the second argument should be the value to return
248
+ // you must call the callback function
249
+ callback(null, color_temp);
250
+ }
251
+ else {
252
+ callback(new Error('unreachable'), 0);
253
+ }
254
+ }).catch(() => {
255
+ callback(new Error('unreachable'), 0);
256
+ });
257
+ }
258
+ setNoResponse() {
259
+ //@ts-ignore
260
+ this.service.updateCharacteristic(this.platform.Characteristic.On, new Error('unreachable'));
261
+ }
262
+ }
263
+ exports.L520EAccessory = L520EAccessory;
264
+ //# sourceMappingURL=platformL520EAccessory.js.map