Skip to content

Commit e46c76c

Browse files
driver/power/tplink: use IotStrip instead of deprecated SmartStrip
Since python-kasa 0.7.0, the SmartStrip class is deprecated [1]. The docs state [2]: "If you want to continue to use the old API for older devices, you can use the classes in the iot module to avoid deprecation warnings." Do that. [1] https://python-kasa.readthedocs.io/en/stable/smartstrip.html [2] https://python-kasa.readthedocs.io/en/stable/deprecated.html#deprecated-api-reference Signed-off-by: Bastian Krause <[email protected]>
1 parent c3a1c35 commit e46c76c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

labgrid/driver/power/tplink.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
""" Tested with TP Link KP303, and should be compatible with any strip supported by kasa """
22

33
import asyncio
4-
from kasa import SmartStrip
4+
from kasa.iot import IotStrip
55

66

77
async def _power_set(host, port, index, value):
88
"""We embed the coroutines in an `async` function to minimise calls to `asyncio.run`"""
99
assert port is None
1010
index = int(index)
11-
strip = SmartStrip(host)
11+
strip = IotStrip(host)
1212
await strip.update()
1313
assert (
1414
len(strip.children) > index
@@ -26,7 +26,7 @@ def power_set(host, port, index, value):
2626
def power_get(host, port, index):
2727
assert port is None
2828
index = int(index)
29-
strip = SmartStrip(host)
29+
strip = IotStrip(host)
3030
asyncio.run(strip.update())
3131
assert (
3232
len(strip.children) > index

0 commit comments

Comments
 (0)