python-kasa 0.7.0.dev1__py3-none-any.whl → 0.7.0.dev3__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 (47) hide show
  1. kasa/__init__.py +16 -9
  2. kasa/aestransport.py +3 -4
  3. kasa/cli.py +13 -11
  4. kasa/device.py +26 -3
  5. kasa/deviceconfig.py +45 -20
  6. kasa/discover.py +106 -46
  7. kasa/feature.py +2 -1
  8. kasa/httpclient.py +24 -0
  9. kasa/iot/iotdevice.py +1 -1
  10. kasa/iot/iotlightstrip.py +3 -2
  11. kasa/iot/iotplug.py +1 -1
  12. kasa/iot/iotstrip.py +30 -1
  13. kasa/iot/modules/lighteffect.py +13 -7
  14. kasa/iot/modules/lightpreset.py +6 -1
  15. kasa/smart/modules/autooff.py +13 -8
  16. kasa/smart/modules/fan.py +3 -2
  17. kasa/smartprotocol.py +3 -1
  18. kasa/tests/device_fixtures.py +10 -1
  19. kasa/tests/discovery_fixtures.py +82 -29
  20. kasa/tests/fakeprotocol_iot.py +36 -7
  21. kasa/tests/fixtures/HS110(EU)_1.0_1.2.5.json +1 -1
  22. kasa/tests/fixtures/HS110(US)_1.0_1.2.6.json +37 -0
  23. kasa/tests/fixtures/HS220(US)_1.0_1.5.7.json +1 -1
  24. kasa/tests/fixtures/HS220(US)_2.0_1.0.3.json +1 -1
  25. kasa/tests/fixtures/HS300(US)_1.0_1.0.21.json +89 -0
  26. kasa/tests/fixtures/KL120(US)_1.0_1.8.11.json +85 -0
  27. kasa/tests/fixtures/KL430(US)_1.0_1.0.10.json +51 -12
  28. kasa/tests/fixtures/KP303(UK)_1.0_1.0.3.json +1 -1
  29. kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.6.json +1 -1
  30. kasa/tests/fixtures/smart/P115(EU)_1.0_1.2.3.json +386 -0
  31. kasa/tests/fixtures/smart/S505D(US)_1.0_1.1.0.json +262 -0
  32. kasa/tests/smart/modules/test_autooff.py +103 -0
  33. kasa/tests/smart/modules/test_fan.py +5 -0
  34. kasa/tests/test_aestransport.py +90 -2
  35. kasa/tests/test_bulb.py +9 -4
  36. kasa/tests/test_common_modules.py +1 -1
  37. kasa/tests/test_device.py +28 -6
  38. kasa/tests/test_device_factory.py +8 -8
  39. kasa/tests/test_discovery.py +61 -4
  40. kasa/tests/test_readme_examples.py +37 -22
  41. kasa/tests/test_smartprotocol.py +3 -2
  42. kasa/tests/test_strip.py +8 -0
  43. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/METADATA +4 -4
  44. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/RECORD +47 -41
  45. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/LICENSE +0 -0
  46. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/WHEEL +0 -0
  47. {python_kasa-0.7.0.dev1.dist-info → python_kasa-0.7.0.dev3.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,85 @@
1
+ {
2
+ "smartlife.iot.common.emeter": {
3
+ "get_realtime": {
4
+ "err_code": 0,
5
+ "power_mw": 7800
6
+ }
7
+ },
8
+ "smartlife.iot.smartbulb.lightingservice": {
9
+ "get_light_state": {
10
+ "brightness": 70,
11
+ "color_temp": 3001,
12
+ "err_code": 0,
13
+ "hue": 0,
14
+ "mode": "normal",
15
+ "on_off": 1,
16
+ "saturation": 0
17
+ }
18
+ },
19
+ "system": {
20
+ "get_sysinfo": {
21
+ "active_mode": "none",
22
+ "alias": "Home Family Room Table",
23
+ "ctrl_protocols": {
24
+ "name": "Linkie",
25
+ "version": "1.0"
26
+ },
27
+ "description": "Smart Wi-Fi LED Bulb with Tunable White Light",
28
+ "dev_state": "normal",
29
+ "deviceId": "0000000000000000000000000000000000000000",
30
+ "disco_ver": "1.0",
31
+ "err_code": 0,
32
+ "heapsize": 292140,
33
+ "hwId": "00000000000000000000000000000000",
34
+ "hw_ver": "1.0",
35
+ "is_color": 0,
36
+ "is_dimmable": 1,
37
+ "is_factory": false,
38
+ "is_variable_color_temp": 1,
39
+ "light_state": {
40
+ "brightness": 70,
41
+ "color_temp": 3001,
42
+ "hue": 0,
43
+ "mode": "normal",
44
+ "on_off": 1,
45
+ "saturation": 0
46
+ },
47
+ "mic_mac": "000000000000",
48
+ "mic_type": "IOT.SMARTBULB",
49
+ "model": "KL120(US)",
50
+ "oemId": "00000000000000000000000000000000",
51
+ "preferred_state": [
52
+ {
53
+ "brightness": 100,
54
+ "color_temp": 3500,
55
+ "hue": 0,
56
+ "index": 0,
57
+ "saturation": 0
58
+ },
59
+ {
60
+ "brightness": 50,
61
+ "color_temp": 5000,
62
+ "hue": 0,
63
+ "index": 1,
64
+ "saturation": 0
65
+ },
66
+ {
67
+ "brightness": 50,
68
+ "color_temp": 2700,
69
+ "hue": 0,
70
+ "index": 2,
71
+ "saturation": 0
72
+ },
73
+ {
74
+ "brightness": 1,
75
+ "color_temp": 2700,
76
+ "hue": 0,
77
+ "index": 3,
78
+ "saturation": 0
79
+ }
80
+ ],
81
+ "rssi": -45,
82
+ "sw_ver": "1.8.11 Build 191113 Rel.105336"
83
+ }
84
+ }
85
+ }
@@ -7,8 +7,8 @@
7
7
  "get_realtime": {
8
8
  "current_ma": 0,
9
9
  "err_code": 0,
10
- "power_mw": 8729,
11
- "total_wh": 21,
10
+ "power_mw": 2725,
11
+ "total_wh": 1193,
12
12
  "voltage_mv": 0
13
13
  }
14
14
  },
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "system": {
24
24
  "get_sysinfo": {
25
- "active_mode": "none",
26
- "alias": "KL430 pantry lightstrip",
25
+ "active_mode": "schedule",
26
+ "alias": "Bedroom Lightstrip",
27
27
  "ctrl_protocols": {
28
28
  "name": "Linkie",
29
29
  "version": "1.0"
@@ -42,27 +42,66 @@
42
42
  "latitude_i": 0,
43
43
  "length": 16,
44
44
  "light_state": {
45
- "brightness": 50,
46
- "color_temp": 3630,
45
+ "brightness": 15,
46
+ "color_temp": 2500,
47
47
  "hue": 0,
48
48
  "mode": "normal",
49
49
  "on_off": 1,
50
50
  "saturation": 0
51
51
  },
52
52
  "lighting_effect_state": {
53
- "brightness": 50,
53
+ "brightness": 100,
54
54
  "custom": 0,
55
55
  "enable": 0,
56
- "id": "",
57
- "name": ""
56
+ "id": "bCTItKETDFfrKANolgldxfgOakaarARs",
57
+ "name": "Flicker"
58
58
  },
59
59
  "longitude_i": 0,
60
- "mic_mac": "CC32E5230F55",
60
+ "mic_mac": "CC32E5000000",
61
61
  "mic_type": "IOT.SMARTBULB",
62
62
  "model": "KL430(US)",
63
63
  "oemId": "00000000000000000000000000000000",
64
- "preferred_state": [],
65
- "rssi": -56,
64
+ "preferred_state": [
65
+ {
66
+ "brightness": 100,
67
+ "custom": 0,
68
+ "id": "QglBhMShPHUAuxLqzNEefFrGiJwahOmz",
69
+ "index": 0,
70
+ "mode": 2
71
+ },
72
+ {
73
+ "brightness": 100,
74
+ "custom": 0,
75
+ "id": "bCTItKETDFfrKANolgldxfgOakaarARs",
76
+ "index": 1,
77
+ "mode": 2
78
+ },
79
+ {
80
+ "brightness": 34,
81
+ "color_temp": 0,
82
+ "hue": 7,
83
+ "index": 2,
84
+ "mode": 1,
85
+ "saturation": 49
86
+ },
87
+ {
88
+ "brightness": 25,
89
+ "color_temp": 0,
90
+ "hue": 4,
91
+ "index": 3,
92
+ "mode": 1,
93
+ "saturation": 100
94
+ },
95
+ {
96
+ "brightness": 15,
97
+ "color_temp": 2500,
98
+ "hue": 0,
99
+ "index": 4,
100
+ "mode": 1,
101
+ "saturation": 0
102
+ }
103
+ ],
104
+ "rssi": -44,
66
105
  "status": "new",
67
106
  "sw_ver": "1.0.10 Build 200522 Rel.104340"
68
107
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "system": {
3
3
  "get_sysinfo": {
4
- "alias": "TP-LINK_Power Strip_CF69",
4
+ "alias": "Bedroom Power Strip",
5
5
  "child_num": 3,
6
6
  "children": [
7
7
  {
@@ -175,7 +175,7 @@
175
175
  "longitude": 0,
176
176
  "mac": "5C-E9-31-00-00-00",
177
177
  "model": "L530",
178
- "nickname": "TGl2aW5nIFJvb20=",
178
+ "nickname": "TGl2aW5nIFJvb20gQnVsYg==",
179
179
  "oem_id": "00000000000000000000000000000000",
180
180
  "overheated": false,
181
181
  "region": "Europe/Berlin",
@@ -0,0 +1,386 @@
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": "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": "device_local_time",
62
+ "ver_code": 1
63
+ },
64
+ {
65
+ "id": "default_states",
66
+ "ver_code": 1
67
+ },
68
+ {
69
+ "id": "auto_off",
70
+ "ver_code": 2
71
+ },
72
+ {
73
+ "id": "energy_monitoring",
74
+ "ver_code": 2
75
+ },
76
+ {
77
+ "id": "power_protection",
78
+ "ver_code": 1
79
+ }
80
+ ]
81
+ },
82
+ "discovery_result": {
83
+ "device_id": "00000000000000000000000000000000",
84
+ "device_model": "P115(EU)",
85
+ "device_type": "SMART.TAPOPLUG",
86
+ "factory_default": true,
87
+ "ip": "127.0.0.123",
88
+ "is_support_iot_cloud": true,
89
+ "mac": "A8-42-A1-00-00-00",
90
+ "mgt_encrypt_schm": {
91
+ "encrypt_type": "AES",
92
+ "http_port": 80,
93
+ "is_support_https": false,
94
+ "lv": 2
95
+ },
96
+ "obd_src": "tplink",
97
+ "owner": ""
98
+ },
99
+ "get_antitheft_rules": {
100
+ "antitheft_rule_max_count": 1,
101
+ "enable": false,
102
+ "rule_list": []
103
+ },
104
+ "get_auto_off_config": {
105
+ "delay_min": 120,
106
+ "enable": false
107
+ },
108
+ "get_auto_update_info": {
109
+ "enable": true,
110
+ "random_range": 120,
111
+ "time": 180
112
+ },
113
+ "get_connect_cloud_state": {
114
+ "status": 1
115
+ },
116
+ "get_countdown_rules": {
117
+ "countdown_rule_max_count": 1,
118
+ "enable": false,
119
+ "rule_list": []
120
+ },
121
+ "get_current_power": {
122
+ "current_power": 9
123
+ },
124
+ "get_device_info": {
125
+ "auto_off_remain_time": 0,
126
+ "auto_off_status": "off",
127
+ "avatar": "",
128
+ "default_states": {
129
+ "state": {},
130
+ "type": "last_states"
131
+ },
132
+ "device_id": "0000000000000000000000000000000000000000",
133
+ "device_on": true,
134
+ "fw_id": "00000000000000000000000000000000",
135
+ "fw_ver": "1.2.3 Build 230425 Rel.142542",
136
+ "has_set_location_info": false,
137
+ "hw_id": "00000000000000000000000000000000",
138
+ "hw_ver": "1.0",
139
+ "ip": "127.0.0.123",
140
+ "lang": "",
141
+ "latitude": 0,
142
+ "longitude": 0,
143
+ "mac": "A8-42-A1-00-00-00",
144
+ "model": "P115",
145
+ "nickname": "I01BU0tFRF9OQU1FIw==",
146
+ "oem_id": "00000000000000000000000000000000",
147
+ "on_time": 1621,
148
+ "overheated": false,
149
+ "power_protection_status": "normal",
150
+ "region": "UTC",
151
+ "rssi": -45,
152
+ "signal_level": 3,
153
+ "specs": "",
154
+ "ssid": "I01BU0tFRF9TU0lEIw==",
155
+ "time_diff": 0,
156
+ "type": "SMART.TAPOPLUG"
157
+ },
158
+ "get_device_time": {
159
+ "region": "UTC",
160
+ "time_diff": 0,
161
+ "timestamp": 1717512486
162
+ },
163
+ "get_device_usage": {
164
+ "power_usage": {
165
+ "past30": 0,
166
+ "past7": 0,
167
+ "today": 0
168
+ },
169
+ "saved_power": {
170
+ "past30": 6,
171
+ "past7": 6,
172
+ "today": 6
173
+ },
174
+ "time_usage": {
175
+ "past30": 6,
176
+ "past7": 6,
177
+ "today": 6
178
+ }
179
+ },
180
+ "get_electricity_price_config": {
181
+ "constant_price": 0,
182
+ "time_of_use_config": {
183
+ "summer": {
184
+ "midpeak": 0,
185
+ "offpeak": 0,
186
+ "onpeak": 0,
187
+ "period": [
188
+ 0,
189
+ 0,
190
+ 0,
191
+ 0
192
+ ],
193
+ "weekday_config": [
194
+ 1,
195
+ 1,
196
+ 1,
197
+ 1,
198
+ 1,
199
+ 1,
200
+ 1,
201
+ 1,
202
+ 1,
203
+ 1,
204
+ 1,
205
+ 1,
206
+ 1,
207
+ 1,
208
+ 1,
209
+ 1,
210
+ 1,
211
+ 1,
212
+ 1,
213
+ 1,
214
+ 1,
215
+ 1,
216
+ 1,
217
+ 1
218
+ ],
219
+ "weekend_config": [
220
+ 1,
221
+ 1,
222
+ 1,
223
+ 1,
224
+ 1,
225
+ 1,
226
+ 1,
227
+ 1,
228
+ 1,
229
+ 1,
230
+ 1,
231
+ 1,
232
+ 1,
233
+ 1,
234
+ 1,
235
+ 1,
236
+ 1,
237
+ 1,
238
+ 1,
239
+ 1,
240
+ 1,
241
+ 1,
242
+ 1,
243
+ 1
244
+ ]
245
+ },
246
+ "winter": {
247
+ "midpeak": 0,
248
+ "offpeak": 0,
249
+ "onpeak": 0,
250
+ "period": [
251
+ 0,
252
+ 0,
253
+ 0,
254
+ 0
255
+ ],
256
+ "weekday_config": [
257
+ 1,
258
+ 1,
259
+ 1,
260
+ 1,
261
+ 1,
262
+ 1,
263
+ 1,
264
+ 1,
265
+ 1,
266
+ 1,
267
+ 1,
268
+ 1,
269
+ 1,
270
+ 1,
271
+ 1,
272
+ 1,
273
+ 1,
274
+ 1,
275
+ 1,
276
+ 1,
277
+ 1,
278
+ 1,
279
+ 1,
280
+ 1
281
+ ],
282
+ "weekend_config": [
283
+ 1,
284
+ 1,
285
+ 1,
286
+ 1,
287
+ 1,
288
+ 1,
289
+ 1,
290
+ 1,
291
+ 1,
292
+ 1,
293
+ 1,
294
+ 1,
295
+ 1,
296
+ 1,
297
+ 1,
298
+ 1,
299
+ 1,
300
+ 1,
301
+ 1,
302
+ 1,
303
+ 1,
304
+ 1,
305
+ 1,
306
+ 1
307
+ ]
308
+ }
309
+ },
310
+ "type": "constant"
311
+ },
312
+ "get_energy_usage": {
313
+ "current_power": 8962,
314
+ "electricity_charge": [
315
+ 0,
316
+ 0,
317
+ 0
318
+ ],
319
+ "local_time": "2024-06-04 14:48:06",
320
+ "month_energy": 0,
321
+ "month_runtime": 6,
322
+ "today_energy": 0,
323
+ "today_runtime": 6
324
+ },
325
+ "get_fw_download_state": {
326
+ "auto_upgrade": false,
327
+ "download_progress": 0,
328
+ "reboot_time": 5,
329
+ "status": 0,
330
+ "upgrade_time": 5
331
+ },
332
+ "get_led_info": {
333
+ "led_rule": "always",
334
+ "led_status": true,
335
+ "night_mode": {
336
+ "end_time": 420,
337
+ "night_mode_type": "sunrise_sunset",
338
+ "start_time": 1140,
339
+ "sunrise_offset": 0,
340
+ "sunset_offset": 0
341
+ }
342
+ },
343
+ "get_max_power": {
344
+ "max_power": 3895
345
+ },
346
+ "get_next_event": {},
347
+ "get_protection_power": {
348
+ "enabled": false,
349
+ "protection_power": 0
350
+ },
351
+ "get_schedule_rules": {
352
+ "enable": false,
353
+ "rule_list": [],
354
+ "schedule_rule_max_count": 32,
355
+ "start_index": 0,
356
+ "sum": 0
357
+ },
358
+ "qs_component_nego": {
359
+ "component_list": [
360
+ {
361
+ "id": "quick_setup",
362
+ "ver_code": 3
363
+ },
364
+ {
365
+ "id": "sunrise_sunset",
366
+ "ver_code": 1
367
+ },
368
+ {
369
+ "id": "iot_cloud",
370
+ "ver_code": 1
371
+ },
372
+ {
373
+ "id": "inherit",
374
+ "ver_code": 1
375
+ },
376
+ {
377
+ "id": "firmware",
378
+ "ver_code": 2
379
+ }
380
+ ],
381
+ "extra_info": {
382
+ "device_model": "P115",
383
+ "device_type": "SMART.TAPOPLUG"
384
+ }
385
+ }
386
+ }