-
Notifications
You must be signed in to change notification settings - Fork 210
driver/power: Add support for TAPO devices #1630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
driver/power: Add support for TAPO devices #1630
Conversation
Signed-off-by: Marek Szczypiński <[email protected]>
d41c2fa
to
e544fc0
Compare
labgrid/driver/power/tapo.py
Outdated
# Somewhere between python-kasa 0.7.7 and 0.10.2 the API changed | ||
# Labgrid on Python <= 3.10 uses python-kasa 0.7.7 | ||
# Labgrid on Python >= 3.11 uses python-kasa 0.10.2 | ||
if sys.version_info < (3, 11): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should instead check the python-kasa version instead of relying on the indirect python dependency here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. All tests as written in the description of this PR were re-done.
Signed-off-by: Marek Szczypiński <[email protected]>
Description
This pull request adds support for
TAPO/TP-Link
programmable power strips and single socket devices using python-kasa.This feature is used to manage
TAPO
power strip or single socket from Labgrid. It addstapo
model toNetworkPowerPort
. As allTapo
devices require credentials this feature requires user to setKASA_LOGIN
andKASA_PASSWORD
env variables to work (see python-kasa website for details).I have tested it manually with Labgrid (client build and run wth Python3.9 and 3.12). Additionally I wrote unit tests for it and also I have run the
tox -r
command (Python: 3.9, 3.10, 3.11 and 3.12). All worked without errors and all the tests passed.I have used this driver with
Tapo P300
power strip andTapo P100
socket. So it should work with allTapo
strips and sockets.While there already is support for
KASA/TP-Link
products in Labgrid using python-kasa, it doesn't work with TAPO devices as they apparently use some other protocol and require password and login to work. In order to not complicate the implementation oftplink
model I decided to implement support forTapo
devices as a separate one. Additionally KASA products are not available in Europe so I didn't have means to test current (tplink
) solution, which was one more reason to separate this into another model.Because of the necessity to create credentials this solution is a bit more complicated than the
tplink
model.This solution is based on the
tplink
model. Two key differences are:P100
that ignores value ofindex
Tapo
cloud credentials in order to communicate with devicesChecklist