@fredsocial/homebridge-tplink-tapo 0.1.0

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 (176) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -0
  3. package/config.schema.json +347 -0
  4. package/lib/accessory-information.d.ts +4 -0
  5. package/lib/accessory-information.d.ts.map +1 -0
  6. package/lib/accessory-information.js +26 -0
  7. package/lib/accessory-information.js.map +1 -0
  8. package/lib/characteristics/amperes.d.ts +4 -0
  9. package/lib/characteristics/amperes.d.ts.map +1 -0
  10. package/lib/characteristics/amperes.js +15 -0
  11. package/lib/characteristics/amperes.js.map +1 -0
  12. package/lib/characteristics/default-characteristic.d.ts +3 -0
  13. package/lib/characteristics/default-characteristic.d.ts.map +1 -0
  14. package/lib/characteristics/default-characteristic.js +19 -0
  15. package/lib/characteristics/default-characteristic.js.map +1 -0
  16. package/lib/characteristics/index.d.ts +3 -0
  17. package/lib/characteristics/index.d.ts.map +1 -0
  18. package/lib/characteristics/index.js +25 -0
  19. package/lib/characteristics/index.js.map +1 -0
  20. package/lib/characteristics/kilowatt-hours.d.ts +4 -0
  21. package/lib/characteristics/kilowatt-hours.d.ts.map +1 -0
  22. package/lib/characteristics/kilowatt-hours.js +15 -0
  23. package/lib/characteristics/kilowatt-hours.js.map +1 -0
  24. package/lib/characteristics/kilowatt-volt-ampere-hour.d.ts +4 -0
  25. package/lib/characteristics/kilowatt-volt-ampere-hour.d.ts.map +1 -0
  26. package/lib/characteristics/kilowatt-volt-ampere-hour.js +16 -0
  27. package/lib/characteristics/kilowatt-volt-ampere-hour.js.map +1 -0
  28. package/lib/characteristics/types.d.ts +7 -0
  29. package/lib/characteristics/types.d.ts.map +1 -0
  30. package/lib/characteristics/types.js +4 -0
  31. package/lib/characteristics/types.js.map +1 -0
  32. package/lib/characteristics/volt-amperes.d.ts +4 -0
  33. package/lib/characteristics/volt-amperes.d.ts.map +1 -0
  34. package/lib/characteristics/volt-amperes.js +15 -0
  35. package/lib/characteristics/volt-amperes.js.map +1 -0
  36. package/lib/characteristics/volts.d.ts +4 -0
  37. package/lib/characteristics/volts.d.ts.map +1 -0
  38. package/lib/characteristics/volts.js +15 -0
  39. package/lib/characteristics/volts.js.map +1 -0
  40. package/lib/characteristics/watts.d.ts +4 -0
  41. package/lib/characteristics/watts.d.ts.map +1 -0
  42. package/lib/characteristics/watts.js +15 -0
  43. package/lib/characteristics/watts.js.map +1 -0
  44. package/lib/config.d.ts +180 -0
  45. package/lib/config.d.ts.map +1 -0
  46. package/lib/config.js +167 -0
  47. package/lib/config.js.map +1 -0
  48. package/lib/homekit-device/bulb.d.ts +41 -0
  49. package/lib/homekit-device/bulb.d.ts.map +1 -0
  50. package/lib/homekit-device/bulb.js +307 -0
  51. package/lib/homekit-device/bulb.js.map +1 -0
  52. package/lib/homekit-device/create.d.ts +11 -0
  53. package/lib/homekit-device/create.d.ts.map +1 -0
  54. package/lib/homekit-device/create.js +18 -0
  55. package/lib/homekit-device/create.js.map +1 -0
  56. package/lib/homekit-device/index.d.ts +33 -0
  57. package/lib/homekit-device/index.d.ts.map +1 -0
  58. package/lib/homekit-device/index.js +120 -0
  59. package/lib/homekit-device/index.js.map +1 -0
  60. package/lib/homekit-device/plug.d.ts +43 -0
  61. package/lib/homekit-device/plug.d.ts.map +1 -0
  62. package/lib/homekit-device/plug.js +244 -0
  63. package/lib/homekit-device/plug.js.map +1 -0
  64. package/lib/index.d.ts +4 -0
  65. package/lib/index.d.ts.map +1 -0
  66. package/lib/index.js +10 -0
  67. package/lib/index.js.map +1 -0
  68. package/lib/platform.d.ts +59 -0
  69. package/lib/platform.d.ts.map +1 -0
  70. package/lib/platform.js +301 -0
  71. package/lib/platform.js.map +1 -0
  72. package/lib/settings.d.ts +3 -0
  73. package/lib/settings.d.ts.map +1 -0
  74. package/lib/settings.js +6 -0
  75. package/lib/settings.js.map +1 -0
  76. package/lib/tapo/custom-characteristics/currentConsumptionCharacteristic.d.ts +3 -0
  77. package/lib/tapo/custom-characteristics/currentConsumptionCharacteristic.d.ts.map +1 -0
  78. package/lib/tapo/custom-characteristics/currentConsumptionCharacteristic.js +21 -0
  79. package/lib/tapo/custom-characteristics/currentConsumptionCharacteristic.js.map +1 -0
  80. package/lib/tapo/custom-characteristics/default-characteristic.d.ts +3 -0
  81. package/lib/tapo/custom-characteristics/default-characteristic.d.ts.map +1 -0
  82. package/lib/tapo/custom-characteristics/default-characteristic.js +19 -0
  83. package/lib/tapo/custom-characteristics/default-characteristic.js.map +1 -0
  84. package/lib/tapo/custom-characteristics/index.d.ts +3 -0
  85. package/lib/tapo/custom-characteristics/index.d.ts.map +1 -0
  86. package/lib/tapo/custom-characteristics/index.js +17 -0
  87. package/lib/tapo/custom-characteristics/index.js.map +1 -0
  88. package/lib/tapo/custom-characteristics/resetConsumptionCharacteristic.d.ts +3 -0
  89. package/lib/tapo/custom-characteristics/resetConsumptionCharacteristic.d.ts.map +1 -0
  90. package/lib/tapo/custom-characteristics/resetConsumptionCharacteristic.js +20 -0
  91. package/lib/tapo/custom-characteristics/resetConsumptionCharacteristic.js.map +1 -0
  92. package/lib/tapo/custom-characteristics/totalConsumptionCharacteristic.d.ts +3 -0
  93. package/lib/tapo/custom-characteristics/totalConsumptionCharacteristic.d.ts.map +1 -0
  94. package/lib/tapo/custom-characteristics/totalConsumptionCharacteristic.js +21 -0
  95. package/lib/tapo/custom-characteristics/totalConsumptionCharacteristic.js.map +1 -0
  96. package/lib/tapo/homekit-device/types.d.ts +30 -0
  97. package/lib/tapo/homekit-device/types.d.ts.map +1 -0
  98. package/lib/tapo/homekit-device/types.js +3 -0
  99. package/lib/tapo/homekit-device/types.js.map +1 -0
  100. package/lib/tapo/platform.d.ts +14 -0
  101. package/lib/tapo/platform.d.ts.map +1 -0
  102. package/lib/tapo/platform.js +3 -0
  103. package/lib/tapo/platform.js.map +1 -0
  104. package/lib/tapo/platformL510EAccessory.d.ts +31 -0
  105. package/lib/tapo/platformL510EAccessory.d.ts.map +1 -0
  106. package/lib/tapo/platformL510EAccessory.js +146 -0
  107. package/lib/tapo/platformL510EAccessory.js.map +1 -0
  108. package/lib/tapo/platformL520EAccessory.d.ts +42 -0
  109. package/lib/tapo/platformL520EAccessory.d.ts.map +1 -0
  110. package/lib/tapo/platformL520EAccessory.js +205 -0
  111. package/lib/tapo/platformL520EAccessory.js.map +1 -0
  112. package/lib/tapo/platformL530Accessory.d.ts +84 -0
  113. package/lib/tapo/platformL530Accessory.d.ts.map +1 -0
  114. package/lib/tapo/platformL530Accessory.js +439 -0
  115. package/lib/tapo/platformL530Accessory.js.map +1 -0
  116. package/lib/tapo/platformP100Accessory.d.ts +23 -0
  117. package/lib/tapo/platformP100Accessory.d.ts.map +1 -0
  118. package/lib/tapo/platformP100Accessory.js +72 -0
  119. package/lib/tapo/platformP100Accessory.js.map +1 -0
  120. package/lib/tapo/platformP110Accessory.d.ts +39 -0
  121. package/lib/tapo/platformP110Accessory.d.ts.map +1 -0
  122. package/lib/tapo/platformP110Accessory.js +146 -0
  123. package/lib/tapo/platformP110Accessory.js.map +1 -0
  124. package/lib/tapo/platformTPLinkAccessory.d.ts +29 -0
  125. package/lib/tapo/platformTPLinkAccessory.d.ts.map +1 -0
  126. package/lib/tapo/platformTPLinkAccessory.js +132 -0
  127. package/lib/tapo/platformTPLinkAccessory.js.map +1 -0
  128. package/lib/tapo/utils/energyUsage.d.ts +4 -0
  129. package/lib/tapo/utils/energyUsage.d.ts.map +1 -0
  130. package/lib/tapo/utils/energyUsage.js +8 -0
  131. package/lib/tapo/utils/energyUsage.js.map +1 -0
  132. package/lib/tapo/utils/l510e.d.ts +17 -0
  133. package/lib/tapo/utils/l510e.d.ts.map +1 -0
  134. package/lib/tapo/utils/l510e.js +47 -0
  135. package/lib/tapo/utils/l510e.js.map +1 -0
  136. package/lib/tapo/utils/l520e.d.ts +20 -0
  137. package/lib/tapo/utils/l520e.d.ts.map +1 -0
  138. package/lib/tapo/utils/l520e.js +65 -0
  139. package/lib/tapo/utils/l520e.js.map +1 -0
  140. package/lib/tapo/utils/l530.d.ts +22 -0
  141. package/lib/tapo/utils/l530.d.ts.map +1 -0
  142. package/lib/tapo/utils/l530.js +135 -0
  143. package/lib/tapo/utils/l530.js.map +1 -0
  144. package/lib/tapo/utils/newTpLinkCipher.d.ts +22 -0
  145. package/lib/tapo/utils/newTpLinkCipher.d.ts.map +1 -0
  146. package/lib/tapo/utils/newTpLinkCipher.js +88 -0
  147. package/lib/tapo/utils/newTpLinkCipher.js.map +1 -0
  148. package/lib/tapo/utils/p100.d.ts +117 -0
  149. package/lib/tapo/utils/p100.d.ts.map +1 -0
  150. package/lib/tapo/utils/p100.js +665 -0
  151. package/lib/tapo/utils/p100.js.map +1 -0
  152. package/lib/tapo/utils/p110.d.ts +16 -0
  153. package/lib/tapo/utils/p110.d.ts.map +1 -0
  154. package/lib/tapo/utils/p110.js +68 -0
  155. package/lib/tapo/utils/p110.js.map +1 -0
  156. package/lib/tapo/utils/powerUsage.d.ts +7 -0
  157. package/lib/tapo/utils/powerUsage.d.ts.map +1 -0
  158. package/lib/tapo/utils/powerUsage.js +10 -0
  159. package/lib/tapo/utils/powerUsage.js.map +1 -0
  160. package/lib/tapo/utils/tpLinkCipher.d.ts +12 -0
  161. package/lib/tapo/utils/tpLinkCipher.d.ts.map +1 -0
  162. package/lib/tapo/utils/tpLinkCipher.js +35 -0
  163. package/lib/tapo/utils/tpLinkCipher.js.map +1 -0
  164. package/lib/tapo/utils/tplinkAccessory.d.ts +22 -0
  165. package/lib/tapo/utils/tplinkAccessory.d.ts.map +1 -0
  166. package/lib/tapo/utils/tplinkAccessory.js +3 -0
  167. package/lib/tapo/utils/tplinkAccessory.js.map +1 -0
  168. package/lib/tapo/utils/usage.d.ts +6 -0
  169. package/lib/tapo/utils/usage.d.ts.map +1 -0
  170. package/lib/tapo/utils/usage.js +10 -0
  171. package/lib/tapo/utils/usage.js.map +1 -0
  172. package/lib/utils.d.ts +29 -0
  173. package/lib/utils.d.ts.map +1 -0
  174. package/lib/utils.js +129 -0
  175. package/lib/utils.js.map +1 -0
  176. package/package.json +116 -0
@@ -0,0 +1,205 @@
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
+ const platformTPLinkAccessory_1 = require("./platformTPLinkAccessory");
9
+ /**
10
+ * L510E Accessory
11
+ * An instance of this class is created for each accessory your platform registers
12
+ * Each accessory may expose multiple services of different service types.
13
+ */
14
+ class L520EAccessory extends platformTPLinkAccessory_1.TPLinkPlatformAccessory {
15
+ log;
16
+ platform;
17
+ accessory;
18
+ timeout;
19
+ updateInterval;
20
+ constructor(log, platform, accessory, timeout, updateInterval) {
21
+ super(log, platform, accessory, timeout, updateInterval);
22
+ this.log = log;
23
+ this.platform = platform;
24
+ this.accessory = accessory;
25
+ this.timeout = timeout;
26
+ this.updateInterval = updateInterval;
27
+ this.tpLinkAccessory = new l520e_1.default(this.log, accessory.context.device.host, platform.config.username, platform.config.password, this.timeout);
28
+ this.initialise(platform, updateInterval);
29
+ // get the Outlet service if it exists, otherwise create a new Outlet service
30
+ this.service = this.accessory.getService(this.platform.Service.Lightbulb) || this.accessory.addService(this.platform.Service.Lightbulb);
31
+ // set the service name, this is what is displayed as the default name on the Home app
32
+ // we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
33
+ this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.context.device.name);
34
+ }
35
+ init(platform, updateInterval) {
36
+ this.tpLinkAccessory.getDeviceInfo(true).then((sysInfo) => {
37
+ // set accessory information
38
+ this.accessory.getService(this.platform.Service.AccessoryInformation)
39
+ .setCharacteristic(this.platform.Characteristic.Manufacturer, 'TP-Link')
40
+ .setCharacteristic(this.platform.Characteristic.Model, 'Tapo L520E')
41
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, sysInfo.hw_id);
42
+ // each service must implement at-minimum the "required characteristics" for the given service type
43
+ // see https://developers.homebridge.io/#/service/Outlet
44
+ // register handlers for the On/Off Characteristic
45
+ this.service.getCharacteristic(this.platform.Characteristic.On)
46
+ .on('set', this.setOn.bind(this)) // SET - bind to the `setOn` method below
47
+ .on('get', this.getOn.bind(this)); // GET - bind to the `getOn` method below
48
+ // register handlers for the Brightness Characteristic
49
+ this.service.getCharacteristic(this.platform.Characteristic.Brightness)
50
+ .on('set', this.setBrightness.bind(this)) // SET - bind to the `setBrightness` method below
51
+ .on('get', this.getBrightness.bind(this)); // GET - bind to the `getBrightness` method below
52
+ // register handlers for the ColorTemperature Characteristic
53
+ this.service.getCharacteristic(this.platform.Characteristic.ColorTemperature)
54
+ .on('set', this.setColorTemp.bind(this)) // SET - bind to the `setColorTemp` method below
55
+ .on('get', this.getColorTemp.bind(this))
56
+ .setProps({
57
+ minValue: 154,
58
+ maxValue: 400,
59
+ minStep: 1,
60
+ }); // GET - bind to the `getColorTemp` method below
61
+ const interval = updateInterval ? updateInterval * 1000 : 10000;
62
+ setTimeout(() => {
63
+ this.updateState(interval);
64
+ }, interval);
65
+ }).catch(() => {
66
+ this.setNoResponse();
67
+ this.log.error('Get Device Info failed');
68
+ });
69
+ }
70
+ /**
71
+ * Handle "SET" requests from HomeKit
72
+ * These are sent when the user changes the state of an accessory.
73
+ */
74
+ setBrightness(value, callback) {
75
+ if (this.tpLinkAccessory.getSysInfo().device_on) {
76
+ this.tpLinkAccessory.setBrightness(value).then((result) => {
77
+ if (result) {
78
+ this.platform.log.debug('Set Characteristic Brightness ->', value);
79
+ this.tpLinkAccessory.getSysInfo().brightness = value;
80
+ // you must call the callback function
81
+ callback(null);
82
+ }
83
+ else {
84
+ callback(new Error('unreachable'), false);
85
+ }
86
+ }).catch((error) => {
87
+ this.log.error('Failed to set brightness: ' + error);
88
+ callback(new Error('unreachable'), false);
89
+ });
90
+ }
91
+ else {
92
+ callback(null);
93
+ }
94
+ }
95
+ /**
96
+ * Handle the "GET" requests from HomeKit
97
+ * These are sent when HomeKit wants to know the current state of the accessory.
98
+ *
99
+ */
100
+ getBrightness(callback) {
101
+ this.tpLinkAccessory.getDeviceInfo().then((response) => {
102
+ if (response) {
103
+ const brightness = response.brightness;
104
+ if (brightness !== undefined) {
105
+ this.platform.log.debug('Get Characteristic Brightness ->', brightness);
106
+ // you must call the callback function
107
+ // the first argument should be null if there were no errors
108
+ // the second argument should be the value to return
109
+ // you must call the callback function
110
+ callback(null, brightness);
111
+ }
112
+ else {
113
+ callback(new Error('unreachable'), 0);
114
+ }
115
+ }
116
+ else {
117
+ callback(new Error('unreachable'), 0);
118
+ }
119
+ }).catch(() => {
120
+ callback(new Error('unreachable'), 0);
121
+ });
122
+ }
123
+ updateState(interval) {
124
+ this.tpLinkAccessory.getDeviceInfo(true).then((response) => {
125
+ if (response) {
126
+ const isOn = response.device_on;
127
+ const brightness = response.brightness;
128
+ this.platform.log.debug('Get Characteristic On ->', isOn);
129
+ if (isOn !== undefined) {
130
+ this.service.updateCharacteristic(this.platform.Characteristic.On, isOn);
131
+ }
132
+ else {
133
+ this.setNoResponse();
134
+ interval += 300000;
135
+ }
136
+ if (brightness) {
137
+ this.service.updateCharacteristic(this.platform.Characteristic.Brightness, brightness);
138
+ }
139
+ }
140
+ setTimeout(() => {
141
+ this.updateState(interval + 300000);
142
+ }, interval);
143
+ }).catch(() => {
144
+ this.setNoResponse();
145
+ setTimeout(() => {
146
+ this.updateState(interval + 300000);
147
+ }, interval);
148
+ });
149
+ setTimeout(() => {
150
+ this.updateState(interval);
151
+ }, interval);
152
+ }
153
+ /**
154
+ * Handle "SET" requests from HomeKit
155
+ * These are sent when the user changes the state of an accessory.
156
+ */
157
+ setColorTemp(value, callback) {
158
+ this.log.debug('Color Temp Homekit :' + value);
159
+ if (this.tpLinkAccessory.getSysInfo().device_on) {
160
+ this.tpLinkAccessory.setColorTemp(value).then((result) => {
161
+ if (result) {
162
+ this.tpLinkAccessory.getSysInfo().color_temp = value;
163
+ this.platform.log.debug('Set Characteristic Color Temperature ->', value);
164
+ // you must call the callback function
165
+ callback(null);
166
+ }
167
+ else {
168
+ callback(new Error('unreachable'), false);
169
+ }
170
+ }).catch((error) => {
171
+ this.log.error('Failed to set color temperature: ' + error);
172
+ callback(new Error('unreachable'), false);
173
+ });
174
+ }
175
+ else {
176
+ // you must call the callback function
177
+ callback(null);
178
+ }
179
+ }
180
+ /**
181
+ * Handle the "GET" requests from HomeKit
182
+ * These are sent when HomeKit wants to know the current state of the accessory.
183
+ *
184
+ */
185
+ getColorTemp(callback) {
186
+ this.tpLinkAccessory.getColorTemp().then((response) => {
187
+ if (response !== undefined) {
188
+ const color_temp = response;
189
+ this.platform.log.debug('Get Characteristic Color Temperature ->', color_temp);
190
+ // you must call the callback function
191
+ // the first argument should be null if there were no errors
192
+ // the second argument should be the value to return
193
+ // you must call the callback function
194
+ callback(null, color_temp);
195
+ }
196
+ else {
197
+ callback(new Error('unreachable'), 0);
198
+ }
199
+ }).catch(() => {
200
+ callback(new Error('unreachable'), 0);
201
+ });
202
+ }
203
+ }
204
+ exports.L520EAccessory = L520EAccessory;
205
+ //# sourceMappingURL=platformL520EAccessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformL520EAccessory.js","sourceRoot":"","sources":["../../src/tapo/platformL520EAccessory.ts"],"names":[],"mappings":";;;;;;AAEA,0DAAkC;AAClC,uEAAoE;AAEpE;;;;GAIG;AACH,MAAa,cAAe,SAAQ,iDAA8B;IAG9C;IACG;IACA;IACA;IACA;IALrB,YACkB,GAAW,EACR,QAAsB,EACtB,SAA4B,EAC5B,OAAe,EACf,cAAuB;QAG1C,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QAPzC,QAAG,GAAH,GAAG,CAAQ;QACR,aAAQ,GAAR,QAAQ,CAAc;QACtB,cAAS,GAAT,SAAS,C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,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA9MD,wCA8MC"}
@@ -0,0 +1,84 @@
1
+ import { PlatformAccessory, CharacteristicValue, CharacteristicSetCallback, CharacteristicGetCallback, Logger } from 'homebridge';
2
+ import type { TapoPlatform } from './platform';
3
+ import L530 from './utils/l530';
4
+ import { TPLinkPlatformAccessory } from './platformTPLinkAccessory';
5
+ /**
6
+ * L530 Accessory
7
+ * An instance of this class is created for each accessory your platform registers
8
+ * Each accessory may expose multiple services of different service types.
9
+ */
10
+ export declare class L530Accessory extends TPLinkPlatformAccessory<L530> {
11
+ readonly log: Logger;
12
+ protected readonly platform: TapoPlatform;
13
+ protected readonly accessory: PlatformAccessory;
14
+ protected readonly timeout: number;
15
+ protected readonly updateInterval?: number | undefined;
16
+ private adaptiveLightingController;
17
+ private readonly fakeGatoHistoryService?;
18
+ constructor(log: Logger, platform: TapoPlatform, accessory: PlatformAccessory, timeout: number, updateInterval?: number | undefined);
19
+ protected init(platform: TapoPlatform, updateInterval?: number): void;
20
+ /**
21
+ * Handle "SET" requests from HomeKit
22
+ * These are sent when the user changes the state of an accessory.
23
+ */
24
+ setBrightness(value: CharacteristicValue, callback: CharacteristicSetCallback): void;
25
+ /**
26
+ * Handle the "GET" requests from HomeKit
27
+ * These are sent when HomeKit wants to know the current state of the accessory.
28
+ *
29
+ */
30
+ getBrightness(callback: CharacteristicGetCallback): void;
31
+ /**
32
+ * Handle "SET" requests from HomeKit
33
+ * These are sent when the user changes the state of an accessory.
34
+ */
35
+ setColorTemp(value: CharacteristicValue, callback: CharacteristicSetCallback): void;
36
+ /**
37
+ * Handle the "GET" requests from HomeKit
38
+ * These are sent when HomeKit wants to know the current state of the accessory.
39
+ *
40
+ */
41
+ getColorTemp(callback: CharacteristicGetCallback): void;
42
+ /**
43
+ * Handle "SET" requests from HomeKit
44
+ * These are sent when the user changes the state of an accessory.
45
+ */
46
+ setHue(value: CharacteristicValue, callback: CharacteristicSetCallback): void;
47
+ /**
48
+ * Handle the "GET" requests from HomeKit
49
+ * These are sent when HomeKit wants to know the current state of the accessory.
50
+ *
51
+ */
52
+ getHue(callback: CharacteristicGetCallback): void;
53
+ /**
54
+ * Handle "SET" requests from HomeKit
55
+ * These are sent when the user changes the state of an accessory.
56
+ */
57
+ setSaturation(value: CharacteristicValue, callback: CharacteristicSetCallback): void;
58
+ /**
59
+ * Handle the "GET" requests from HomeKit
60
+ * These are sent when HomeKit wants to know the current state of the accessory.
61
+ *
62
+ */
63
+ getSaturation(callback: CharacteristicGetCallback): void;
64
+ private updateConsumption;
65
+ /**
66
+ * Handle the "GET" requests from HomeKit
67
+ * These are sent when HomeKit wants to know the current state of the accessory.
68
+ *
69
+ */
70
+ getCurrentConsumption(callback: CharacteristicGetCallback): void;
71
+ /**
72
+ * Handle the "GET" requests from HomeKit
73
+ * These are sent when HomeKit wants to know the current state of the accessory.
74
+ *
75
+ */
76
+ getTotalConsumption(callback: CharacteristicGetCallback): void;
77
+ /**
78
+ * Handle the "SET" requests from HomeKit
79
+ *
80
+ */
81
+ resetConsumption(value: CharacteristicValue, callback: CharacteristicGetCallback): void;
82
+ protected updateState(interval: number): void;
83
+ }
84
+ //# sourceMappingURL=platformL530Accessory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformL530Accessory.d.ts","sourceRoot":"","sources":["../../src/tapo/platformL530Accessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,EAC/E,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,uBAAuB,CAAC,IAAI,CAAC;aAK5C,GAAG,EAAE,MA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