@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Donald Patrick Seal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # homebridge-tplink-tapo
2
+
3
+ Homebridge plugin for legacy TP-Link/Kasa smart home devices and newer TP-Link Tapo devices.
4
+
5
+ This repository combines the maintained legacy Kasa discovery/accessory model from `homebridge-tplink-smarthome` with the local Tapo protocol support from `homebridge-tapo-p100`.
6
+
7
+ ## Supported Devices
8
+
9
+ Legacy TP-Link/Kasa support is provided through automatic local discovery:
10
+
11
+ - Plugs: EP25, EP40, HS100, HS103, HS105, HS107, HS110, HS300, KP105, KP115, KP303, KP400
12
+ - Switches: ES20M, HS200, HS210, HS220, HS230
13
+ - Bulbs: KL50, KL120, KL125, LB100, LB110, LB120, LB130, LB200, LB230
14
+ - Lightstrips: KL400, KL430
15
+
16
+ Tapo support is configured manually by IP address:
17
+
18
+ - Plugs: P100/P105, P110
19
+ - Lights: L510/L510E, L520/L520E, L530/L530E
20
+
21
+ ## Installation
22
+
23
+ ```sh
24
+ npm install -g @fredsocial/homebridge-tplink-tapo
25
+ ```
26
+
27
+ Node 18 or newer and Homebridge 1.6 or newer are required.
28
+
29
+ ## Configuration
30
+
31
+ Legacy TP-Link/Kasa devices can usually be discovered with only the platform entry:
32
+
33
+ ```json
34
+ {
35
+ "platform": "TplinkTapo",
36
+ "name": "TP-Link Tapo"
37
+ }
38
+ ```
39
+
40
+ Tapo devices require Tapo app credentials and manual device entries:
41
+
42
+ ```json
43
+ {
44
+ "platform": "TplinkTapo",
45
+ "name": "TP-Link Tapo",
46
+ "username": "you@example.com",
47
+ "password": "your-tapo-password",
48
+ "tapoDevices": [
49
+ { "name": "Desk Plug", "host": "192.168.1.40", "type": "P100" },
50
+ { "name": "Washer", "host": "192.168.1.41", "type": "P110" },
51
+ { "name": "Lamp", "host": "192.168.1.42", "type": "L530" }
52
+ ]
53
+ }
54
+ ```
55
+
56
+ You can also keep legacy manual discovery entries in `devices`. Entries with only `host`/`port` are treated as legacy TP-Link/Kasa devices; entries with `name` or `type` are treated as Tapo devices.
57
+
58
+ ```json
59
+ {
60
+ "platform": "TplinkTapo",
61
+ "name": "TP-Link Tapo",
62
+ "username": "you@example.com",
63
+ "password": "your-tapo-password",
64
+ "devices": [
65
+ { "host": "192.168.1.20" },
66
+ { "host": "192.168.1.21", "port": 9999 },
67
+ { "name": "Tapo Plug", "host": "192.168.1.40", "type": "P100" }
68
+ ]
69
+ }
70
+ ```
71
+
72
+ ## Options
73
+
74
+ - `broadcast`: broadcast address for legacy discovery, default `255.255.255.255`
75
+ - `pollingInterval`: legacy discovery/device polling interval in seconds, default `10`
76
+ - `deviceTypes`: legacy discovery types, default `["bulb", "plug"]`
77
+ - `macAddresses` / `excludeMacAddresses`: legacy allow/deny filters
78
+ - `devices`: mixed manual list; untyped entries are legacy devices, typed entries are Tapo devices
79
+ - `tapoDevices`: Tapo-only manual list
80
+ - `username` / `password`: Tapo app credentials
81
+ - `timeout`: legacy communication timeout in seconds, default `15`
82
+ - `transport`: legacy device transport, `tcp` or `udp`
83
+ - `emeterPollingInterval`: legacy energy polling interval in seconds, default `20`
84
+ - `addCustomCharacteristics`: exposes legacy energy characteristics for Eve, default `true`
85
+
86
+ ## Development
87
+
88
+ ```sh
89
+ npm install
90
+ npm run build
91
+ npm run lint
92
+ npx jest --runInBand --forceExit
93
+ ```
94
+
95
+ `--forceExit` is currently useful for the Homebridge integration test harness because Homebridge and device discovery can leave background handles open after assertions finish.
96
+
97
+ ## Credits
98
+
99
+ This project incorporates work from:
100
+
101
+ - `plasticrake/homebridge-tplink-smarthome` for legacy TP-Link/Kasa support.
102
+ - `apatsufas/homebridge-tapo-p100` for local Tapo protocol support.
103
+
104
+ See `LICENSE` for the inherited license terms.
105
+ # homebridge-tplink-tapo
@@ -0,0 +1,347 @@
1
+ {
2
+ "pluginAlias": "TplinkTapo",
3
+ "pluginType": "platform",
4
+ "singular": true,
5
+ "headerDisplay": "TP-Link/Kasa and Tapo Smart Home Plugin.<p>Legacy TP-Link/Kasa devices can be discovered automatically. Tapo devices require username/password and manual host entries.</p>",
6
+ "footerDisplay": "",
7
+ "schema": {
8
+ "type": "object",
9
+ "properties": {
10
+ "name": {
11
+ "title": "Name",
12
+ "type": "string",
13
+ "default": "TplinkTapo",
14
+ "minLength": 1
15
+ },
16
+ "username": {
17
+ "title": "Tapo Username",
18
+ "type": "string",
19
+ "description": "The username used with the Tapo app.",
20
+ "default": ""
21
+ },
22
+ "password": {
23
+ "title": "Tapo Password",
24
+ "type": "string",
25
+ "description": "The password used with the Tapo app.",
26
+ "default": ""
27
+ },
28
+ "addCustomCharacteristics": {
29
+ "title": "Adds energy monitoring characteristics viewable in Eve app",
30
+ "description": "<b>Plug</b>: Amperes, KilowattHours, VoltAmperes, Volts, Watts.<br/><b>Bulb</b>: Watts",
31
+ "type": "boolean",
32
+ "default": true
33
+ },
34
+ "emeterPollingInterval": {
35
+ "title": "Energy Monitoring Polling Interval (seconds)",
36
+ "type": "integer",
37
+ "description": "How often to check device energy monitoring the background (seconds). Set to 0 to disable.",
38
+ "placeholder": "20"
39
+ },
40
+ "inUseThreshold": {
41
+ "title": "In Use Threshold (Watts)",
42
+ "type": "number",
43
+ "description": "(Watts) For plugs that support energy monitoring (e.g. HS110), min power draw for <b>OutletInUse</b>",
44
+ "placeholder": "0"
45
+ },
46
+ "switchModels": {
47
+ "type": "array",
48
+ "description": "Matching models are created in HomeKit as a Switch instead of an Outlet. Default: ['HS200', 'HS210']",
49
+ "items": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "discoveryPort": {
54
+ "title": "Port",
55
+ "type": "number",
56
+ "description": "Port to bind UDP socket for discovery. If port is not specified or is 0, the operating system will attempt to bind to a random port. Default: 0",
57
+ "placeholder": "0"
58
+ },
59
+ "broadcast": {
60
+ "title": "Broadcast Address",
61
+ "type": "string",
62
+ "description": "Broadcast Address. If discovery is not working tweak to match your subnet, eg: 192.168.0.255",
63
+ "placeholder": "255.255.255.255",
64
+ "format": "ipv4"
65
+ },
66
+ "pollingInterval": {
67
+ "title": "Polling Interval (seconds)",
68
+ "type": "integer",
69
+ "description": "How often to check device status in the background (seconds)",
70
+ "placeholder": "10"
71
+ },
72
+ "deviceTypes": {
73
+ "title": "Device Types",
74
+ "type": "array",
75
+ "description": "Choose which types of devices this plugin should discover",
76
+ "default": ["plug", "bulb"],
77
+ "titleMap": [
78
+ { "name": "Plugs", "value": "plug" },
79
+ { "name": "Bulbs", "value": "bulb" }
80
+ ],
81
+ "items": {
82
+ "type": "string",
83
+ "enum": ["plug", "bulb"]
84
+ }
85
+ },
86
+ "macAddresses": {
87
+ "title": "Allow MAC Addresses",
88
+ "description": "Allow-list of MAC addresses to include. If specified will ignore other devices. Supports glob-style patterns",
89
+ "type": "array",
90
+ "items": {
91
+ "title": "Mac Address",
92
+ "type": "string"
93
+ }
94
+ },
95
+ "excludeMacAddresses": {
96
+ "title": "Exclude MAC Addresses",
97
+ "description": "Deny-list of MAC addresses to exclude. Supports glob-style patterns",
98
+ "type": "array",
99
+ "items": {
100
+ "title": "Mac Address",
101
+ "type": "string"
102
+ }
103
+ },
104
+ "devices": {
105
+ "title": "Manual List Of Devices",
106
+ "type": "array",
107
+ "items": {
108
+ "title": "Device",
109
+ "type": "object",
110
+ "required": ["host"],
111
+ "properties": {
112
+ "host": {
113
+ "title": "Host",
114
+ "type": "string"
115
+ },
116
+ "port": {
117
+ "title": "Port",
118
+ "type": "number",
119
+ "placeholder": "9999"
120
+ },
121
+ "name": {
122
+ "title": "Name",
123
+ "type": "string"
124
+ },
125
+ "type": {
126
+ "title": "Tapo Device Type",
127
+ "type": "string",
128
+ "description": "Set this for Tapo devices. Leave unset for legacy TP-Link/Kasa manual devices.",
129
+ "enum": [
130
+ "Plug",
131
+ "P100",
132
+ "PowerPlug",
133
+ "P110",
134
+ "Light",
135
+ "L510",
136
+ "WhiteLight",
137
+ "L520",
138
+ "ColorLight",
139
+ "L530"
140
+ ]
141
+ },
142
+ "updateInterval": {
143
+ "title": "Tapo Update Interval (seconds)",
144
+ "type": "number",
145
+ "placeholder": "10"
146
+ },
147
+ "timeout": {
148
+ "title": "Tapo Timeout (seconds)",
149
+ "type": "number",
150
+ "placeholder": "2"
151
+ }
152
+ }
153
+ }
154
+ },
155
+ "tapoDevices": {
156
+ "title": "Tapo Devices",
157
+ "type": "array",
158
+ "description": "Manual list of Tapo devices. These require Tapo username/password.",
159
+ "items": {
160
+ "title": "Tapo Device",
161
+ "type": "object",
162
+ "required": ["host"],
163
+ "properties": {
164
+ "name": {
165
+ "title": "Name",
166
+ "type": "string"
167
+ },
168
+ "host": {
169
+ "title": "Host",
170
+ "type": "string"
171
+ },
172
+ "type": {
173
+ "title": "Device Type",
174
+ "type": "string",
175
+ "default": "Plug",
176
+ "enum": [
177
+ "Plug",
178
+ "P100",
179
+ "PowerPlug",
180
+ "P110",
181
+ "Light",
182
+ "L510",
183
+ "WhiteLight",
184
+ "L520",
185
+ "ColorLight",
186
+ "L530"
187
+ ]
188
+ },
189
+ "updateInterval": {
190
+ "title": "Update Interval (seconds)",
191
+ "type": "number",
192
+ "default": 10
193
+ },
194
+ "timeout": {
195
+ "title": "Timeout (seconds)",
196
+ "type": "number",
197
+ "default": 2
198
+ }
199
+ }
200
+ }
201
+ },
202
+ "timeout": {
203
+ "title": "Timeout (seconds)",
204
+ "type": "integer",
205
+ "description": "(seconds) Communication Timeout",
206
+ "placeholder": "15"
207
+ },
208
+ "transport": {
209
+ "type": "string",
210
+ "description": "Use TCP or UDP for device communication. Discovery will always use UDP. Default: TCP",
211
+ "placeholder": "tcp",
212
+ "enum": ["tcp", "udp"],
213
+ "titleMap": [
214
+ { "name": "TCP", "value": "tcp" },
215
+ { "name": "UDP", "value": "udp" }
216
+ ]
217
+ },
218
+ "waitTimeUpdate": {
219
+ "title": "Wait Time Update (ms)",
220
+ "type": "integer",
221
+ "description": "The time (ms) to wait to combine similar commands for a device before sending a command to a device. Default: 100.",
222
+ "placeholder": "100"
223
+ },
224
+ "devicesUseDiscoveryPort": {
225
+ "title": "Devices Use Discovery Port",
226
+ "description": "When true, sets the device port to the port the device used when responding to the discovery ping. When false, always uses default port (9999). You probably don't want to change this.",
227
+ "type": "boolean",
228
+ "default": false
229
+ }
230
+ }
231
+ },
232
+ "layout": [
233
+ "name",
234
+ {
235
+ "type": "fieldset",
236
+ "title": "HomeKit (Optional)",
237
+ "description": "Customize how devices are exposed in HomeKit",
238
+ "expandable": true,
239
+ "items": [
240
+ "addCustomCharacteristics",
241
+ "emeterPollingInterval",
242
+ "inUseThreshold",
243
+ {
244
+ "key": "switchModels",
245
+ "type": "array",
246
+ "buttonText": "Add Switch Model",
247
+ "items": {
248
+ "title": "Model",
249
+ "type": "string",
250
+ "required": true
251
+ }
252
+ }
253
+ ]
254
+ },
255
+ {
256
+ "type": "fieldset",
257
+ "title": "Device Discovery (Optional)",
258
+ "description": "Customize device discovery",
259
+ "expandable": true,
260
+ "items": [
261
+ "broadcast",
262
+ "pollingInterval",
263
+ "deviceTypes",
264
+ "discoveryPort",
265
+ {
266
+ "key": "macAddresses",
267
+ "type": "array",
268
+ "buttonText": "Add MAC Address",
269
+ "items": {
270
+ "title": "Allow MAC Address",
271
+ "type": "string",
272
+ "required": true
273
+ }
274
+ },
275
+ {
276
+ "key": "excludeMacAddresses",
277
+ "type": "array",
278
+ "buttonText": "Add MAC Address",
279
+ "items": {
280
+ "title": "Exclude MAC Address",
281
+ "type": "string",
282
+ "required": true
283
+ }
284
+ },
285
+ {
286
+ "type": "fieldset",
287
+ "title": "Manual Discovery",
288
+ "description": "Use entries without a type for legacy TP-Link/Kasa devices. Use typed entries for Tapo devices.",
289
+ "expandable": true,
290
+ "items": [
291
+ {
292
+ "key": "devices",
293
+ "type": "array",
294
+ "buttonText": "Add Device",
295
+ "items": [
296
+ "devices[].host",
297
+ "devices[].port",
298
+ "devices[].name",
299
+ "devices[].type",
300
+ "devices[].updateInterval",
301
+ "devices[].timeout"
302
+ ]
303
+ },
304
+ {
305
+ "type": "help",
306
+ "helpvalue": "Before resorting to manually specifying devices. Try setting the broadcast address and check your router/switch/firewall configuration. You must assign static IP addresses to your devices to use this configuration."
307
+ }
308
+ ]
309
+ }
310
+ ]
311
+ },
312
+ {
313
+ "type": "fieldset",
314
+ "title": "Tapo Devices",
315
+ "description": "Tapo devices require manual host entries and Tapo app credentials.",
316
+ "expandable": true,
317
+ "items": [
318
+ "username",
319
+ "password",
320
+ {
321
+ "key": "tapoDevices",
322
+ "type": "array",
323
+ "buttonText": "Add Tapo Device",
324
+ "items": [
325
+ "tapoDevices[].name",
326
+ "tapoDevices[].host",
327
+ "tapoDevices[].type",
328
+ "tapoDevices[].updateInterval",
329
+ "tapoDevices[].timeout"
330
+ ]
331
+ }
332
+ ]
333
+ },
334
+ {
335
+ "type": "fieldset",
336
+ "title": "Advanced Settings (Optional)",
337
+ "description": "Don't change these, unless you understand what you're doing.",
338
+ "expandable": true,
339
+ "items": [
340
+ "timeout",
341
+ "waitTimeUpdate",
342
+ "transport",
343
+ "devicesUseDiscoveryPort"
344
+ ]
345
+ }
346
+ ]
347
+ }
@@ -0,0 +1,4 @@
1
+ import type { HAP, PlatformAccessory, Service } from 'homebridge';
2
+ import type HomekitDevice from './homekit-device';
3
+ export default function accessoryInformation(hap: HAP): (accessory: PlatformAccessory, hkDevice: HomekitDevice) => Service | undefined;
4
+ //# sourceMappingURL=accessory-information.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessory-information.d.ts","sourceRoot":"","sources":["../src/accessory-information.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,GAAG,EAAE,GAAG,GACP,CACD,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE,aAAa,KACpB,OAAO,GAAG,SAAS,CA6BvB"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function accessoryInformation(hap) {
4
+ const { Characteristic } = hap;
5
+ return (accessory, hkDevice) => {
6
+ const infoService = accessory.getService(hap.Service.AccessoryInformation);
7
+ if (infoService === undefined)
8
+ return undefined;
9
+ if (!infoService.getCharacteristic(Characteristic.FirmwareRevision)) {
10
+ infoService.addCharacteristic(Characteristic.FirmwareRevision);
11
+ }
12
+ if (!infoService.getCharacteristic(Characteristic.HardwareRevision)) {
13
+ infoService.addCharacteristic(Characteristic.HardwareRevision);
14
+ }
15
+ infoService
16
+ .setCharacteristic(Characteristic.Name, hkDevice.name)
17
+ .setCharacteristic(Characteristic.Manufacturer, hkDevice.manufacturer)
18
+ .setCharacteristic(Characteristic.Model, hkDevice.model)
19
+ .setCharacteristic(Characteristic.SerialNumber, hkDevice.serialNumber)
20
+ .setCharacteristic(Characteristic.FirmwareRevision, hkDevice.firmwareRevision)
21
+ .setCharacteristic(Characteristic.HardwareRevision, hkDevice.hardwareRevision);
22
+ return infoService;
23
+ };
24
+ }
25
+ exports.default = accessoryInformation;
26
+ //# sourceMappingURL=accessory-information.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessory-information.js","sourceRoot":"","sources":["../src/accessory-information.ts"],"names":[],"mappings":";;AAGA,SAAwB,oBAAoB,CAC1C,GAAQ;IAKR,MAAM,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC;IAE/B,OAAO,CAAC,SAA4B,EAAE,QAAuB,EAAE,EAAE;QAC/D,MAAM,WAAW,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAC3E,IAAI,WAAW,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAEhD,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACpE,WAAW,CAAC,iBAAiB,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACpE,WAAW,CAAC,iBAAiB,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;QACjE,CAAC;QACD,WAAW;aACR,iBAAiB,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;aACrD,iBAAiB,CAAC,cAAc,CAAC,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC;aACrE,iBAAiB,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC;aACvD,iBAAiB,CAAC,cAAc,CAAC,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC;aACrE,iBAAiB,CAChB,cAAc,CAAC,gBAAgB,EAC/B,QAAQ,CAAC,gBAAgB,CAC1B;aACA,iBAAiB,CAChB,cAAc,CAAC,gBAAgB,EAC/B,QAAQ,CAAC,gBAAgB,CAC1B,CAAC;QAEJ,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC;AAlCD,uCAkCC"}
@@ -0,0 +1,4 @@
1
+ import type { WithUUID } from 'homebridge';
2
+ import DefaultCharacteristicClass from './types';
3
+ export default function amperes(DefaultCharacteristic: typeof DefaultCharacteristicClass): WithUUID<new () => DefaultCharacteristicClass>;
4
+ //# sourceMappingURL=amperes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amperes.d.ts","sourceRoot":"","sources":["../../src/characteristics/amperes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,0BAA0B,MAAM,SAAS,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,qBAAqB,EAAE,OAAO,0BAA0B,GACvD,QAAQ,CAAC,UAAU,0BAA0B,CAAC,CAWhD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function amperes(DefaultCharacteristic) {
4
+ return class Amperes extends DefaultCharacteristic {
5
+ static UUID = 'E863F126-079E-48FF-8F27-9C2605A29F52';
6
+ constructor() {
7
+ super('Amperes', Amperes.UUID, {
8
+ unit: 'A',
9
+ minStep: 0.01,
10
+ });
11
+ }
12
+ };
13
+ }
14
+ exports.default = amperes;
15
+ //# sourceMappingURL=amperes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amperes.js","sourceRoot":"","sources":["../../src/characteristics/amperes.ts"],"names":[],"mappings":";;AAGA,SAAwB,OAAO,CAC7B,qBAAwD;IAExD,OAAO,MAAM,OAAQ,SAAQ,qBAAqB;QAChD,MAAM,CAAU,IAAI,GAAG,sCAAsC,CAAC;QAE9D;YACE,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE;gBAC7B,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAbD,0BAaC"}
@@ -0,0 +1,3 @@
1
+ import DefaultCharacteristicClass from './types';
2
+ export default function defaultCharacteristic(Characteristic: typeof DefaultCharacteristicClass): typeof DefaultCharacteristicClass;
3
+ //# sourceMappingURL=default-characteristic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-characteristic.d.ts","sourceRoot":"","sources":["../../src/characteristics/default-characteristic.ts"],"names":[],"mappings":"AAIA,OAAO,0BAA0B,MAAM,SAAS,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,cAAc,EAAE,OAAO,0BAA0B,GAChD,OAAO,0BAA0B,CAkBnC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function defaultCharacteristic(Characteristic) {
4
+ return class DefaultCharacteristic extends Characteristic {
5
+ constructor(displayName, UUID, props) {
6
+ const combinedProps = {
7
+ format: "float" /* Formats.FLOAT */,
8
+ minValue: 0,
9
+ maxValue: 65535,
10
+ perms: ["pr" /* Perms.PAIRED_READ */, "ev" /* Perms.NOTIFY */],
11
+ ...props,
12
+ };
13
+ super(displayName, UUID, combinedProps);
14
+ this.value = this.getDefaultValue();
15
+ }
16
+ };
17
+ }
18
+ exports.default = defaultCharacteristic;
19
+ //# sourceMappingURL=default-characteristic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-characteristic.js","sourceRoot":"","sources":["../../src/characteristics/default-characteristic.ts"],"names":[],"mappings":";;AAMA,SAAwB,qBAAqB,CAC3C,cAAiD;IAEjD,OAAO,MAAM,qBAAsB,SAAQ,cAAc;QACvD,YACE,WAAmB,EACnB,IAAY,EACZ,KAA6D;YAE7D,MAAM,aAAa,GAAG;gBACpB,MAAM,6BAAe;gBACrB,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,KAAK;gBACf,KAAK,EAAE,uDAAiC;gBACxC,GAAG,KAAK;aACT,CAAC;YACF,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;YACxC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACtC,CAAC;KACF,CAAC;AACJ,CAAC;AApBD,wCAoBC"}
@@ -0,0 +1,3 @@
1
+ import type { Characteristic as CharacteristicClass, WithUUID } from 'homebridge';
2
+ export default function characteristic(Characteristic: typeof CharacteristicClass): Record<'Amperes' | 'KilowattHours' | 'KilowattVoltAmpereHour' | 'VoltAmperes' | 'Volts' | 'Watts', WithUUID<new () => CharacteristicClass>>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/characteristics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,IAAI,mBAAmB,EACrC,QAAQ,EACT,MAAM,YAAY,CAAC;AAUpB,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,cAAc,EAAE,OAAO,mBAAmB,GACzC,MAAM,CACL,SAAS,GACT,eAAe,GACf,wBAAwB,GACxB,aAAa,GACb,OAAO,GACP,OAAO,EACT,QAAQ,CAAC,UAAU,mBAAmB,CAAC,CACxC,CAWA"}
@@ -0,0 +1,25 @@
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
+ const default_characteristic_1 = __importDefault(require("./default-characteristic"));
7
+ const amperes_1 = __importDefault(require("./amperes"));
8
+ const kilowatt_hours_1 = __importDefault(require("./kilowatt-hours"));
9
+ const kilowatt_volt_ampere_hour_1 = __importDefault(require("./kilowatt-volt-ampere-hour"));
10
+ const volt_amperes_1 = __importDefault(require("./volt-amperes"));
11
+ const volts_1 = __importDefault(require("./volts"));
12
+ const watts_1 = __importDefault(require("./watts"));
13
+ function characteristic(Characteristic) {
14
+ const DefaultCharacteristic = (0, default_characteristic_1.default)(Characteristic);
15
+ return {
16
+ Amperes: (0, amperes_1.default)(DefaultCharacteristic),
17
+ KilowattHours: (0, kilowatt_hours_1.default)(DefaultCharacteristic),
18
+ KilowattVoltAmpereHour: (0, kilowatt_volt_ampere_hour_1.default)(DefaultCharacteristic),
19
+ VoltAmperes: (0, volt_amperes_1.default)(DefaultCharacteristic),
20
+ Volts: (0, volts_1.default)(DefaultCharacteristic),
21
+ Watts: (0, watts_1.default)(DefaultCharacteristic),
22
+ };
23
+ }
24
+ exports.default = characteristic;
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/characteristics/index.ts"],"names":[],"mappings":";;;;;AAKA,sFAAmE;AACnE,wDAAsC;AACtC,sEAAmD;AACnD,4FAAuE;AACvE,kEAA+C;AAC/C,oDAAkC;AAClC,oDAAkC;AAElC,SAAwB,cAAc,CACpC,cAA0C;IAU1C,MAAM,qBAAqB,GAAG,IAAA,gCAA2B,EAAC,cAAc,CAAC,CAAC;IAE1E,OAAO;QACL,OAAO,EAAE,IAAA,iBAAa,EAAC,qBAAqB,CAAC;QAC7C,aAAa,EAAE,IAAA,wBAAmB,EAAC,qBAAqB,CAAC;QACzD,sBAAsB,EAAE,IAAA,mCAA4B,EAAC,qBAAqB,CAAC;QAC3E,WAAW,EAAE,IAAA,sBAAiB,EAAC,qBAAqB,CAAC;QACrD,KAAK,EAAE,IAAA,eAAW,EAAC,qBAAqB,CAAC;QACzC,KAAK,EAAE,IAAA,eAAW,EAAC,qBAAqB,CAAC;KAC1C,CAAC;AACJ,CAAC;AArBD,iCAqBC"}
@@ -0,0 +1,4 @@
1
+ import type { WithUUID } from 'homebridge';
2
+ import type DefaultCharacteristicClass from './types';
3
+ export default function kilowattHours(DefaultCharacteristic: typeof DefaultCharacteristicClass): WithUUID<new () => DefaultCharacteristicClass>;
4
+ //# sourceMappingURL=kilowatt-hours.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kilowatt-hours.d.ts","sourceRoot":"","sources":["../../src/characteristics/kilowatt-hours.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,0BAA0B,MAAM,SAAS,CAAC;AAEtD,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,qBAAqB,EAAE,OAAO,0BAA0B,GACvD,QAAQ,CAAC,UAAU,0BAA0B,CAAC,CAWhD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function kilowattHours(DefaultCharacteristic) {
4
+ return class KilowattHours extends DefaultCharacteristic {
5
+ static UUID = 'E863F10C-079E-48FF-8F27-9C2605A29F52';
6
+ constructor() {
7
+ super('Total Consumption', KilowattHours.UUID, {
8
+ unit: 'kWh',
9
+ minStep: 0.001,
10
+ });
11
+ }
12
+ };
13
+ }
14
+ exports.default = kilowattHours;
15
+ //# sourceMappingURL=kilowatt-hours.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kilowatt-hours.js","sourceRoot":"","sources":["../../src/characteristics/kilowatt-hours.ts"],"names":[],"mappings":";;AAGA,SAAwB,aAAa,CACnC,qBAAwD;IAExD,OAAO,MAAM,aAAc,SAAQ,qBAAqB;QACtD,MAAM,CAAU,IAAI,GAAG,sCAAsC,CAAC;QAE9D;YACE,KAAK,CAAC,mBAAmB,EAAE,aAAa,CAAC,IAAI,EAAE;gBAC7C,IAAI,EAAE,KAAK;gBACX,OAAO,EAAE,KAAK;aACf,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAbD,gCAaC"}
@@ -0,0 +1,4 @@
1
+ import type { WithUUID } from 'homebridge';
2
+ import type DefaultCharacteristicClass from './types';
3
+ export default function kilowattVoltAmpereHours(DefaultCharacteristic: typeof DefaultCharacteristicClass): WithUUID<new () => DefaultCharacteristicClass>;
4
+ //# sourceMappingURL=kilowatt-volt-ampere-hour.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kilowatt-volt-ampere-hour.d.ts","sourceRoot":"","sources":["../../src/characteristics/kilowatt-volt-ampere-hour.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,KAAK,0BAA0B,MAAM,SAAS,CAAC;AAEtD,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,qBAAqB,EAAE,OAAO,0BAA0B,GACvD,QAAQ,CAAC,UAAU,0BAA0B,CAAC,CAYhD"}