ITADN

power: support TP-Link Tapo Smart Plug

#1041Pull Requestsatoshi-ohba 创建于 2025-12-05
S
satoshi-ohbacommented
Hello, I developed this feature primarily for my own needs, so I integrated the TP-Link Tapo smart plug support into moonraker. What do you think? I read past discussions and know moonraker doesn't accept TP-Link Tapo support that depends on external libraries. I submitted it anyway, just in case. I added code to `power.py` that calls the Unofficial Tapo API Client created by Mihai Dinculescu. [GitHub](https://github.com/mihai-dinculescu/tapo) / [PyPI](https://pypi.org/project/tapo/). - The client library is under the MIT license. - The client library itself has no further dependencies on additional external third-party libraries or Python packages. - The client library itself is written in Rust, and I didn't feel the need to touch Rust directly during the integration process at all. - PyPI wheels are available for a wide range of architectures. (Supporting x86_64, arm64, aarch64, armv7l, i686, ppc64le, and s390x) - All client API calls are asynchronous, which should prevent interference with moonraker's overall operation. - Supported smart plugs: (P100, P105, P110, P110M, P115), power strips (P300, P304M, P316M) I have confirmed that it works with the P110M. We need to check with the other plugs and power strips. - Since the client library supports Python 3.11+, to avoid conflicts with Moonraker running on 3.7<= and <3.11, I initially implemented it using dynamic imports to ensure it only activates for those who really need it. I understand this approach depends on design philosophy; it could be rewritten for static imports or made installable solely via `[project.optional-dependencies]` in pyproject.toml. I appreciate you taking the time to review this. Any feedback on the approach or integration method is welcome, even if the feature ultimately isn't accepted. Thank you.
合并状态:未合并 关闭于 2025-12-06 2 条评论