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
kasa/smart/effects.py
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
"""Module for light strip light effects."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import cast
|
|
6
|
+
|
|
7
|
+
EFFECT_AURORA = {
|
|
8
|
+
"custom": 0,
|
|
9
|
+
"id": "TapoStrip_1MClvV18i15Jq3bvJVf0eP",
|
|
10
|
+
"brightness": 100,
|
|
11
|
+
"name": "Aurora",
|
|
12
|
+
"enable": 1,
|
|
13
|
+
"segments": [0],
|
|
14
|
+
"expansion_strategy": 1,
|
|
15
|
+
"display_colors": [
|
|
16
|
+
[120, 100, 100],
|
|
17
|
+
[240, 100, 100],
|
|
18
|
+
[260, 100, 100],
|
|
19
|
+
[280, 100, 100],
|
|
20
|
+
],
|
|
21
|
+
"type": "sequence",
|
|
22
|
+
"duration": 0,
|
|
23
|
+
"transition": 1500,
|
|
24
|
+
"direction": 4,
|
|
25
|
+
"spread": 7,
|
|
26
|
+
"repeat_times": 0,
|
|
27
|
+
"sequence": [[120, 100, 100], [240, 100, 100], [260, 100, 100], [280, 100, 100]],
|
|
28
|
+
}
|
|
29
|
+
EFFECT_BUBBLING_CAULDRON = {
|
|
30
|
+
"custom": 0,
|
|
31
|
+
"id": "TapoStrip_6DlumDwO2NdfHppy50vJtu",
|
|
32
|
+
"brightness": 100,
|
|
33
|
+
"name": "Bubbling Cauldron",
|
|
34
|
+
"enable": 1,
|
|
35
|
+
"segments": [0],
|
|
36
|
+
"expansion_strategy": 1,
|
|
37
|
+
"display_colors": [[100, 100, 100], [270, 100, 100]],
|
|
38
|
+
"type": "random",
|
|
39
|
+
"hue_range": [100, 270],
|
|
40
|
+
"saturation_range": [80, 100],
|
|
41
|
+
"brightness_range": [50, 100],
|
|
42
|
+
"duration": 0,
|
|
43
|
+
"transition": 200,
|
|
44
|
+
"init_states": [[270, 100, 100]],
|
|
45
|
+
"fadeoff": 1000,
|
|
46
|
+
"random_seed": 24,
|
|
47
|
+
"backgrounds": [[270, 40, 50]],
|
|
48
|
+
}
|
|
49
|
+
EFFECT_CANDY_CANE = {
|
|
50
|
+
"custom": 0,
|
|
51
|
+
"id": "TapoStrip_6Dy0Nc45vlhFPEzG021Pe9",
|
|
52
|
+
"brightness": 100,
|
|
53
|
+
"name": "Candy Cane",
|
|
54
|
+
"enable": 1,
|
|
55
|
+
"segments": [0],
|
|
56
|
+
"expansion_strategy": 1,
|
|
57
|
+
"display_colors": [[0, 0, 100], [0, 81, 100]],
|
|
58
|
+
"type": "sequence",
|
|
59
|
+
"duration": 700,
|
|
60
|
+
"transition": 500,
|
|
61
|
+
"direction": 1,
|
|
62
|
+
"spread": 1,
|
|
63
|
+
"repeat_times": 0,
|
|
64
|
+
"sequence": [
|
|
65
|
+
[0, 0, 100],
|
|
66
|
+
[0, 0, 100],
|
|
67
|
+
[360, 81, 100],
|
|
68
|
+
[0, 0, 100],
|
|
69
|
+
[0, 0, 100],
|
|
70
|
+
[360, 81, 100],
|
|
71
|
+
[360, 81, 100],
|
|
72
|
+
[0, 0, 100],
|
|
73
|
+
[0, 0, 100],
|
|
74
|
+
[360, 81, 100],
|
|
75
|
+
[360, 81, 100],
|
|
76
|
+
[360, 81, 100],
|
|
77
|
+
[360, 81, 100],
|
|
78
|
+
[0, 0, 100],
|
|
79
|
+
[0, 0, 100],
|
|
80
|
+
[360, 81, 100],
|
|
81
|
+
],
|
|
82
|
+
}
|
|
83
|
+
EFFECT_CHRISTMAS = {
|
|
84
|
+
"custom": 0,
|
|
85
|
+
"id": "TapoStrip_5zkiG6avJ1IbhjiZbRlWvh",
|
|
86
|
+
"brightness": 100,
|
|
87
|
+
"name": "Christmas",
|
|
88
|
+
"enable": 1,
|
|
89
|
+
"segments": [0],
|
|
90
|
+
"expansion_strategy": 1,
|
|
91
|
+
"display_colors": [[136, 98, 100], [350, 97, 100]],
|
|
92
|
+
"type": "random",
|
|
93
|
+
"hue_range": [136, 146],
|
|
94
|
+
"saturation_range": [90, 100],
|
|
95
|
+
"brightness_range": [50, 100],
|
|
96
|
+
"duration": 5000,
|
|
97
|
+
"transition": 0,
|
|
98
|
+
"init_states": [[136, 0, 100]],
|
|
99
|
+
"fadeoff": 2000,
|
|
100
|
+
"random_seed": 100,
|
|
101
|
+
"backgrounds": [[136, 98, 75], [136, 0, 0], [350, 0, 100], [350, 97, 94]],
|
|
102
|
+
}
|
|
103
|
+
EFFECT_FLICKER = {
|
|
104
|
+
"custom": 0,
|
|
105
|
+
"id": "TapoStrip_4HVKmMc6vEzjm36jXaGwMs",
|
|
106
|
+
"brightness": 100,
|
|
107
|
+
"name": "Flicker",
|
|
108
|
+
"enable": 1,
|
|
109
|
+
"segments": [1],
|
|
110
|
+
"expansion_strategy": 1,
|
|
111
|
+
"display_colors": [[30, 81, 100], [40, 100, 100]],
|
|
112
|
+
"type": "random",
|
|
113
|
+
"hue_range": [30, 40],
|
|
114
|
+
"saturation_range": [100, 100],
|
|
115
|
+
"brightness_range": [50, 100],
|
|
116
|
+
"duration": 0,
|
|
117
|
+
"transition": 0,
|
|
118
|
+
"transition_range": [375, 500],
|
|
119
|
+
"init_states": [[30, 81, 80]],
|
|
120
|
+
}
|
|
121
|
+
EFFECT_GRANDMAS_CHRISTMAS_LIGHTS = {
|
|
122
|
+
"custom": 0,
|
|
123
|
+
"id": "TapoStrip_3Gk6CmXOXbjCiwz9iD543C",
|
|
124
|
+
"brightness": 100,
|
|
125
|
+
"name": "Grandma's Christmas Lights",
|
|
126
|
+
"enable": 1,
|
|
127
|
+
"segments": [0],
|
|
128
|
+
"expansion_strategy": 1,
|
|
129
|
+
"display_colors": [[30, 100, 100], [240, 100, 100], [130, 100, 100], [0, 100, 100]],
|
|
130
|
+
"type": "sequence",
|
|
131
|
+
"duration": 5000,
|
|
132
|
+
"transition": 100,
|
|
133
|
+
"direction": 1,
|
|
134
|
+
"spread": 1,
|
|
135
|
+
"repeat_times": 0,
|
|
136
|
+
"sequence": [
|
|
137
|
+
[30, 100, 100],
|
|
138
|
+
[30, 0, 0],
|
|
139
|
+
[30, 0, 0],
|
|
140
|
+
[240, 100, 100],
|
|
141
|
+
[240, 0, 0],
|
|
142
|
+
[240, 0, 0],
|
|
143
|
+
[240, 0, 100],
|
|
144
|
+
[240, 0, 0],
|
|
145
|
+
[240, 0, 0],
|
|
146
|
+
[130, 100, 100],
|
|
147
|
+
[130, 0, 0],
|
|
148
|
+
[130, 0, 0],
|
|
149
|
+
[0, 100, 100],
|
|
150
|
+
[0, 0, 0],
|
|
151
|
+
[0, 0, 0],
|
|
152
|
+
],
|
|
153
|
+
}
|
|
154
|
+
EFFECT_HANUKKAH = {
|
|
155
|
+
"custom": 0,
|
|
156
|
+
"id": "TapoStrip_2YTk4wramLKv5XZ9KFDVYm",
|
|
157
|
+
"brightness": 100,
|
|
158
|
+
"name": "Hanukkah",
|
|
159
|
+
"enable": 1,
|
|
160
|
+
"segments": [1],
|
|
161
|
+
"expansion_strategy": 1,
|
|
162
|
+
"display_colors": [[200, 100, 100]],
|
|
163
|
+
"type": "random",
|
|
164
|
+
"hue_range": [200, 210],
|
|
165
|
+
"saturation_range": [0, 100],
|
|
166
|
+
"brightness_range": [50, 100],
|
|
167
|
+
"duration": 1500,
|
|
168
|
+
"transition": 0,
|
|
169
|
+
"transition_range": [400, 500],
|
|
170
|
+
"init_states": [[35, 81, 80]],
|
|
171
|
+
}
|
|
172
|
+
EFFECT_HAUNTED_MANSION = {
|
|
173
|
+
"custom": 0,
|
|
174
|
+
"id": "TapoStrip_4rJ6JwC7I9st3tQ8j4lwlI",
|
|
175
|
+
"brightness": 100,
|
|
176
|
+
"name": "Haunted Mansion",
|
|
177
|
+
"enable": 1,
|
|
178
|
+
"segments": [80],
|
|
179
|
+
"expansion_strategy": 2,
|
|
180
|
+
"display_colors": [[44, 9, 100]],
|
|
181
|
+
"type": "random",
|
|
182
|
+
"hue_range": [45, 45],
|
|
183
|
+
"saturation_range": [10, 10],
|
|
184
|
+
"brightness_range": [0, 80],
|
|
185
|
+
"duration": 0,
|
|
186
|
+
"transition": 0,
|
|
187
|
+
"transition_range": [50, 1500],
|
|
188
|
+
"init_states": [[45, 10, 100]],
|
|
189
|
+
"fadeoff": 200,
|
|
190
|
+
"random_seed": 1,
|
|
191
|
+
"backgrounds": [[45, 10, 100]],
|
|
192
|
+
}
|
|
193
|
+
EFFECT_ICICLE = {
|
|
194
|
+
"custom": 0,
|
|
195
|
+
"id": "TapoStrip_7UcYLeJbiaxVIXCxr21tpx",
|
|
196
|
+
"brightness": 100,
|
|
197
|
+
"name": "Icicle",
|
|
198
|
+
"enable": 1,
|
|
199
|
+
"segments": [0],
|
|
200
|
+
"expansion_strategy": 1,
|
|
201
|
+
"display_colors": [[190, 100, 100]],
|
|
202
|
+
"type": "sequence",
|
|
203
|
+
"duration": 0,
|
|
204
|
+
"transition": 400,
|
|
205
|
+
"direction": 4,
|
|
206
|
+
"spread": 3,
|
|
207
|
+
"repeat_times": 0,
|
|
208
|
+
"sequence": [
|
|
209
|
+
[190, 100, 70],
|
|
210
|
+
[190, 100, 70],
|
|
211
|
+
[190, 30, 50],
|
|
212
|
+
[190, 100, 70],
|
|
213
|
+
[190, 100, 70],
|
|
214
|
+
],
|
|
215
|
+
}
|
|
216
|
+
EFFECT_LIGHTNING = {
|
|
217
|
+
"custom": 0,
|
|
218
|
+
"id": "TapoStrip_7OGzfSfnOdhoO2ri4gOHWn",
|
|
219
|
+
"brightness": 100,
|
|
220
|
+
"name": "Lightning",
|
|
221
|
+
"enable": 1,
|
|
222
|
+
"segments": [7],
|
|
223
|
+
"expansion_strategy": 1,
|
|
224
|
+
"display_colors": [[210, 9, 100], [200, 50, 100], [200, 100, 100]],
|
|
225
|
+
"type": "random",
|
|
226
|
+
"hue_range": [240, 240],
|
|
227
|
+
"saturation_range": [10, 11],
|
|
228
|
+
"brightness_range": [90, 100],
|
|
229
|
+
"duration": 0,
|
|
230
|
+
"transition": 50,
|
|
231
|
+
"init_states": [[240, 30, 100]],
|
|
232
|
+
"fadeoff": 150,
|
|
233
|
+
"random_seed": 50,
|
|
234
|
+
"backgrounds": [[200, 100, 100], [200, 50, 10], [210, 10, 50], [240, 10, 0]],
|
|
235
|
+
}
|
|
236
|
+
EFFECT_OCEAN = {
|
|
237
|
+
"custom": 0,
|
|
238
|
+
"id": "TapoStrip_0fOleCdwSgR0nfjkReeYfw",
|
|
239
|
+
"brightness": 100,
|
|
240
|
+
"name": "Ocean",
|
|
241
|
+
"enable": 1,
|
|
242
|
+
"segments": [0],
|
|
243
|
+
"expansion_strategy": 1,
|
|
244
|
+
"display_colors": [[198, 84, 100]],
|
|
245
|
+
"type": "sequence",
|
|
246
|
+
"duration": 0,
|
|
247
|
+
"transition": 2000,
|
|
248
|
+
"direction": 3,
|
|
249
|
+
"spread": 16,
|
|
250
|
+
"repeat_times": 0,
|
|
251
|
+
"sequence": [[198, 84, 30], [198, 70, 30], [198, 10, 30]],
|
|
252
|
+
}
|
|
253
|
+
EFFECT_RAINBOW = {
|
|
254
|
+
"custom": 0,
|
|
255
|
+
"id": "TapoStrip_7CC5y4lsL8pETYvmz7UOpQ",
|
|
256
|
+
"brightness": 100,
|
|
257
|
+
"name": "Rainbow",
|
|
258
|
+
"enable": 1,
|
|
259
|
+
"segments": [0],
|
|
260
|
+
"expansion_strategy": 1,
|
|
261
|
+
"display_colors": [
|
|
262
|
+
[0, 100, 100],
|
|
263
|
+
[100, 100, 100],
|
|
264
|
+
[200, 100, 100],
|
|
265
|
+
[300, 100, 100],
|
|
266
|
+
],
|
|
267
|
+
"type": "sequence",
|
|
268
|
+
"duration": 0,
|
|
269
|
+
"transition": 1500,
|
|
270
|
+
"direction": 1,
|
|
271
|
+
"spread": 12,
|
|
272
|
+
"repeat_times": 0,
|
|
273
|
+
"sequence": [[0, 100, 100], [100, 100, 100], [200, 100, 100], [300, 100, 100]],
|
|
274
|
+
}
|
|
275
|
+
EFFECT_RAINDROP = {
|
|
276
|
+
"custom": 0,
|
|
277
|
+
"id": "TapoStrip_1t2nWlTBkV8KXBZ0TWvBjs",
|
|
278
|
+
"brightness": 100,
|
|
279
|
+
"name": "Raindrop",
|
|
280
|
+
"enable": 1,
|
|
281
|
+
"segments": [0],
|
|
282
|
+
"expansion_strategy": 1,
|
|
283
|
+
"display_colors": [[200, 9, 100], [200, 19, 100]],
|
|
284
|
+
"type": "random",
|
|
285
|
+
"hue_range": [200, 200],
|
|
286
|
+
"saturation_range": [10, 20],
|
|
287
|
+
"brightness_range": [10, 30],
|
|
288
|
+
"duration": 0,
|
|
289
|
+
"transition": 1000,
|
|
290
|
+
"init_states": [[200, 40, 100]],
|
|
291
|
+
"fadeoff": 1000,
|
|
292
|
+
"random_seed": 24,
|
|
293
|
+
"backgrounds": [[200, 40, 0]],
|
|
294
|
+
}
|
|
295
|
+
EFFECT_SPRING = {
|
|
296
|
+
"custom": 0,
|
|
297
|
+
"id": "TapoStrip_1nL6GqZ5soOxj71YDJOlZL",
|
|
298
|
+
"brightness": 100,
|
|
299
|
+
"name": "Spring",
|
|
300
|
+
"enable": 1,
|
|
301
|
+
"segments": [0],
|
|
302
|
+
"expansion_strategy": 1,
|
|
303
|
+
"display_colors": [[0, 30, 100], [130, 100, 100]],
|
|
304
|
+
"type": "random",
|
|
305
|
+
"hue_range": [0, 90],
|
|
306
|
+
"saturation_range": [30, 100],
|
|
307
|
+
"brightness_range": [90, 100],
|
|
308
|
+
"duration": 600,
|
|
309
|
+
"transition": 0,
|
|
310
|
+
"transition_range": [2000, 6000],
|
|
311
|
+
"init_states": [[80, 30, 100]],
|
|
312
|
+
"fadeoff": 1000,
|
|
313
|
+
"random_seed": 20,
|
|
314
|
+
"backgrounds": [[130, 100, 40]],
|
|
315
|
+
}
|
|
316
|
+
EFFECT_SUNRISE = {
|
|
317
|
+
"custom": 0,
|
|
318
|
+
"id": "TapoStrip_1OVSyXIsDxrt4j7OxyRvqi",
|
|
319
|
+
"brightness": 100,
|
|
320
|
+
"name": "Sunrise",
|
|
321
|
+
"enable": 1,
|
|
322
|
+
"segments": [0],
|
|
323
|
+
"expansion_strategy": 2,
|
|
324
|
+
"display_colors": [[0, 0, 100], [30, 95, 100], [0, 100, 100]],
|
|
325
|
+
"type": "pulse",
|
|
326
|
+
"duration": 600,
|
|
327
|
+
"transition": 60000,
|
|
328
|
+
"direction": 1,
|
|
329
|
+
"spread": 1,
|
|
330
|
+
"repeat_times": 1,
|
|
331
|
+
"run_time": 0,
|
|
332
|
+
"sequence": [
|
|
333
|
+
[0, 100, 5],
|
|
334
|
+
[0, 100, 5],
|
|
335
|
+
[10, 100, 6],
|
|
336
|
+
[15, 100, 7],
|
|
337
|
+
[20, 100, 8],
|
|
338
|
+
[20, 100, 10],
|
|
339
|
+
[30, 100, 12],
|
|
340
|
+
[30, 95, 15],
|
|
341
|
+
[30, 90, 20],
|
|
342
|
+
[30, 80, 25],
|
|
343
|
+
[30, 75, 30],
|
|
344
|
+
[30, 70, 40],
|
|
345
|
+
[30, 60, 50],
|
|
346
|
+
[30, 50, 60],
|
|
347
|
+
[30, 20, 70],
|
|
348
|
+
[30, 0, 100],
|
|
349
|
+
],
|
|
350
|
+
"trans_sequence": [],
|
|
351
|
+
}
|
|
352
|
+
EFFECT_SUNSET = {
|
|
353
|
+
"custom": 0,
|
|
354
|
+
"id": "TapoStrip_5NiN0Y8GAUD78p4neKk9EL",
|
|
355
|
+
"brightness": 100,
|
|
356
|
+
"name": "Sunset",
|
|
357
|
+
"enable": 1,
|
|
358
|
+
"segments": [0],
|
|
359
|
+
"expansion_strategy": 2,
|
|
360
|
+
"display_colors": [[0, 100, 100], [30, 95, 100], [0, 0, 100]],
|
|
361
|
+
"type": "pulse",
|
|
362
|
+
"duration": 600,
|
|
363
|
+
"transition": 60000,
|
|
364
|
+
"direction": 1,
|
|
365
|
+
"spread": 1,
|
|
366
|
+
"repeat_times": 1,
|
|
367
|
+
"run_time": 0,
|
|
368
|
+
"sequence": [
|
|
369
|
+
[30, 0, 100],
|
|
370
|
+
[30, 20, 100],
|
|
371
|
+
[30, 50, 99],
|
|
372
|
+
[30, 60, 98],
|
|
373
|
+
[30, 70, 97],
|
|
374
|
+
[30, 75, 95],
|
|
375
|
+
[30, 80, 93],
|
|
376
|
+
[30, 90, 90],
|
|
377
|
+
[30, 95, 85],
|
|
378
|
+
[30, 100, 80],
|
|
379
|
+
[20, 100, 70],
|
|
380
|
+
[20, 100, 60],
|
|
381
|
+
[15, 100, 50],
|
|
382
|
+
[10, 100, 40],
|
|
383
|
+
[0, 100, 30],
|
|
384
|
+
[0, 100, 0],
|
|
385
|
+
],
|
|
386
|
+
"trans_sequence": [],
|
|
387
|
+
}
|
|
388
|
+
EFFECT_VALENTINES = {
|
|
389
|
+
"custom": 0,
|
|
390
|
+
"id": "TapoStrip_2q1Vio9sSjHmaC7JS9d30l",
|
|
391
|
+
"brightness": 100,
|
|
392
|
+
"name": "Valentines",
|
|
393
|
+
"enable": 1,
|
|
394
|
+
"segments": [0],
|
|
395
|
+
"expansion_strategy": 1,
|
|
396
|
+
"display_colors": [[339, 19, 100], [19, 50, 100], [0, 100, 100], [339, 40, 100]],
|
|
397
|
+
"type": "random",
|
|
398
|
+
"hue_range": [340, 340],
|
|
399
|
+
"saturation_range": [30, 40],
|
|
400
|
+
"brightness_range": [90, 100],
|
|
401
|
+
"duration": 600,
|
|
402
|
+
"transition": 2000,
|
|
403
|
+
"init_states": [[340, 30, 100]],
|
|
404
|
+
"fadeoff": 3000,
|
|
405
|
+
"random_seed": 100,
|
|
406
|
+
"backgrounds": [[340, 20, 50], [20, 50, 50], [0, 100, 50]],
|
|
407
|
+
}
|
|
408
|
+
EFFECTS_LIST = [
|
|
409
|
+
EFFECT_AURORA,
|
|
410
|
+
EFFECT_BUBBLING_CAULDRON,
|
|
411
|
+
EFFECT_CANDY_CANE,
|
|
412
|
+
EFFECT_CHRISTMAS,
|
|
413
|
+
EFFECT_FLICKER,
|
|
414
|
+
EFFECT_GRANDMAS_CHRISTMAS_LIGHTS,
|
|
415
|
+
EFFECT_HANUKKAH,
|
|
416
|
+
EFFECT_HAUNTED_MANSION,
|
|
417
|
+
EFFECT_ICICLE,
|
|
418
|
+
EFFECT_LIGHTNING,
|
|
419
|
+
EFFECT_OCEAN,
|
|
420
|
+
EFFECT_RAINBOW,
|
|
421
|
+
EFFECT_RAINDROP,
|
|
422
|
+
EFFECT_SPRING,
|
|
423
|
+
EFFECT_SUNRISE,
|
|
424
|
+
EFFECT_SUNSET,
|
|
425
|
+
EFFECT_VALENTINES,
|
|
426
|
+
]
|
|
427
|
+
|
|
428
|
+
EFFECT_NAMES: list[str] = [cast(str, effect["name"]) for effect in EFFECTS_LIST]
|
|
429
|
+
EFFECT_MAPPING = {effect["name"]: effect for effect in EFFECTS_LIST}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Modules for SMART devices."""
|
|
2
|
+
|
|
3
|
+
from .alarm import Alarm
|
|
4
|
+
from .autooff import AutoOff
|
|
5
|
+
from .batterysensor import BatterySensor
|
|
6
|
+
from .brightness import Brightness
|
|
7
|
+
from .childdevice import ChildDevice
|
|
8
|
+
from .cloud import Cloud
|
|
9
|
+
from .color import Color
|
|
10
|
+
from .colortemperature import ColorTemperature
|
|
11
|
+
from .contactsensor import ContactSensor
|
|
12
|
+
from .devicemodule import DeviceModule
|
|
13
|
+
from .energy import Energy
|
|
14
|
+
from .fan import Fan
|
|
15
|
+
from .firmware import Firmware
|
|
16
|
+
from .frostprotection import FrostProtection
|
|
17
|
+
from .humiditysensor import HumiditySensor
|
|
18
|
+
from .led import Led
|
|
19
|
+
from .light import Light
|
|
20
|
+
from .lighteffect import LightEffect
|
|
21
|
+
from .lightpreset import LightPreset
|
|
22
|
+
from .lightstripeffect import LightStripEffect
|
|
23
|
+
from .lighttransition import LightTransition
|
|
24
|
+
from .reportmode import ReportMode
|
|
25
|
+
from .temperaturecontrol import TemperatureControl
|
|
26
|
+
from .temperaturesensor import TemperatureSensor
|
|
27
|
+
from .time import Time
|
|
28
|
+
from .waterleaksensor import WaterleakSensor
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"Alarm",
|
|
32
|
+
"Time",
|
|
33
|
+
"Energy",
|
|
34
|
+
"DeviceModule",
|
|
35
|
+
"ChildDevice",
|
|
36
|
+
"BatterySensor",
|
|
37
|
+
"HumiditySensor",
|
|
38
|
+
"TemperatureSensor",
|
|
39
|
+
"TemperatureControl",
|
|
40
|
+
"ReportMode",
|
|
41
|
+
"AutoOff",
|
|
42
|
+
"Led",
|
|
43
|
+
"Brightness",
|
|
44
|
+
"Fan",
|
|
45
|
+
"LightPreset",
|
|
46
|
+
"Firmware",
|
|
47
|
+
"Cloud",
|
|
48
|
+
"Light",
|
|
49
|
+
"LightEffect",
|
|
50
|
+
"LightStripEffect",
|
|
51
|
+
"LightTransition",
|
|
52
|
+
"ColorTemperature",
|
|
53
|
+
"Color",
|
|
54
|
+
"WaterleakSensor",
|
|
55
|
+
"ContactSensor",
|
|
56
|
+
"FrostProtection",
|
|
57
|
+
]
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"""Implementation of alarm module."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from ...feature import Feature
|
|
6
|
+
from ..smartmodule import SmartModule
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Alarm(SmartModule):
|
|
10
|
+
"""Implementation of alarm module."""
|
|
11
|
+
|
|
12
|
+
REQUIRED_COMPONENT = "alarm"
|
|
13
|
+
|
|
14
|
+
def query(self) -> dict:
|
|
15
|
+
"""Query to execute during the update cycle."""
|
|
16
|
+
return {
|
|
17
|
+
"get_alarm_configure": None,
|
|
18
|
+
"get_support_alarm_type_list": None, # This should be needed only once
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
def _initialize_features(self):
|
|
22
|
+
"""Initialize features.
|
|
23
|
+
|
|
24
|
+
This is implemented as some features depend on device responses.
|
|
25
|
+
"""
|
|
26
|
+
device = self._device
|
|
27
|
+
self._add_feature(
|
|
28
|
+
Feature(
|
|
29
|
+
device,
|
|
30
|
+
id="alarm",
|
|
31
|
+
name="Alarm",
|
|
32
|
+
container=self,
|
|
33
|
+
attribute_getter="active",
|
|
34
|
+
icon="mdi:bell",
|
|
35
|
+
type=Feature.Type.BinarySensor,
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
self._add_feature(
|
|
39
|
+
Feature(
|
|
40
|
+
device,
|
|
41
|
+
id="alarm_source",
|
|
42
|
+
name="Alarm source",
|
|
43
|
+
container=self,
|
|
44
|
+
attribute_getter="source",
|
|
45
|
+
icon="mdi:bell",
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
self._add_feature(
|
|
49
|
+
Feature(
|
|
50
|
+
device,
|
|
51
|
+
id="alarm_sound",
|
|
52
|
+
name="Alarm sound",
|
|
53
|
+
container=self,
|
|
54
|
+
attribute_getter="alarm_sound",
|
|
55
|
+
attribute_setter="set_alarm_sound",
|
|
56
|
+
category=Feature.Category.Config,
|
|
57
|
+
type=Feature.Type.Choice,
|
|
58
|
+
choices_getter="alarm_sounds",
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
self._add_feature(
|
|
62
|
+
Feature(
|
|
63
|
+
device,
|
|
64
|
+
id="alarm_volume",
|
|
65
|
+
name="Alarm volume",
|
|
66
|
+
container=self,
|
|
67
|
+
attribute_getter="alarm_volume",
|
|
68
|
+
attribute_setter="set_alarm_volume",
|
|
69
|
+
category=Feature.Category.Config,
|
|
70
|
+
type=Feature.Type.Choice,
|
|
71
|
+
choices=["low", "normal", "high"],
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
self._add_feature(
|
|
75
|
+
Feature(
|
|
76
|
+
device,
|
|
77
|
+
id="test_alarm",
|
|
78
|
+
name="Test alarm",
|
|
79
|
+
container=self,
|
|
80
|
+
attribute_setter="play",
|
|
81
|
+
type=Feature.Type.Action,
|
|
82
|
+
)
|
|
83
|
+
)
|
|
84
|
+
self._add_feature(
|
|
85
|
+
Feature(
|
|
86
|
+
device,
|
|
87
|
+
id="stop_alarm",
|
|
88
|
+
name="Stop alarm",
|
|
89
|
+
container=self,
|
|
90
|
+
attribute_setter="stop",
|
|
91
|
+
type=Feature.Type.Action,
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
@property
|
|
96
|
+
def alarm_sound(self):
|
|
97
|
+
"""Return current alarm sound."""
|
|
98
|
+
return self.data["get_alarm_configure"]["type"]
|
|
99
|
+
|
|
100
|
+
async def set_alarm_sound(self, sound: str):
|
|
101
|
+
"""Set alarm sound.
|
|
102
|
+
|
|
103
|
+
See *alarm_sounds* for list of available sounds.
|
|
104
|
+
"""
|
|
105
|
+
payload = self.data["get_alarm_configure"].copy()
|
|
106
|
+
payload["type"] = sound
|
|
107
|
+
return await self.call("set_alarm_configure", payload)
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def alarm_sounds(self) -> list[str]:
|
|
111
|
+
"""Return list of available alarm sounds."""
|
|
112
|
+
return self.data["get_support_alarm_type_list"]["alarm_type_list"]
|
|
113
|
+
|
|
114
|
+
@property
|
|
115
|
+
def alarm_volume(self):
|
|
116
|
+
"""Return alarm volume."""
|
|
117
|
+
return self.data["get_alarm_configure"]["volume"]
|
|
118
|
+
|
|
119
|
+
async def set_alarm_volume(self, volume: str):
|
|
120
|
+
"""Set alarm volume."""
|
|
121
|
+
payload = self.data["get_alarm_configure"].copy()
|
|
122
|
+
payload["volume"] = volume
|
|
123
|
+
return await self.call("set_alarm_configure", payload)
|
|
124
|
+
|
|
125
|
+
@property
|
|
126
|
+
def active(self) -> bool:
|
|
127
|
+
"""Return true if alarm is active."""
|
|
128
|
+
return self._device.sys_info["in_alarm"]
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def source(self) -> str | None:
|
|
132
|
+
"""Return the alarm cause."""
|
|
133
|
+
src = self._device.sys_info["in_alarm_source"]
|
|
134
|
+
return src if src else None
|
|
135
|
+
|
|
136
|
+
async def play(self):
|
|
137
|
+
"""Play alarm."""
|
|
138
|
+
return await self.call("play_alarm")
|
|
139
|
+
|
|
140
|
+
async def stop(self):
|
|
141
|
+
"""Stop alarm."""
|
|
142
|
+
return await self.call("stop_alarm")
|