|
8 | 8 |
|
9 | 9 | import pytest # type: ignore # see https://github.com/pytest-dev/pytest/issues/3342 |
10 | 10 |
|
11 | | -from kasa import Discover, SmartBulb, SmartDimmer, SmartPlug, SmartStrip |
| 11 | +from kasa import ( |
| 12 | + Discover, |
| 13 | + SmartBulb, |
| 14 | + SmartDimmer, |
| 15 | + SmartLightStrip, |
| 16 | + SmartPlug, |
| 17 | + SmartStrip, |
| 18 | +) |
12 | 19 |
|
13 | 20 | from .newfakes import FakeTransportProtocol |
14 | 21 |
|
|
17 | 24 | ) |
18 | 25 |
|
19 | 26 |
|
20 | | -BULBS = {"KL60", "LB100", "LB120", "LB130", "KL120", "KL130"} |
21 | | -VARIABLE_TEMP = {"LB120", "LB130", "KL120", "KL130"} |
22 | | -COLOR_BULBS = {"LB130", "KL130"} |
| 27 | +LIGHT_STRIPS = {"KL430"} |
| 28 | +BULBS = {"KL60", "LB100", "LB120", "LB130", "KL120", "KL130", *LIGHT_STRIPS} |
| 29 | +VARIABLE_TEMP = {"LB120", "LB130", "KL120", "KL130", "KL430", *LIGHT_STRIPS} |
| 30 | +COLOR_BULBS = {"LB130", "KL130", *LIGHT_STRIPS} |
| 31 | + |
23 | 32 |
|
24 | 33 | PLUGS = {"HS100", "HS103", "HS105", "HS110", "HS200", "HS210"} |
25 | 34 | STRIPS = {"HS107", "HS300", "KP303", "KP400"} |
@@ -65,9 +74,12 @@ def name_for_filename(x): |
65 | 74 | plug = parametrize("plugs", PLUGS, ids=name_for_filename) |
66 | 75 | strip = parametrize("strips", STRIPS, ids=name_for_filename) |
67 | 76 | dimmer = parametrize("dimmers", DIMMERS, ids=name_for_filename) |
| 77 | +lightstrip = parametrize("lightstrips", LIGHT_STRIPS, ids=name_for_filename) |
68 | 78 |
|
69 | 79 | # This ensures that every single file inside fixtures/ is being placed in some category |
70 | | -categorized_fixtures = set(dimmer.args[1] + strip.args[1] + plug.args[1] + bulb.args[1]) |
| 80 | +categorized_fixtures = set( |
| 81 | + dimmer.args[1] + strip.args[1] + plug.args[1] + bulb.args[1] + lightstrip.args[1] |
| 82 | +) |
71 | 83 | diff = set(SUPPORTED_DEVICES) - set(categorized_fixtures) |
72 | 84 | if diff: |
73 | 85 | for file in diff: |
@@ -105,12 +117,20 @@ def device_for_file(model): |
105 | 117 | for d in STRIPS: |
106 | 118 | if d in model: |
107 | 119 | return SmartStrip |
| 120 | + |
108 | 121 | for d in PLUGS: |
109 | 122 | if d in model: |
110 | 123 | return SmartPlug |
| 124 | + |
| 125 | + # Light strips are recognized also as bulbs, so this has to go first |
| 126 | + for d in LIGHT_STRIPS: |
| 127 | + if d in model: |
| 128 | + return SmartLightStrip |
| 129 | + |
111 | 130 | for d in BULBS: |
112 | 131 | if d in model: |
113 | 132 | return SmartBulb |
| 133 | + |
114 | 134 | for d in DIMMERS: |
115 | 135 | if d in model: |
116 | 136 | return SmartDimmer |
|
0 commit comments