gilesknap / maaspower

Provide MAAS power control via webhooks for various remote control power switches.
Apache License 2.0
18 stars 13 forks source link

Add Support for TP-Link Kasa Smart Plugs #22

Closed lbunge closed 3 months ago

lbunge commented 4 months ago

Overview

This pull request introduces support for TP-Link Kasa Smart Plugs within the MaasPower project. It extends the range of devices that can be controlled through MaasPower, allowing users to manage these devices alongside existing supported hardware like Tapo Smart Plugs and Netgear switches.

Changes Made

Added a new device handler for TP-Link Kasa Smart Plugs in the kasa_device.py module. Updated the devicetypes.rst documentation to include a section on configuring and using TP-Link Kasa Smart Plugs. Included new configuration examples in the existing YAML configuration files to demonstrate how users can integrate and control their Kasa Smart Plugs. Added dependency for python-kasa in the setup.cfg to ensure the necessary library is installed for managing Kasa devices. Motivation As the popularity of TP-Link Kasa Smart Plugs grows, their inclusion in MaasPower will provide users with more flexibility in their hardware choices for power management solutions. This is particularly beneficial for setups where consumer-grade hardware is being utilized alongside traditional datacenter hardware.

Testing

Set up a TP-Link Kasa Smart Plug using the Kasa mobile app and connected it to the local network. Updated the MaasPower configuration to include the newly supported smart plug. Successfully tested the on, off, and query commands through MaasPower's web hook interface. Documentation was reviewed for clarity and completeness by following the setup steps from scratch in a clean environment.

gilesknap commented 4 months ago

Sorry I missed this. Reviewing now.

gilesknap commented 3 months ago

@lbunge - I have squashed your commits and merged them with the two recent PRs. So closing this. Please take a look at #26

Also note that the CI failed due to a few issues with the docs. If you want to make any further changes you can now do the following:

git clone git@github.com:gilesknap/maaspower.git
cd maaspower
python3 -mvenv venv
. ./venv/bin/activate
pip install -e .'[dev]'
tox -p

The tox -p will run all the tests including building the docs. This pretty much does everything that the CI does when you push to GitHub so is a good indicator that the CI won't fail.