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,429 @@
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": 2
15
+ },
16
+ {
17
+ "id": "firmware",
18
+ "ver_code": 2
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": 3
99
+ },
100
+ {
101
+ "id": "bulb_quick_control",
102
+ "ver_code": 1
103
+ },
104
+ {
105
+ "id": "localSmart",
106
+ "ver_code": 1
107
+ },
108
+ {
109
+ "id": "homekit",
110
+ "ver_code": 2
111
+ },
112
+ {
113
+ "id": "segment",
114
+ "ver_code": 1
115
+ },
116
+ {
117
+ "id": "segment_effect",
118
+ "ver_code": 1
119
+ },
120
+ {
121
+ "id": "auto_light",
122
+ "ver_code": 1
123
+ }
124
+ ]
125
+ },
126
+ "discovery_result": {
127
+ "device_id": "00000000000000000000000000000000",
128
+ "device_model": "L930-5(US)",
129
+ "device_type": "SMART.TAPOBULB",
130
+ "factory_default": false,
131
+ "ip": "127.0.0.123",
132
+ "is_support_iot_cloud": true,
133
+ "mac": "3C-52-A1-00-00-00",
134
+ "mgt_encrypt_schm": {
135
+ "encrypt_type": "KLAP",
136
+ "http_port": 80,
137
+ "is_support_https": false,
138
+ "lv": 2
139
+ },
140
+ "obd_src": "tplink",
141
+ "owner": "00000000000000000000000000000000"
142
+ },
143
+ "get_antitheft_rules": {
144
+ "antitheft_rule_max_count": 1,
145
+ "enable": false,
146
+ "rule_list": []
147
+ },
148
+ "get_auto_light_info": {
149
+ "enable": false,
150
+ "mode": "light_track"
151
+ },
152
+ "get_auto_update_info": {
153
+ "enable": true,
154
+ "random_range": 120,
155
+ "time": 180
156
+ },
157
+ "get_connect_cloud_state": {
158
+ "status": 0
159
+ },
160
+ "get_countdown_rules": {
161
+ "countdown_rule_max_count": 1,
162
+ "enable": false,
163
+ "rule_list": []
164
+ },
165
+ "get_device_info": {
166
+ "avatar": "light_strip",
167
+ "brightness": 100,
168
+ "color_temp": 4500,
169
+ "color_temp_range": [
170
+ 2500,
171
+ 6500
172
+ ],
173
+ "default_states": {
174
+ "state": {
175
+ "brightness": 100,
176
+ "color_temp": 4500,
177
+ "hue": 0,
178
+ "saturation": 100
179
+ },
180
+ "type": "last_states"
181
+ },
182
+ "device_id": "0000000000000000000000000000000000000000",
183
+ "device_on": true,
184
+ "fw_id": "00000000000000000000000000000000",
185
+ "fw_ver": "1.1.2 Build 231212 Rel.210005",
186
+ "has_set_location_info": true,
187
+ "hue": 0,
188
+ "hw_id": "00000000000000000000000000000000",
189
+ "hw_ver": "1.0",
190
+ "ip": "127.0.0.123",
191
+ "lang": "en_US",
192
+ "latitude": 0,
193
+ "lighting_effect": {
194
+ "brightness": 50,
195
+ "custom": 0,
196
+ "display_colors": [],
197
+ "enable": 0,
198
+ "id": "",
199
+ "name": "station"
200
+ },
201
+ "longitude": 0,
202
+ "mac": "3C-52-A1-00-00-00",
203
+ "model": "L930",
204
+ "music_rhythm_enable": false,
205
+ "music_rhythm_mode": "single_lamp",
206
+ "nickname": "I01BU0tFRF9OQU1FIw==",
207
+ "oem_id": "00000000000000000000000000000000",
208
+ "overheated": false,
209
+ "region": "Pacific/Honolulu",
210
+ "rssi": -37,
211
+ "saturation": 100,
212
+ "segment_effect": {
213
+ "brightness": 0,
214
+ "custom": 0,
215
+ "display_colors": [],
216
+ "enable": 0,
217
+ "id": "",
218
+ "name": "station"
219
+ },
220
+ "signal_level": 3,
221
+ "specs": "",
222
+ "ssid": "I01BU0tFRF9TU0lEIw==",
223
+ "time_diff": -600,
224
+ "type": "SMART.TAPOBULB"
225
+ },
226
+ "get_device_segment": {
227
+ "segment": 50
228
+ },
229
+ "get_device_time": {
230
+ "region": "Pacific/Honolulu",
231
+ "time_diff": -600,
232
+ "timestamp": 1706061664
233
+ },
234
+ "get_device_usage": {
235
+ "power_usage": {
236
+ "past30": 0,
237
+ "past7": 0,
238
+ "today": 0
239
+ },
240
+ "saved_power": {
241
+ "past30": 6,
242
+ "past7": 6,
243
+ "today": 6
244
+ },
245
+ "time_usage": {
246
+ "past30": 6,
247
+ "past7": 6,
248
+ "today": 6
249
+ }
250
+ },
251
+ "get_fw_download_state": {
252
+ "auto_upgrade": false,
253
+ "download_progress": 0,
254
+ "reboot_time": 5,
255
+ "status": 0,
256
+ "upgrade_time": 5
257
+ },
258
+ "get_inherit_info": null,
259
+ "get_latest_fw": {
260
+ "fw_size": 0,
261
+ "fw_ver": "1.1.2 Build 231212 Rel.210005",
262
+ "hw_id": "",
263
+ "need_to_upgrade": false,
264
+ "oem_id": "",
265
+ "release_date": "",
266
+ "release_note": "",
267
+ "type": 0
268
+ },
269
+ "get_lighting_effect": {
270
+ "brightness": 50,
271
+ "custom": 0,
272
+ "direction": 1,
273
+ "display_colors": [],
274
+ "duration": 0,
275
+ "enable": 0,
276
+ "expansion_strategy": 2,
277
+ "id": "",
278
+ "name": "station",
279
+ "repeat_times": 1,
280
+ "segment_length": 1,
281
+ "sequence": [
282
+ [
283
+ 300,
284
+ 100,
285
+ 50
286
+ ],
287
+ [
288
+ 240,
289
+ 100,
290
+ 50
291
+ ],
292
+ [
293
+ 180,
294
+ 100,
295
+ 50
296
+ ],
297
+ [
298
+ 120,
299
+ 100,
300
+ 50
301
+ ],
302
+ [
303
+ 60,
304
+ 100,
305
+ 50
306
+ ],
307
+ [
308
+ 0,
309
+ 100,
310
+ 50
311
+ ],
312
+ [
313
+ 0,
314
+ 0,
315
+ 50
316
+ ],
317
+ [
318
+ 0,
319
+ 0,
320
+ 50
321
+ ],
322
+ [
323
+ 0,
324
+ 0,
325
+ 50
326
+ ],
327
+ [
328
+ 0,
329
+ 0,
330
+ 50
331
+ ],
332
+ [
333
+ 0,
334
+ 0,
335
+ 50
336
+ ],
337
+ [
338
+ 0,
339
+ 0,
340
+ 50
341
+ ]
342
+ ],
343
+ "spread": 16,
344
+ "transition": 400,
345
+ "type": "sequence"
346
+ },
347
+ "get_next_event": {},
348
+ "get_on_off_gradually_info": {
349
+ "enable": false
350
+ },
351
+ "get_preset_rules": {
352
+ "start_index": 0,
353
+ "states": [
354
+ {
355
+ "brightness": 50,
356
+ "color_temp": 4500,
357
+ "hue": 0,
358
+ "saturation": 100
359
+ },
360
+ {
361
+ "brightness": 100,
362
+ "color_temp": 0,
363
+ "hue": 240,
364
+ "saturation": 100
365
+ },
366
+ {
367
+ "brightness": 100,
368
+ "color_temp": 0,
369
+ "hue": 0,
370
+ "saturation": 100
371
+ },
372
+ {
373
+ "brightness": 100,
374
+ "color_temp": 0,
375
+ "hue": 120,
376
+ "saturation": 100
377
+ }
378
+ ],
379
+ "sum": 7
380
+ },
381
+ "get_schedule_rules": {
382
+ "enable": false,
383
+ "rule_list": [],
384
+ "schedule_rule_max_count": 32,
385
+ "start_index": 0,
386
+ "sum": 0
387
+ },
388
+ "get_segment_effect_rule": {
389
+ "brightness": 0,
390
+ "custom": 0,
391
+ "display_colors": [],
392
+ "enable": 0,
393
+ "id": "",
394
+ "name": "station"
395
+ },
396
+ "get_wireless_scan_info": {
397
+ "ap_list": [],
398
+ "wep_supported": false
399
+ },
400
+ "qs_component_nego": {
401
+ "component_list": [
402
+ {
403
+ "id": "quick_setup",
404
+ "ver_code": 3
405
+ },
406
+ {
407
+ "id": "sunrise_sunset",
408
+ "ver_code": 1
409
+ },
410
+ {
411
+ "id": "inherit",
412
+ "ver_code": 1
413
+ },
414
+ {
415
+ "id": "iot_cloud",
416
+ "ver_code": 1
417
+ },
418
+ {
419
+ "id": "firmware",
420
+ "ver_code": 2
421
+ }
422
+ ],
423
+ "extra_info": {
424
+ "device_model": "L930",
425
+ "device_type": "SMART.TAPOBULB",
426
+ "is_klap": true
427
+ }
428
+ }
429
+ }
@@ -0,0 +1,197 @@
1
+ {
2
+ "component_nego": {
3
+ "component_list": [
4
+ {
5
+ "id": "device",
6
+ "ver_code": 2
7
+ },
8
+ {
9
+ "id": "firmware",
10
+ "ver_code": 1
11
+ },
12
+ {
13
+ "id": "quick_setup",
14
+ "ver_code": 3
15
+ },
16
+ {
17
+ "id": "time",
18
+ "ver_code": 1
19
+ },
20
+ {
21
+ "id": "wireless",
22
+ "ver_code": 1
23
+ },
24
+ {
25
+ "id": "schedule",
26
+ "ver_code": 2
27
+ },
28
+ {
29
+ "id": "countdown",
30
+ "ver_code": 2
31
+ },
32
+ {
33
+ "id": "antitheft",
34
+ "ver_code": 1
35
+ },
36
+ {
37
+ "id": "account",
38
+ "ver_code": 1
39
+ },
40
+ {
41
+ "id": "synchronize",
42
+ "ver_code": 1
43
+ },
44
+ {
45
+ "id": "sunrise_sunset",
46
+ "ver_code": 1
47
+ },
48
+ {
49
+ "id": "led",
50
+ "ver_code": 1
51
+ },
52
+ {
53
+ "id": "cloud_connect",
54
+ "ver_code": 1
55
+ },
56
+ {
57
+ "id": "iot_cloud",
58
+ "ver_code": 1
59
+ },
60
+ {
61
+ "id": "default_states",
62
+ "ver_code": 1
63
+ }
64
+ ]
65
+ },
66
+ "discovery_result": {
67
+ "device_id": "00000000000000000000000000000000",
68
+ "device_model": "P100",
69
+ "device_type": "SMART.TAPOPLUG",
70
+ "factory_default": false,
71
+ "ip": "127.0.0.123",
72
+ "is_support_iot_cloud": true,
73
+ "mac": "CC-32-E5-00-00-00",
74
+ "mgt_encrypt_schm": {
75
+ "encrypt_type": "AES",
76
+ "http_port": 80,
77
+ "is_support_https": false,
78
+ "lv": 2
79
+ },
80
+ "owner": "00000000000000000000000000000000"
81
+ },
82
+ "get_antitheft_rules": {
83
+ "antitheft_rule_max_count": 1,
84
+ "enable": false,
85
+ "rule_list": []
86
+ },
87
+ "get_connect_cloud_state": {
88
+ "status": 0
89
+ },
90
+ "get_countdown_rules": {
91
+ "countdown_rule_max_count": 1,
92
+ "enable": false,
93
+ "rule_list": []
94
+ },
95
+ "get_device_info": {
96
+ "avatar": "plug",
97
+ "default_states": {
98
+ "state": {},
99
+ "type": "last_states"
100
+ },
101
+ "device_id": "0000000000000000000000000000000000000000",
102
+ "device_on": false,
103
+ "fw_id": "00000000000000000000000000000000",
104
+ "fw_ver": "1.3.7 Build 20230711 Rel. 61904",
105
+ "has_set_location_info": true,
106
+ "hw_id": "00000000000000000000000000000000",
107
+ "hw_ver": "1.0.0",
108
+ "ip": "127.0.0.123",
109
+ "lang": "en_US",
110
+ "latitude": 0,
111
+ "location": "bedroom",
112
+ "longitude": 0,
113
+ "mac": "CC-32-E5-00-00-00",
114
+ "model": "P100",
115
+ "nickname": "I01BU0tFRF9OQU1FIw==",
116
+ "oem_id": "00000000000000000000000000000000",
117
+ "on_time": 0,
118
+ "overheated": false,
119
+ "region": "Pacific/Honolulu",
120
+ "rssi": -48,
121
+ "signal_level": 3,
122
+ "specs": "US",
123
+ "ssid": "I01BU0tFRF9TU0lEIw==",
124
+ "time_diff": -600,
125
+ "type": "SMART.TAPOPLUG"
126
+ },
127
+ "get_device_time": {
128
+ "region": "Pacific/Honolulu",
129
+ "time_diff": -600,
130
+ "timestamp": 1705995478
131
+ },
132
+ "get_device_usage": {
133
+ "time_usage": {
134
+ "past30": 0,
135
+ "past7": 0,
136
+ "today": 0
137
+ }
138
+ },
139
+ "get_fw_download_state": {
140
+ "download_progress": 0,
141
+ "reboot_time": 10,
142
+ "status": 0,
143
+ "upgrade_time": 0
144
+ },
145
+ "get_latest_fw": {
146
+ "fw_size": 0,
147
+ "fw_ver": "1.3.7 Build 20230711 Rel. 61904",
148
+ "hw_id": "",
149
+ "need_to_upgrade": false,
150
+ "oem_id": "",
151
+ "release_date": "",
152
+ "release_note": "",
153
+ "type": 0
154
+ },
155
+ "get_led_info": {
156
+ "led_rule": "always",
157
+ "led_status": false
158
+ },
159
+ "get_next_event": {
160
+ "action": -1,
161
+ "e_time": 0,
162
+ "id": "0",
163
+ "s_time": 0,
164
+ "type": 0
165
+ },
166
+ "get_schedule_rules": {
167
+ "enable": false,
168
+ "rule_list": [],
169
+ "schedule_rule_max_count": 20,
170
+ "start_index": 0,
171
+ "sum": 0
172
+ },
173
+ "qs_component_nego": {
174
+ "component_list": [
175
+ {
176
+ "id": "quick_setup",
177
+ "ver_code": 3
178
+ },
179
+ {
180
+ "id": "ble_whole_setup",
181
+ "ver_code": 1
182
+ },
183
+ {
184
+ "id": "iot_cloud",
185
+ "ver_code": 1
186
+ },
187
+ {
188
+ "id": "sunrise_sunset",
189
+ "ver_code": 1
190
+ }
191
+ ],
192
+ "extra_info": {
193
+ "device_model": "P100",
194
+ "device_type": "SMART.TAPOPLUG"
195
+ }
196
+ }
197
+ }