python-kasa 0.6.0.dev2__py3-none-any.whl → 0.6.1__py3-none-any.whl

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 (72) hide show
  1. kasa/__init__.py +2 -2
  2. kasa/aestransport.py +154 -101
  3. kasa/cli.py +42 -23
  4. kasa/device_factory.py +4 -3
  5. kasa/deviceconfig.py +19 -10
  6. kasa/discover.py +28 -11
  7. kasa/exceptions.py +15 -1
  8. kasa/httpclient.py +113 -0
  9. kasa/iotprotocol.py +30 -26
  10. kasa/json.py +5 -1
  11. kasa/klaptransport.py +60 -75
  12. kasa/modules/emeter.py +1 -1
  13. kasa/protocol.py +61 -16
  14. kasa/smartbulb.py +2 -2
  15. kasa/smartdevice.py +11 -7
  16. kasa/smartdimmer.py +2 -2
  17. kasa/smartlightstrip.py +2 -2
  18. kasa/smartplug.py +2 -2
  19. kasa/smartprotocol.py +16 -38
  20. kasa/smartstrip.py +2 -2
  21. kasa/tapo/tapodevice.py +19 -4
  22. kasa/tapo/tapoplug.py +2 -2
  23. kasa/tests/conftest.py +24 -8
  24. kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json +28 -0
  25. kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json +3 -3
  26. kasa/tests/fixtures/HS110(EU)_1.0_1.2.5.json +11 -23
  27. kasa/tests/fixtures/HS110(EU)_4.0_1.0.4.json +40 -0
  28. kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json +90 -0
  29. kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json +93 -0
  30. kasa/tests/fixtures/KL130(EU)_1.0_1.8.8.json +15 -15
  31. kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json +59 -0
  32. kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json +36 -0
  33. kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json +4 -4
  34. kasa/tests/fixtures/KP115(EU)_1.0_1.0.16.json +9 -9
  35. kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json +42 -0
  36. kasa/tests/fixtures/KP303(UK)_1.0_1.0.3.json +9 -25
  37. kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.2.json +414 -0
  38. kasa/tests/fixtures/smart/L510B(EU)_3.0_1.0.5.json +263 -0
  39. kasa/tests/fixtures/smart/L510E(US)_3.0_1.0.5.json +295 -0
  40. kasa/tests/fixtures/smart/L510E(US)_3.0_1.1.2.json +267 -0
  41. kasa/tests/fixtures/smart/L530E(EU)_3.0_1.0.6.json +19 -19
  42. kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.0.json +12 -12
  43. kasa/tests/fixtures/smart/L530E(US)_2.0_1.1.0.json +439 -0
  44. kasa/tests/fixtures/smart/L900-10(EU)_1.0_1.0.17.json +10 -10
  45. kasa/tests/fixtures/smart/L900-10(US)_1.0_1.0.11.json +428 -0
  46. kasa/tests/fixtures/smart/L900-5(EU)_1.0_1.0.17.json +98 -20
  47. kasa/tests/fixtures/smart/L900-5(EU)_1.0_1.1.0.json +390 -0
  48. kasa/tests/fixtures/smart/L920-5(US)_1.0_1.1.0.json +397 -0
  49. kasa/tests/fixtures/smart/L920-5(US)_1.0_1.1.3.json +415 -0
  50. kasa/tests/fixtures/smart/L930-5(US)_1.0_1.1.2.json +429 -0
  51. kasa/tests/fixtures/smart/P100_1.0.0_1.3.7.json +197 -0
  52. kasa/tests/fixtures/smart/P110(EU)_1.0_1.2.3.json +28 -19
  53. kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json +31 -31
  54. kasa/tests/fixtures/smart/P125M(US)_1.0_1.1.0.json +11 -11
  55. kasa/tests/fixtures/smart/P135(US)_1.0_1.0.5.json +317 -0
  56. kasa/tests/fixtures/smart/S500D(US)_1.0_1.0.5.json +317 -0
  57. kasa/tests/fixtures/smart/S505(US)_1.0_1.0.2.json +309 -0
  58. kasa/tests/newfakes.py +3 -0
  59. kasa/tests/test_aestransport.py +110 -22
  60. kasa/tests/test_cli.py +49 -2
  61. kasa/tests/test_device_factory.py +6 -4
  62. kasa/tests/test_deviceconfig.py +24 -9
  63. kasa/tests/test_discovery.py +126 -9
  64. kasa/tests/test_httpclient.py +100 -0
  65. kasa/tests/test_klapprotocol.py +70 -23
  66. kasa/tests/test_protocol.py +76 -2
  67. kasa/tests/test_smartprotocol.py +0 -1
  68. {python_kasa-0.6.0.dev2.dist-info → python_kasa-0.6.1.dist-info}/METADATA +37 -15
  69. {python_kasa-0.6.0.dev2.dist-info → python_kasa-0.6.1.dist-info}/RECORD +72 -49
  70. {python_kasa-0.6.0.dev2.dist-info → python_kasa-0.6.1.dist-info}/LICENSE +0 -0
  71. {python_kasa-0.6.0.dev2.dist-info → python_kasa-0.6.1.dist-info}/WHEEL +0 -0
  72. {python_kasa-0.6.0.dev2.dist-info → python_kasa-0.6.1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,428 @@
1
+ {
2
+ "component_nego": {
3
+ "component_list": [
4
+ {
5
+ "id": "device",
6
+ "ver_code": 2
7
+ },
8
+ {
9
+ "id": "light_strip",
10
+ "ver_code": 1
11
+ },
12
+ {
13
+ "id": "light_strip_lighting_effect",
14
+ "ver_code": 1
15
+ },
16
+ {
17
+ "id": "firmware",
18
+ "ver_code": 1
19
+ },
20
+ {
21
+ "id": "quick_setup",
22
+ "ver_code": 3
23
+ },
24
+ {
25
+ "id": "inherit",
26
+ "ver_code": 1
27
+ },
28
+ {
29
+ "id": "time",
30
+ "ver_code": 1
31
+ },
32
+ {
33
+ "id": "wireless",
34
+ "ver_code": 1
35
+ },
36
+ {
37
+ "id": "schedule",
38
+ "ver_code": 2
39
+ },
40
+ {
41
+ "id": "countdown",
42
+ "ver_code": 2
43
+ },
44
+ {
45
+ "id": "antitheft",
46
+ "ver_code": 1
47
+ },
48
+ {
49
+ "id": "account",
50
+ "ver_code": 1
51
+ },
52
+ {
53
+ "id": "synchronize",
54
+ "ver_code": 1
55
+ },
56
+ {
57
+ "id": "sunrise_sunset",
58
+ "ver_code": 1
59
+ },
60
+ {
61
+ "id": "brightness",
62
+ "ver_code": 1
63
+ },
64
+ {
65
+ "id": "cloud_connect",
66
+ "ver_code": 1
67
+ },
68
+ {
69
+ "id": "color_temperature",
70
+ "ver_code": 1
71
+ },
72
+ {
73
+ "id": "default_states",
74
+ "ver_code": 1
75
+ },
76
+ {
77
+ "id": "preset",
78
+ "ver_code": 3
79
+ },
80
+ {
81
+ "id": "color",
82
+ "ver_code": 1
83
+ },
84
+ {
85
+ "id": "on_off_gradually",
86
+ "ver_code": 1
87
+ },
88
+ {
89
+ "id": "device_local_time",
90
+ "ver_code": 1
91
+ },
92
+ {
93
+ "id": "iot_cloud",
94
+ "ver_code": 1
95
+ },
96
+ {
97
+ "id": "music_rhythm",
98
+ "ver_code": 2
99
+ }
100
+ ]
101
+ },
102
+ "discovery_result": {
103
+ "device_id": "00000000000000000000000000000000",
104
+ "device_model": "L900-10(US)",
105
+ "device_type": "SMART.TAPOBULB",
106
+ "factory_default": false,
107
+ "ip": "127.0.0.123",
108
+ "is_support_iot_cloud": true,
109
+ "mac": "54-AF-97-00-00-00",
110
+ "mgt_encrypt_schm": {
111
+ "encrypt_type": "AES",
112
+ "http_port": 80,
113
+ "is_support_https": false
114
+ },
115
+ "obd_src": "tplink",
116
+ "owner": "00000000000000000000000000000000"
117
+ },
118
+ "get_antitheft_rules": {
119
+ "antitheft_rule_max_count": 1,
120
+ "enable": false,
121
+ "rule_list": []
122
+ },
123
+ "get_auto_update_info": {
124
+ "enable": true,
125
+ "random_range": 120,
126
+ "time": 180
127
+ },
128
+ "get_connect_cloud_state": {
129
+ "status": 0
130
+ },
131
+ "get_countdown_rules": {
132
+ "countdown_rule_max_count": 1,
133
+ "enable": false,
134
+ "rule_list": []
135
+ },
136
+ "get_device_info": {
137
+ "avatar": "light_strip",
138
+ "brightness": 100,
139
+ "color_temp": 9000,
140
+ "color_temp_range": [
141
+ 9000,
142
+ 9000
143
+ ],
144
+ "default_states": {
145
+ "state": {
146
+ "brightness": 100,
147
+ "color_temp": 9000,
148
+ "hue": 0,
149
+ "saturation": 100
150
+ },
151
+ "type": "last_states"
152
+ },
153
+ "device_id": "0000000000000000000000000000000000000000",
154
+ "device_on": true,
155
+ "fw_id": "00000000000000000000000000000000",
156
+ "fw_ver": "1.0.11 Build 220119 Rel.221258",
157
+ "has_set_location_info": true,
158
+ "hue": 0,
159
+ "hw_id": "00000000000000000000000000000000",
160
+ "hw_ver": "1.0",
161
+ "ip": "127.0.0.123",
162
+ "lang": "en_US",
163
+ "latitude": 0,
164
+ "lighting_effect": {
165
+ "brightness": 50,
166
+ "custom": 0,
167
+ "display_colors": [],
168
+ "enable": 0,
169
+ "id": "",
170
+ "name": "station"
171
+ },
172
+ "longitude": 0,
173
+ "mac": "54-AF-97-00-00-00",
174
+ "model": "L900",
175
+ "music_rhythm_enable": false,
176
+ "music_rhythm_mode": "single_lamp",
177
+ "nickname": "I01BU0tFRF9OQU1FIw==",
178
+ "oem_id": "00000000000000000000000000000000",
179
+ "overheated": false,
180
+ "region": "Pacific/Honolulu",
181
+ "rssi": -42,
182
+ "saturation": 100,
183
+ "signal_level": 3,
184
+ "specs": "",
185
+ "ssid": "I01BU0tFRF9TU0lEIw==",
186
+ "time_diff": -600,
187
+ "type": "SMART.TAPOBULB"
188
+ },
189
+ "get_device_time": {
190
+ "region": "Pacific/Honolulu",
191
+ "time_diff": -600,
192
+ "timestamp": 1706141011
193
+ },
194
+ "get_device_usage": {
195
+ "power_usage": {
196
+ "past30": 0,
197
+ "past7": 0,
198
+ "today": 0
199
+ },
200
+ "saved_power": {
201
+ "past30": 3,
202
+ "past7": 3,
203
+ "today": 3
204
+ },
205
+ "time_usage": {
206
+ "past30": 3,
207
+ "past7": 3,
208
+ "today": 3
209
+ }
210
+ },
211
+ "get_fw_download_state": {
212
+ "download_progress": 0,
213
+ "reboot_time": 5,
214
+ "status": 0,
215
+ "upgrade_time": 5
216
+ },
217
+ "get_inherit_info": null,
218
+ "get_latest_fw": {
219
+ "fw_size": 786432,
220
+ "fw_ver": "1.1.0 Build 230905 Rel.184939",
221
+ "hw_id": "00000000000000000000000000000000",
222
+ "need_to_upgrade": true,
223
+ "oem_id": "00000000000000000000000000000000",
224
+ "release_date": "2023-10-13",
225
+ "release_note": "Modifications and Bug Fixes:\n1. Enhanced stability and performance.\n2. Enhanced the local communication security.",
226
+ "type": 2
227
+ },
228
+ "get_lighting_effect": {
229
+ "brightness": 50,
230
+ "custom": 0,
231
+ "direction": 1,
232
+ "display_colors": [],
233
+ "duration": 0,
234
+ "enable": 0,
235
+ "expansion_strategy": 2,
236
+ "id": "",
237
+ "name": "station",
238
+ "repeat_times": 1,
239
+ "segment_length": 1,
240
+ "sequence": [
241
+ [
242
+ 300,
243
+ 100,
244
+ 50
245
+ ],
246
+ [
247
+ 240,
248
+ 100,
249
+ 50
250
+ ],
251
+ [
252
+ 180,
253
+ 100,
254
+ 50
255
+ ],
256
+ [
257
+ 120,
258
+ 100,
259
+ 50
260
+ ],
261
+ [
262
+ 60,
263
+ 100,
264
+ 50
265
+ ],
266
+ [
267
+ 0,
268
+ 100,
269
+ 50
270
+ ],
271
+ [
272
+ 0,
273
+ 0,
274
+ 50
275
+ ],
276
+ [
277
+ 0,
278
+ 0,
279
+ 50
280
+ ],
281
+ [
282
+ 0,
283
+ 0,
284
+ 50
285
+ ],
286
+ [
287
+ 0,
288
+ 0,
289
+ 50
290
+ ],
291
+ [
292
+ 0,
293
+ 0,
294
+ 50
295
+ ],
296
+ [
297
+ 0,
298
+ 0,
299
+ 50
300
+ ]
301
+ ],
302
+ "spread": 16,
303
+ "transition": 400,
304
+ "type": "sequence"
305
+ },
306
+ "get_next_event": {},
307
+ "get_on_off_gradually_info": {
308
+ "enable": false
309
+ },
310
+ "get_preset_rules": {
311
+ "start_index": 0,
312
+ "states": [
313
+ {
314
+ "brightness": 50,
315
+ "color_temp": 9000,
316
+ "hue": 0,
317
+ "saturation": 100
318
+ },
319
+ {
320
+ "brightness": 100,
321
+ "color_temp": 0,
322
+ "hue": 240,
323
+ "saturation": 100
324
+ },
325
+ {
326
+ "brightness": 100,
327
+ "color_temp": 0,
328
+ "hue": 0,
329
+ "saturation": 100
330
+ },
331
+ {
332
+ "brightness": 100,
333
+ "color_temp": 0,
334
+ "hue": 120,
335
+ "saturation": 100
336
+ }
337
+ ],
338
+ "sum": 7
339
+ },
340
+ "get_schedule_rules": {
341
+ "enable": false,
342
+ "rule_list": [],
343
+ "schedule_rule_max_count": 16,
344
+ "start_index": 0,
345
+ "sum": 0
346
+ },
347
+ "get_wireless_scan_info": {
348
+ "ap_list": [
349
+ {
350
+ "bssid": "000000000000",
351
+ "channel": 0,
352
+ "cipher_type": 2,
353
+ "key_type": "wpa_psk",
354
+ "signal_level": 3,
355
+ "ssid": "I01BU0tFRF9TU0lEIw=="
356
+ },
357
+ {
358
+ "bssid": "000000000000",
359
+ "channel": 0,
360
+ "cipher_type": 2,
361
+ "key_type": "wpa_psk",
362
+ "signal_level": 1,
363
+ "ssid": "I01BU0tFRF9TU0lEIw=="
364
+ },
365
+ {
366
+ "bssid": "000000000000",
367
+ "channel": 0,
368
+ "cipher_type": 2,
369
+ "key_type": "wpa_psk",
370
+ "signal_level": 3,
371
+ "ssid": "I01BU0tFRF9TU0lEIw=="
372
+ },
373
+ {
374
+ "bssid": "000000000000",
375
+ "channel": 0,
376
+ "cipher_type": 2,
377
+ "key_type": "wpa_psk",
378
+ "signal_level": 1,
379
+ "ssid": "I01BU0tFRF9TU0lEIw=="
380
+ },
381
+ {
382
+ "bssid": "000000000000",
383
+ "channel": 0,
384
+ "cipher_type": 2,
385
+ "key_type": "wpa_psk",
386
+ "signal_level": 2,
387
+ "ssid": "I01BU0tFRF9TU0lEIw=="
388
+ },
389
+ {
390
+ "bssid": "000000000000",
391
+ "channel": 0,
392
+ "cipher_type": 2,
393
+ "key_type": "wpa_psk",
394
+ "signal_level": 1,
395
+ "ssid": "I01BU0tFRF9TU0lEIw=="
396
+ },
397
+ {
398
+ "bssid": "000000000000",
399
+ "channel": 0,
400
+ "cipher_type": 2,
401
+ "key_type": "wpa_psk",
402
+ "signal_level": 2,
403
+ "ssid": "I01BU0tFRF9TU0lEIw=="
404
+ }
405
+ ],
406
+ "wep_supported": false
407
+ },
408
+ "qs_component_nego": {
409
+ "component_list": [
410
+ {
411
+ "id": "quick_setup",
412
+ "ver_code": 3
413
+ },
414
+ {
415
+ "id": "sunrise_sunset",
416
+ "ver_code": 1
417
+ },
418
+ {
419
+ "id": "inherit",
420
+ "ver_code": 1
421
+ }
422
+ ],
423
+ "extra_info": {
424
+ "device_model": "L900",
425
+ "device_type": "SMART.TAPOBULB"
426
+ }
427
+ }
428
+ }
@@ -110,7 +110,7 @@
110
110
  "factory_default": false,
111
111
  "ip": "127.0.0.123",
112
112
  "is_support_iot_cloud": true,
113
- "mac": "00-00-00-00-00-00",
113
+ "mac": "A8-42-A1-00-00-00",
114
114
  "mgt_encrypt_schm": {
115
115
  "encrypt_type": "AES",
116
116
  "http_port": 80,
@@ -141,7 +141,7 @@
141
141
  "get_device_info": {
142
142
  "avatar": "",
143
143
  "brightness": 100,
144
- "color_temp": 9000,
144
+ "color_temp": 0,
145
145
  "color_temp_range": [
146
146
  9000,
147
147
  9000
@@ -149,18 +149,18 @@
149
149
  "default_states": {
150
150
  "state": {
151
151
  "brightness": 100,
152
- "color_temp": 9000,
153
- "hue": 0,
154
- "saturation": 100
152
+ "color_temp": 0,
153
+ "hue": 354,
154
+ "saturation": 93
155
155
  },
156
156
  "type": "last_states"
157
157
  },
158
158
  "device_id": "0000000000000000000000000000000000000000",
159
- "device_on": true,
159
+ "device_on": false,
160
160
  "fw_id": "00000000000000000000000000000000",
161
161
  "fw_ver": "1.0.17 Build 230426 Rel.153230",
162
162
  "has_set_location_info": false,
163
- "hue": 0,
163
+ "hue": 354,
164
164
  "hw_id": "00000000000000000000000000000000",
165
165
  "hw_ver": "1.0",
166
166
  "ip": "127.0.0.123",
@@ -175,7 +175,7 @@
175
175
  "name": "station"
176
176
  },
177
177
  "longitude": 0,
178
- "mac": "00-00-00-00-00-00",
178
+ "mac": "A8-42-A1-00-00-00",
179
179
  "model": "L900",
180
180
  "music_rhythm_enable": false,
181
181
  "music_rhythm_mode": "single_lamp",
@@ -183,8 +183,8 @@
183
183
  "oem_id": "00000000000000000000000000000000",
184
184
  "overheated": false,
185
185
  "region": "Europe/Berlin",
186
- "rssi": -50,
187
- "saturation": 100,
186
+ "rssi": -55,
187
+ "saturation": 93,
188
188
  "signal_level": 2,
189
189
  "specs": "",
190
190
  "ssid": "I01BU0tFRF9TU0lEIw==",
@@ -194,23 +194,23 @@
194
194
  "get_device_time": {
195
195
  "region": "Europe/Berlin",
196
196
  "time_diff": 0,
197
- "timestamp": 1704389578
197
+ "timestamp": 1705699997
198
198
  },
199
199
  "get_device_usage": {
200
200
  "power_usage": {
201
- "past30": 5,
202
- "past7": 5,
203
- "today": 5
201
+ "past30": 15,
202
+ "past7": 0,
203
+ "today": 0
204
204
  },
205
205
  "saved_power": {
206
- "past30": 17,
207
- "past7": 17,
208
- "today": 17
206
+ "past30": 81,
207
+ "past7": 1,
208
+ "today": 0
209
209
  },
210
210
  "time_usage": {
211
- "past30": 22,
212
- "past7": 22,
213
- "today": 22
211
+ "past30": 96,
212
+ "past7": 1,
213
+ "today": 0
214
214
  }
215
215
  },
216
216
  "get_fw_download_state": {
@@ -221,6 +221,84 @@
221
221
  "upgrade_time": 5
222
222
  },
223
223
  "get_inherit_info": null,
224
+ "get_lighting_effect": {
225
+ "brightness": 50,
226
+ "custom": 0,
227
+ "direction": 1,
228
+ "display_colors": [],
229
+ "duration": 0,
230
+ "enable": 0,
231
+ "expansion_strategy": 2,
232
+ "id": "",
233
+ "name": "station",
234
+ "repeat_times": 1,
235
+ "segment_length": 1,
236
+ "sequence": [
237
+ [
238
+ 300,
239
+ 100,
240
+ 50
241
+ ],
242
+ [
243
+ 240,
244
+ 100,
245
+ 50
246
+ ],
247
+ [
248
+ 180,
249
+ 100,
250
+ 50
251
+ ],
252
+ [
253
+ 120,
254
+ 100,
255
+ 50
256
+ ],
257
+ [
258
+ 60,
259
+ 100,
260
+ 50
261
+ ],
262
+ [
263
+ 0,
264
+ 100,
265
+ 50
266
+ ],
267
+ [
268
+ 0,
269
+ 0,
270
+ 50
271
+ ],
272
+ [
273
+ 0,
274
+ 0,
275
+ 50
276
+ ],
277
+ [
278
+ 0,
279
+ 0,
280
+ 50
281
+ ],
282
+ [
283
+ 0,
284
+ 0,
285
+ 50
286
+ ],
287
+ [
288
+ 0,
289
+ 0,
290
+ 50
291
+ ],
292
+ [
293
+ 0,
294
+ 0,
295
+ 50
296
+ ]
297
+ ],
298
+ "spread": 16,
299
+ "transition": 400,
300
+ "type": "sequence"
301
+ },
224
302
  "get_next_event": {},
225
303
  "get_on_off_gradually_info": {
226
304
  "enable": false