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