python-kasa 0.6.2__py3-none-any.whl → 0.7.0.dev0__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.
- kasa/__init__.py +88 -27
- kasa/aestransport.py +51 -34
- kasa/cli.py +326 -130
- kasa/device.py +406 -0
- kasa/device_factory.py +83 -44
- kasa/device_type.py +7 -3
- kasa/deviceconfig.py +16 -9
- kasa/discover.py +100 -81
- kasa/emeterstatus.py +12 -7
- kasa/exceptions.py +41 -26
- kasa/feature.py +201 -0
- kasa/httpclient.py +21 -14
- kasa/interfaces/__init__.py +16 -0
- kasa/interfaces/fan.py +20 -0
- kasa/interfaces/led.py +38 -0
- kasa/interfaces/light.py +133 -0
- kasa/interfaces/lighteffect.py +80 -0
- kasa/interfaces/lightpreset.py +76 -0
- kasa/iot/__init__.py +18 -0
- kasa/{effects.py → iot/effects.py} +4 -2
- kasa/{smartbulb.py → iot/iotbulb.py} +100 -147
- kasa/{smartdevice.py → iot/iotdevice.py} +157 -286
- kasa/{smartdimmer.py → iot/iotdimmer.py} +42 -33
- kasa/iot/iotlightstrip.py +71 -0
- kasa/{modules/module.py → iot/iotmodule.py} +22 -42
- kasa/iot/iotplug.py +94 -0
- kasa/{smartstrip.py → iot/iotstrip.py} +57 -75
- kasa/{modules → iot/modules}/__init__.py +10 -2
- kasa/{modules → iot/modules}/ambientlight.py +31 -3
- kasa/{modules → iot/modules}/antitheft.py +1 -0
- kasa/{modules → iot/modules}/cloud.py +25 -6
- kasa/{modules → iot/modules}/countdown.py +1 -0
- kasa/iot/modules/emeter.py +210 -0
- kasa/iot/modules/led.py +32 -0
- kasa/iot/modules/light.py +221 -0
- kasa/iot/modules/lighteffect.py +122 -0
- kasa/iot/modules/lightpreset.py +151 -0
- kasa/{modules → iot/modules}/motion.py +8 -8
- kasa/{modules → iot/modules}/rulemodule.py +11 -12
- kasa/{modules → iot/modules}/schedule.py +1 -0
- kasa/{modules → iot/modules}/time.py +5 -4
- kasa/{modules → iot/modules}/usage.py +10 -8
- kasa/iotprotocol.py +22 -20
- kasa/klaptransport.py +25 -15
- kasa/module.py +136 -0
- kasa/modulemapping.py +25 -0
- kasa/modulemapping.pyi +96 -0
- kasa/protocol.py +6 -4
- kasa/smart/__init__.py +6 -0
- kasa/smart/effects.py +429 -0
- kasa/smart/modules/__init__.py +57 -0
- kasa/smart/modules/alarm.py +142 -0
- kasa/smart/modules/autooff.py +96 -0
- kasa/smart/modules/batterysensor.py +54 -0
- kasa/smart/modules/brightness.py +66 -0
- kasa/smart/modules/childdevice.py +10 -0
- kasa/smart/modules/cloud.py +42 -0
- kasa/smart/modules/color.py +96 -0
- kasa/smart/modules/colortemperature.py +78 -0
- kasa/smart/modules/contactsensor.py +42 -0
- kasa/smart/modules/devicemodule.py +22 -0
- kasa/smart/modules/energy.py +101 -0
- kasa/smart/modules/fan.py +80 -0
- kasa/smart/modules/firmware.py +216 -0
- kasa/smart/modules/frostprotection.py +59 -0
- kasa/smart/modules/humiditysensor.py +55 -0
- kasa/smart/modules/led.py +49 -0
- kasa/smart/modules/light.py +139 -0
- kasa/smart/modules/lighteffect.py +115 -0
- kasa/smart/modules/lightpreset.py +142 -0
- kasa/smart/modules/lightstripeffect.py +135 -0
- kasa/smart/modules/lighttransition.py +183 -0
- kasa/smart/modules/reportmode.py +36 -0
- kasa/smart/modules/temperaturecontrol.py +177 -0
- kasa/smart/modules/temperaturesensor.py +77 -0
- kasa/smart/modules/time.py +57 -0
- kasa/smart/modules/waterleaksensor.py +66 -0
- kasa/smart/smartchilddevice.py +65 -0
- kasa/smart/smartdevice.py +653 -0
- kasa/smart/smartmodule.py +112 -0
- kasa/smartprotocol.py +107 -41
- kasa/tests/conftest.py +27 -551
- kasa/tests/device_fixtures.py +427 -0
- kasa/tests/discovery_fixtures.py +197 -0
- kasa/tests/{newfakes.py → fakeprotocol_iot.py} +61 -291
- kasa/tests/fakeprotocol_smart.py +318 -0
- kasa/tests/fixtureinfo.py +154 -0
- kasa/tests/fixtures/smart/H100(EU)_1.0_1.2.3.json +221 -0
- kasa/tests/fixtures/smart/H100(EU)_1.0_1.5.10.json +547 -0
- kasa/tests/fixtures/smart/H100(EU)_1.0_1.5.5.json +391 -0
- kasa/tests/fixtures/smart/KH100(UK)_1.0_1.5.6.json +1557 -0
- kasa/tests/fixtures/smart/KS240(US)_1.0_1.0.4.json +899 -0
- kasa/tests/fixtures/smart/KS240(US)_1.0_1.0.5.json +479 -0
- kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.6.json +449 -0
- kasa/tests/fixtures/smart/P100_1.0.0_1.1.3.json +173 -0
- kasa/tests/fixtures/smart/P100_1.0.0_1.4.0.json +204 -0
- kasa/tests/fixtures/smart/P110(EU)_1.0_1.0.7.json +566 -0
- kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.13.json +13 -23
- kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.7.json +6 -6
- kasa/tests/fixtures/smart/TP15(US)_1.0_1.0.3.json +295 -0
- kasa/tests/fixtures/smart/TP25(US)_1.0_1.0.2.json +423 -0
- kasa/tests/fixtures/smart/child/KE100(EU)_1.0_2.4.0.json +170 -0
- kasa/tests/fixtures/smart/child/KE100(EU)_1.0_2.8.0.json +171 -0
- kasa/tests/fixtures/smart/child/KE100(UK)_1.0_2.8.0.json +171 -0
- kasa/tests/fixtures/smart/child/T110(EU)_1.0_1.8.0.json +526 -0
- kasa/tests/fixtures/smart/child/T300(EU)_1.0_1.7.0.json +533 -0
- kasa/tests/fixtures/smart/child/T310(EU)_1.0_1.5.0.json +530 -0
- kasa/tests/fixtures/smart/child/T315(EU)_1.0_1.7.0.json +537 -0
- kasa/tests/smart/__init__.py +0 -0
- kasa/tests/smart/features/__init__.py +0 -0
- kasa/tests/smart/features/test_brightness.py +55 -0
- kasa/tests/smart/features/test_colortemp.py +30 -0
- kasa/tests/smart/modules/__init__.py +0 -0
- kasa/tests/smart/modules/test_contact.py +28 -0
- kasa/tests/smart/modules/test_fan.py +79 -0
- kasa/tests/smart/modules/test_firmware.py +108 -0
- kasa/tests/smart/modules/test_humidity.py +28 -0
- kasa/tests/smart/modules/test_light_effect.py +41 -0
- kasa/tests/smart/modules/test_temperature.py +47 -0
- kasa/tests/smart/modules/test_temperaturecontrol.py +137 -0
- kasa/tests/smart/modules/test_waterleak.py +42 -0
- kasa/tests/test_aestransport.py +115 -25
- kasa/tests/test_bulb.py +169 -86
- kasa/tests/test_childdevice.py +84 -0
- kasa/tests/test_cli.py +452 -100
- kasa/tests/test_common_modules.py +216 -0
- kasa/tests/test_device.py +268 -0
- kasa/tests/test_device_factory.py +61 -41
- kasa/tests/test_device_type.py +1 -1
- kasa/tests/test_deviceconfig.py +2 -5
- kasa/tests/test_dimmer.py +33 -24
- kasa/tests/test_discovery.py +112 -69
- kasa/tests/test_emeter.py +39 -12
- kasa/tests/test_feature.py +205 -0
- kasa/tests/test_httpclient.py +9 -9
- kasa/tests/test_iotdevice.py +286 -0
- kasa/tests/test_klapprotocol.py +94 -41
- kasa/tests/test_lightstrip.py +24 -19
- kasa/tests/test_plug.py +51 -9
- kasa/tests/test_protocol.py +8 -12
- kasa/tests/test_readme_examples.py +86 -27
- kasa/tests/test_smartdevice.py +211 -247
- kasa/tests/test_smartprotocol.py +129 -26
- kasa/tests/test_strip.py +15 -6
- kasa/tests/test_usage.py +1 -3
- kasa/xortransport.py +15 -12
- {python_kasa-0.6.2.dist-info → python_kasa-0.7.0.dev0.dist-info}/METADATA +45 -141
- python_kasa-0.7.0.dev0.dist-info/RECORD +239 -0
- {python_kasa-0.6.2.dist-info → python_kasa-0.7.0.dev0.dist-info}/WHEEL +1 -1
- kasa/modules/emeter.py +0 -111
- kasa/smartlightstrip.py +0 -143
- kasa/smartplug.py +0 -91
- kasa/tapo/__init__.py +0 -7
- kasa/tapo/childdevice.py +0 -44
- kasa/tapo/tapobulb.py +0 -262
- kasa/tapo/tapodevice.py +0 -383
- kasa/tapo/tapoplug.py +0 -45
- kasa/tests/fixtures/HS105(US)_1.0_mocked.json +0 -47
- kasa/tests/fixtures/HS110(EU)_2.0_mocked.json +0 -50
- kasa/tests/fixtures/HS110(US)_1.0_mocked.json +0 -50
- kasa/tests/fixtures/HS200(US)_1.0_mocked.json +0 -47
- kasa/tests/fixtures/HS220(US)_1.0_mocked.json +0 -75
- kasa/tests/fixtures/LB100(US)_1.0_mocked.json +0 -103
- kasa/tests/fixtures/LB120(US)_1.0_mocked.json +0 -103
- kasa/tests/fixtures/LB130(US)_1.0_mocked.json +0 -104
- python_kasa-0.6.2.dist-info/RECORD +0 -163
- {python_kasa-0.6.2.dist-info → python_kasa-0.7.0.dev0.dist-info}/LICENSE +0 -0
- {python_kasa-0.6.2.dist-info → python_kasa-0.7.0.dev0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
{
|
|
2
|
+
"component_nego" : {
|
|
3
|
+
"component_list" : [
|
|
4
|
+
{
|
|
5
|
+
"id" : "device",
|
|
6
|
+
"ver_code" : 2
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id" : "quick_setup",
|
|
10
|
+
"ver_code" : 3
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id" : "trigger_log",
|
|
14
|
+
"ver_code" : 1
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id" : "time",
|
|
18
|
+
"ver_code" : 1
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id" : "device_local_time",
|
|
22
|
+
"ver_code" : 1
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id" : "account",
|
|
26
|
+
"ver_code" : 1
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id" : "synchronize",
|
|
30
|
+
"ver_code" : 1
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id" : "cloud_connect",
|
|
34
|
+
"ver_code" : 1
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id" : "iot_cloud",
|
|
38
|
+
"ver_code" : 1
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id" : "firmware",
|
|
42
|
+
"ver_code" : 1
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id" : "localSmart",
|
|
46
|
+
"ver_code" : 1
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id" : "battery_detect",
|
|
50
|
+
"ver_code" : 1
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id" : "temperature",
|
|
54
|
+
"ver_code" : 1
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id" : "humidity",
|
|
58
|
+
"ver_code" : 1
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id" : "temp_humidity_record",
|
|
62
|
+
"ver_code" : 1
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id" : "comfort_temperature",
|
|
66
|
+
"ver_code" : 1
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id" : "comfort_humidity",
|
|
70
|
+
"ver_code" : 1
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id" : "report_mode",
|
|
74
|
+
"ver_code" : 1
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"get_connect_cloud_state" : {
|
|
79
|
+
"status" : 0
|
|
80
|
+
},
|
|
81
|
+
"get_device_info" : {
|
|
82
|
+
"at_low_battery" : false,
|
|
83
|
+
"avatar" : "",
|
|
84
|
+
"battery_percentage" : 100,
|
|
85
|
+
"bind_count" : 1,
|
|
86
|
+
"category" : "subg.trigger.temp-hmdt-sensor",
|
|
87
|
+
"current_humidity" : 61,
|
|
88
|
+
"current_humidity_exception" : 1,
|
|
89
|
+
"current_temp" : 21.4,
|
|
90
|
+
"current_temp_exception" : 0,
|
|
91
|
+
"device_id" : "SCRUBBED_CHILD_DEVICE_ID_1",
|
|
92
|
+
"fw_ver" : "1.7.0 Build 230424 Rel.170332",
|
|
93
|
+
"hw_id" : "00000000000000000000000000000000",
|
|
94
|
+
"hw_ver" : "1.0",
|
|
95
|
+
"jamming_rssi" : -122,
|
|
96
|
+
"jamming_signal_level" : 1,
|
|
97
|
+
"lastOnboardingTimestamp" : 1706990901,
|
|
98
|
+
"mac" : "F0A731000000",
|
|
99
|
+
"model" : "T315",
|
|
100
|
+
"nickname" : "I01BU0tFRF9OQU1FIw==",
|
|
101
|
+
"oem_id" : "00000000000000000000000000000000",
|
|
102
|
+
"parent_device_id" : "0000000000000000000000000000000000000000",
|
|
103
|
+
"region" : "Europe/Berlin",
|
|
104
|
+
"report_interval" : 16,
|
|
105
|
+
"rssi" : -56,
|
|
106
|
+
"signal_level" : 3,
|
|
107
|
+
"specs" : "EU",
|
|
108
|
+
"status" : "online",
|
|
109
|
+
"status_follow_edge" : false,
|
|
110
|
+
"temp_unit" : "celsius",
|
|
111
|
+
"type" : "SMART.TAPOSENSOR"
|
|
112
|
+
},
|
|
113
|
+
"get_fw_download_state" : {
|
|
114
|
+
"cloud_cache_seconds" : 1,
|
|
115
|
+
"download_progress" : 0,
|
|
116
|
+
"reboot_time" : 5,
|
|
117
|
+
"status" : 0,
|
|
118
|
+
"upgrade_time" : 5
|
|
119
|
+
},
|
|
120
|
+
"get_latest_fw" : {
|
|
121
|
+
"fw_ver" : "1.8.0 Build 230921 Rel.091446",
|
|
122
|
+
"hw_id" : "00000000000000000000000000000000",
|
|
123
|
+
"need_to_upgrade" : true,
|
|
124
|
+
"oem_id" : "00000000000000000000000000000000",
|
|
125
|
+
"release_date" : "2023-12-01",
|
|
126
|
+
"release_note" : "Modifications and Bug Fixes:\nEnhance the stability of the sensor.",
|
|
127
|
+
"type" : 2
|
|
128
|
+
},
|
|
129
|
+
"get_temp_humidity_records" : {
|
|
130
|
+
"local_time" : 1709061516,
|
|
131
|
+
"past24h_humidity" : [
|
|
132
|
+
60,
|
|
133
|
+
60,
|
|
134
|
+
59,
|
|
135
|
+
59,
|
|
136
|
+
59,
|
|
137
|
+
59,
|
|
138
|
+
59,
|
|
139
|
+
59,
|
|
140
|
+
59,
|
|
141
|
+
59,
|
|
142
|
+
58,
|
|
143
|
+
59,
|
|
144
|
+
59,
|
|
145
|
+
58,
|
|
146
|
+
59,
|
|
147
|
+
59,
|
|
148
|
+
59,
|
|
149
|
+
60,
|
|
150
|
+
60,
|
|
151
|
+
60,
|
|
152
|
+
60,
|
|
153
|
+
60,
|
|
154
|
+
60,
|
|
155
|
+
60,
|
|
156
|
+
60,
|
|
157
|
+
60,
|
|
158
|
+
60,
|
|
159
|
+
60,
|
|
160
|
+
60,
|
|
161
|
+
60,
|
|
162
|
+
60,
|
|
163
|
+
60,
|
|
164
|
+
60,
|
|
165
|
+
60,
|
|
166
|
+
60,
|
|
167
|
+
60,
|
|
168
|
+
60,
|
|
169
|
+
60,
|
|
170
|
+
59,
|
|
171
|
+
59,
|
|
172
|
+
59,
|
|
173
|
+
59,
|
|
174
|
+
59,
|
|
175
|
+
59,
|
|
176
|
+
60,
|
|
177
|
+
60,
|
|
178
|
+
59,
|
|
179
|
+
59,
|
|
180
|
+
59,
|
|
181
|
+
59,
|
|
182
|
+
59,
|
|
183
|
+
59,
|
|
184
|
+
59,
|
|
185
|
+
59,
|
|
186
|
+
59,
|
|
187
|
+
59,
|
|
188
|
+
59,
|
|
189
|
+
59,
|
|
190
|
+
59,
|
|
191
|
+
59,
|
|
192
|
+
59,
|
|
193
|
+
59,
|
|
194
|
+
59,
|
|
195
|
+
59,
|
|
196
|
+
59,
|
|
197
|
+
59,
|
|
198
|
+
59,
|
|
199
|
+
60,
|
|
200
|
+
60,
|
|
201
|
+
60,
|
|
202
|
+
60,
|
|
203
|
+
60,
|
|
204
|
+
60,
|
|
205
|
+
60,
|
|
206
|
+
60,
|
|
207
|
+
60,
|
|
208
|
+
64,
|
|
209
|
+
56,
|
|
210
|
+
53,
|
|
211
|
+
55,
|
|
212
|
+
56,
|
|
213
|
+
57,
|
|
214
|
+
57,
|
|
215
|
+
58,
|
|
216
|
+
59,
|
|
217
|
+
63,
|
|
218
|
+
63,
|
|
219
|
+
62,
|
|
220
|
+
62,
|
|
221
|
+
62,
|
|
222
|
+
62,
|
|
223
|
+
61,
|
|
224
|
+
62,
|
|
225
|
+
62,
|
|
226
|
+
61,
|
|
227
|
+
61
|
|
228
|
+
],
|
|
229
|
+
"past24h_humidity_exception" : [
|
|
230
|
+
0,
|
|
231
|
+
0,
|
|
232
|
+
0,
|
|
233
|
+
0,
|
|
234
|
+
0,
|
|
235
|
+
0,
|
|
236
|
+
0,
|
|
237
|
+
0,
|
|
238
|
+
0,
|
|
239
|
+
0,
|
|
240
|
+
0,
|
|
241
|
+
0,
|
|
242
|
+
0,
|
|
243
|
+
0,
|
|
244
|
+
0,
|
|
245
|
+
0,
|
|
246
|
+
0,
|
|
247
|
+
0,
|
|
248
|
+
0,
|
|
249
|
+
0,
|
|
250
|
+
0,
|
|
251
|
+
0,
|
|
252
|
+
0,
|
|
253
|
+
0,
|
|
254
|
+
0,
|
|
255
|
+
0,
|
|
256
|
+
0,
|
|
257
|
+
0,
|
|
258
|
+
0,
|
|
259
|
+
0,
|
|
260
|
+
0,
|
|
261
|
+
0,
|
|
262
|
+
0,
|
|
263
|
+
0,
|
|
264
|
+
0,
|
|
265
|
+
0,
|
|
266
|
+
0,
|
|
267
|
+
0,
|
|
268
|
+
0,
|
|
269
|
+
0,
|
|
270
|
+
0,
|
|
271
|
+
0,
|
|
272
|
+
0,
|
|
273
|
+
0,
|
|
274
|
+
0,
|
|
275
|
+
0,
|
|
276
|
+
0,
|
|
277
|
+
0,
|
|
278
|
+
0,
|
|
279
|
+
0,
|
|
280
|
+
0,
|
|
281
|
+
0,
|
|
282
|
+
0,
|
|
283
|
+
0,
|
|
284
|
+
0,
|
|
285
|
+
0,
|
|
286
|
+
0,
|
|
287
|
+
0,
|
|
288
|
+
0,
|
|
289
|
+
0,
|
|
290
|
+
0,
|
|
291
|
+
0,
|
|
292
|
+
0,
|
|
293
|
+
0,
|
|
294
|
+
0,
|
|
295
|
+
0,
|
|
296
|
+
0,
|
|
297
|
+
0,
|
|
298
|
+
0,
|
|
299
|
+
0,
|
|
300
|
+
0,
|
|
301
|
+
0,
|
|
302
|
+
0,
|
|
303
|
+
0,
|
|
304
|
+
0,
|
|
305
|
+
0,
|
|
306
|
+
4,
|
|
307
|
+
0,
|
|
308
|
+
0,
|
|
309
|
+
0,
|
|
310
|
+
0,
|
|
311
|
+
0,
|
|
312
|
+
0,
|
|
313
|
+
0,
|
|
314
|
+
0,
|
|
315
|
+
3,
|
|
316
|
+
3,
|
|
317
|
+
2,
|
|
318
|
+
2,
|
|
319
|
+
2,
|
|
320
|
+
2,
|
|
321
|
+
1,
|
|
322
|
+
2,
|
|
323
|
+
2,
|
|
324
|
+
1,
|
|
325
|
+
1
|
|
326
|
+
],
|
|
327
|
+
"past24h_temp" : [
|
|
328
|
+
217,
|
|
329
|
+
216,
|
|
330
|
+
215,
|
|
331
|
+
214,
|
|
332
|
+
214,
|
|
333
|
+
214,
|
|
334
|
+
214,
|
|
335
|
+
214,
|
|
336
|
+
214,
|
|
337
|
+
213,
|
|
338
|
+
213,
|
|
339
|
+
213,
|
|
340
|
+
213,
|
|
341
|
+
213,
|
|
342
|
+
212,
|
|
343
|
+
212,
|
|
344
|
+
211,
|
|
345
|
+
211,
|
|
346
|
+
211,
|
|
347
|
+
211,
|
|
348
|
+
211,
|
|
349
|
+
211,
|
|
350
|
+
212,
|
|
351
|
+
212,
|
|
352
|
+
212,
|
|
353
|
+
211,
|
|
354
|
+
211,
|
|
355
|
+
211,
|
|
356
|
+
211,
|
|
357
|
+
212,
|
|
358
|
+
212,
|
|
359
|
+
212,
|
|
360
|
+
212,
|
|
361
|
+
212,
|
|
362
|
+
211,
|
|
363
|
+
211,
|
|
364
|
+
211,
|
|
365
|
+
212,
|
|
366
|
+
213,
|
|
367
|
+
214,
|
|
368
|
+
214,
|
|
369
|
+
214,
|
|
370
|
+
213,
|
|
371
|
+
212,
|
|
372
|
+
212,
|
|
373
|
+
212,
|
|
374
|
+
212,
|
|
375
|
+
212,
|
|
376
|
+
212,
|
|
377
|
+
212,
|
|
378
|
+
212,
|
|
379
|
+
212,
|
|
380
|
+
212,
|
|
381
|
+
213,
|
|
382
|
+
213,
|
|
383
|
+
213,
|
|
384
|
+
213,
|
|
385
|
+
213,
|
|
386
|
+
213,
|
|
387
|
+
213,
|
|
388
|
+
213,
|
|
389
|
+
213,
|
|
390
|
+
213,
|
|
391
|
+
214,
|
|
392
|
+
214,
|
|
393
|
+
215,
|
|
394
|
+
215,
|
|
395
|
+
215,
|
|
396
|
+
214,
|
|
397
|
+
215,
|
|
398
|
+
216,
|
|
399
|
+
216,
|
|
400
|
+
216,
|
|
401
|
+
216,
|
|
402
|
+
216,
|
|
403
|
+
216,
|
|
404
|
+
216,
|
|
405
|
+
205,
|
|
406
|
+
196,
|
|
407
|
+
210,
|
|
408
|
+
213,
|
|
409
|
+
213,
|
|
410
|
+
213,
|
|
411
|
+
213,
|
|
412
|
+
213,
|
|
413
|
+
214,
|
|
414
|
+
215,
|
|
415
|
+
214,
|
|
416
|
+
214,
|
|
417
|
+
213,
|
|
418
|
+
213,
|
|
419
|
+
214,
|
|
420
|
+
214,
|
|
421
|
+
214,
|
|
422
|
+
213,
|
|
423
|
+
213
|
|
424
|
+
],
|
|
425
|
+
"past24h_temp_exception" : [
|
|
426
|
+
0,
|
|
427
|
+
0,
|
|
428
|
+
0,
|
|
429
|
+
0,
|
|
430
|
+
0,
|
|
431
|
+
0,
|
|
432
|
+
0,
|
|
433
|
+
0,
|
|
434
|
+
0,
|
|
435
|
+
0,
|
|
436
|
+
0,
|
|
437
|
+
0,
|
|
438
|
+
0,
|
|
439
|
+
0,
|
|
440
|
+
0,
|
|
441
|
+
0,
|
|
442
|
+
0,
|
|
443
|
+
0,
|
|
444
|
+
0,
|
|
445
|
+
0,
|
|
446
|
+
0,
|
|
447
|
+
0,
|
|
448
|
+
0,
|
|
449
|
+
0,
|
|
450
|
+
0,
|
|
451
|
+
0,
|
|
452
|
+
0,
|
|
453
|
+
0,
|
|
454
|
+
0,
|
|
455
|
+
0,
|
|
456
|
+
0,
|
|
457
|
+
0,
|
|
458
|
+
0,
|
|
459
|
+
0,
|
|
460
|
+
0,
|
|
461
|
+
0,
|
|
462
|
+
0,
|
|
463
|
+
0,
|
|
464
|
+
0,
|
|
465
|
+
0,
|
|
466
|
+
0,
|
|
467
|
+
0,
|
|
468
|
+
0,
|
|
469
|
+
0,
|
|
470
|
+
0,
|
|
471
|
+
0,
|
|
472
|
+
0,
|
|
473
|
+
0,
|
|
474
|
+
0,
|
|
475
|
+
0,
|
|
476
|
+
0,
|
|
477
|
+
0,
|
|
478
|
+
0,
|
|
479
|
+
0,
|
|
480
|
+
0,
|
|
481
|
+
0,
|
|
482
|
+
0,
|
|
483
|
+
0,
|
|
484
|
+
0,
|
|
485
|
+
0,
|
|
486
|
+
0,
|
|
487
|
+
0,
|
|
488
|
+
0,
|
|
489
|
+
0,
|
|
490
|
+
0,
|
|
491
|
+
0,
|
|
492
|
+
0,
|
|
493
|
+
0,
|
|
494
|
+
0,
|
|
495
|
+
0,
|
|
496
|
+
0,
|
|
497
|
+
0,
|
|
498
|
+
0,
|
|
499
|
+
0,
|
|
500
|
+
0,
|
|
501
|
+
0,
|
|
502
|
+
0,
|
|
503
|
+
0,
|
|
504
|
+
-4,
|
|
505
|
+
0,
|
|
506
|
+
0,
|
|
507
|
+
0,
|
|
508
|
+
0,
|
|
509
|
+
0,
|
|
510
|
+
0,
|
|
511
|
+
0,
|
|
512
|
+
0,
|
|
513
|
+
0,
|
|
514
|
+
0,
|
|
515
|
+
0,
|
|
516
|
+
0,
|
|
517
|
+
0,
|
|
518
|
+
0,
|
|
519
|
+
0,
|
|
520
|
+
0,
|
|
521
|
+
0
|
|
522
|
+
],
|
|
523
|
+
"temp_unit" : "celsius"
|
|
524
|
+
},
|
|
525
|
+
"get_trigger_logs" : {
|
|
526
|
+
"logs" : [
|
|
527
|
+
{
|
|
528
|
+
"event" : "tooDry",
|
|
529
|
+
"eventId" : "118040a8-5422-1100-0804-0a8542211000",
|
|
530
|
+
"id" : 1,
|
|
531
|
+
"timestamp" : 1706996915
|
|
532
|
+
}
|
|
533
|
+
],
|
|
534
|
+
"start_id" : 1,
|
|
535
|
+
"sum" : 1
|
|
536
|
+
}
|
|
537
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from kasa.iot import IotDevice
|
|
4
|
+
from kasa.smart import SmartDevice
|
|
5
|
+
from kasa.tests.conftest import dimmable_iot, parametrize
|
|
6
|
+
|
|
7
|
+
brightness = parametrize("brightness smart", component_filter="brightness")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@brightness
|
|
11
|
+
async def test_brightness_component(dev: SmartDevice):
|
|
12
|
+
"""Test brightness feature."""
|
|
13
|
+
brightness = dev.modules.get("Brightness")
|
|
14
|
+
assert brightness
|
|
15
|
+
assert isinstance(dev, SmartDevice)
|
|
16
|
+
assert "brightness" in dev._components
|
|
17
|
+
|
|
18
|
+
# Test getting the value
|
|
19
|
+
feature = dev.features["brightness"]
|
|
20
|
+
assert isinstance(feature.value, int)
|
|
21
|
+
assert feature.value > 1 and feature.value <= 100
|
|
22
|
+
|
|
23
|
+
# Test setting the value
|
|
24
|
+
await feature.set_value(10)
|
|
25
|
+
await dev.update()
|
|
26
|
+
assert feature.value == 10
|
|
27
|
+
|
|
28
|
+
with pytest.raises(ValueError):
|
|
29
|
+
await feature.set_value(feature.minimum_value - 10)
|
|
30
|
+
|
|
31
|
+
with pytest.raises(ValueError):
|
|
32
|
+
await feature.set_value(feature.maximum_value + 10)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dimmable_iot
|
|
36
|
+
async def test_brightness_dimmable(dev: IotDevice):
|
|
37
|
+
"""Test brightness feature."""
|
|
38
|
+
assert isinstance(dev, IotDevice)
|
|
39
|
+
assert "brightness" in dev.sys_info or bool(dev.sys_info["is_dimmable"])
|
|
40
|
+
|
|
41
|
+
# Test getting the value
|
|
42
|
+
feature = dev.features["brightness"]
|
|
43
|
+
assert isinstance(feature.value, int)
|
|
44
|
+
assert feature.value > 0 and feature.value <= 100
|
|
45
|
+
|
|
46
|
+
# Test setting the value
|
|
47
|
+
await feature.set_value(10)
|
|
48
|
+
await dev.update()
|
|
49
|
+
assert feature.value == 10
|
|
50
|
+
|
|
51
|
+
with pytest.raises(ValueError):
|
|
52
|
+
await feature.set_value(feature.minimum_value - 10)
|
|
53
|
+
|
|
54
|
+
with pytest.raises(ValueError):
|
|
55
|
+
await feature.set_value(feature.maximum_value + 10)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from kasa.smart import SmartDevice
|
|
4
|
+
from kasa.tests.conftest import variable_temp_smart
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@variable_temp_smart
|
|
8
|
+
async def test_colortemp_component(dev: SmartDevice):
|
|
9
|
+
"""Test brightness feature."""
|
|
10
|
+
assert isinstance(dev, SmartDevice)
|
|
11
|
+
assert "color_temperature" in dev._components
|
|
12
|
+
|
|
13
|
+
# Test getting the value
|
|
14
|
+
feature = dev.features["color_temperature"]
|
|
15
|
+
assert isinstance(feature.value, int)
|
|
16
|
+
assert isinstance(feature.minimum_value, int)
|
|
17
|
+
assert isinstance(feature.maximum_value, int)
|
|
18
|
+
|
|
19
|
+
# Test setting the value
|
|
20
|
+
# We need to take the min here, as L9xx reports a range [9000, 9000].
|
|
21
|
+
new_value = min(feature.minimum_value + 1, feature.maximum_value)
|
|
22
|
+
await feature.set_value(new_value)
|
|
23
|
+
await dev.update()
|
|
24
|
+
assert feature.value == new_value
|
|
25
|
+
|
|
26
|
+
with pytest.raises(ValueError):
|
|
27
|
+
await feature.set_value(feature.minimum_value - 10)
|
|
28
|
+
|
|
29
|
+
with pytest.raises(ValueError):
|
|
30
|
+
await feature.set_value(feature.maximum_value + 10)
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from kasa import Module, SmartDevice
|
|
4
|
+
from kasa.tests.device_fixtures import parametrize
|
|
5
|
+
|
|
6
|
+
contact = parametrize(
|
|
7
|
+
"is contact sensor", model_filter="T110", protocol_filter={"SMART.CHILD"}
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@contact
|
|
12
|
+
@pytest.mark.parametrize(
|
|
13
|
+
"feature, type",
|
|
14
|
+
[
|
|
15
|
+
("is_open", bool),
|
|
16
|
+
],
|
|
17
|
+
)
|
|
18
|
+
async def test_contact_features(dev: SmartDevice, feature, type):
|
|
19
|
+
"""Test that features are registered and work as expected."""
|
|
20
|
+
contact = dev.modules.get(Module.ContactSensor)
|
|
21
|
+
assert contact is not None
|
|
22
|
+
|
|
23
|
+
prop = getattr(contact, feature)
|
|
24
|
+
assert isinstance(prop, type)
|
|
25
|
+
|
|
26
|
+
feat = dev.features[feature]
|
|
27
|
+
assert feat.value == prop
|
|
28
|
+
assert isinstance(feat.value, type)
|