From aee8d5b080d559f06d4f7bd6a894caf90bdd2344 Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Tue, 23 Jan 2024 08:43:31 +0100 Subject: [PATCH 1/3] Check README for supported models --- .github/workflows/ci.yml | 4 ++++ devtools/check_readme_vs_fixtures.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1dcd091eb..daa59e024 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,10 @@ jobs: - name: "Run check-ast" run: | poetry run pre-commit run check-ast --all-files + - name: "Check that all models are listed in the README.md" + run: | + python -m devtools.check_readme_vs_fixtures + tests: name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} diff --git a/devtools/check_readme_vs_fixtures.py b/devtools/check_readme_vs_fixtures.py index 1f55eea87..f7a2f2c39 100644 --- a/devtools/check_readme_vs_fixtures.py +++ b/devtools/check_readme_vs_fixtures.py @@ -1,4 +1,6 @@ """Script that checks if README.md is missing devices that have fixtures.""" +import sys + from kasa.tests.conftest import ( ALL_DEVICES, BULBS, @@ -28,6 +30,12 @@ def _get_device_type(dev, typemap): return "Unknown type" +found_unlisted = False for dev in ALL_DEVICES: if dev not in readme: print(f"{dev} not listed in {_get_device_type(dev, typemap)}") + found_unlisted = True + + +if found_unlisted: + sys.exit(-1) From 8be443be89fa71061736d3fc18d28b81875c88cb Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Tue, 23 Jan 2024 08:46:20 +0100 Subject: [PATCH 2/3] Use poetry for running due to imports --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index daa59e024..25ce103f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: poetry run pre-commit run check-ast --all-files - name: "Check that all models are listed in the README.md" run: | - python -m devtools.check_readme_vs_fixtures + poetry run python -m devtools.check_readme_vs_fixtures tests: From bfa7fdb55ee6290f18298f05b5c922b65779bc33 Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Tue, 23 Jan 2024 09:23:52 +0100 Subject: [PATCH 3/3] Update README --- .github/workflows/ci.yml | 2 +- README.md | 36 +++++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25ce103f7..761ed8baa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - name: "Run check-ast" run: | poetry run pre-commit run check-ast --all-files - - name: "Check that all models are listed in the README.md" + - name: "Check README for supported models" run: | poetry run python -m devtools.check_readme_vs_fixtures diff --git a/README.md b/README.md index fdc9a4b83..eeb5e7e2a 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ Note, that this works currently only on kasa-branded devices which use port 9999 In principle, most kasa-branded devices that are locally controllable using the official Kasa mobile app work with this library. The following lists the devices that have been manually verified to work. -**If your device is unlisted but working, please open a pull request to update the list and add a fixture file (use `devtools/dump_devinfo.py` to generate one).** +**If your device is unlisted but working, please open a pull request to update the list and add a fixture file (use `python -m devtools.dump_devinfo` to generate one).** ### Plugs @@ -228,10 +228,10 @@ The following lists the devices that have been manually verified to work. * KP105 * KP115 * KP125 -* KP125M [See note below](#tapo-and-newer-kasa-branded-devices) +* KP125M [See note below](#newer-kasa-branded-devices) * KP401 * EP10 -* EP25 [See note below](#tapo-and-newer-kasa-branded-devices) +* EP25 [See note below](#newer-kasa-branded-devices) ### Power Strips @@ -273,18 +273,29 @@ The following lists the devices that have been manually verified to work. * KL420L5 * KL430 -### Tapo and newer Kasa branded devices +### Tapo branded devices The library has recently added a limited supported for devices that carry Tapo branding. At the moment, the following devices have been confirmed to work: -* Tapo P110 (plug) -* Tapo L530E (bulb) -* Tapo L900-5 (led strip) -* Tapo L900-10 (led strip) -* Kasa KS205 (Wifi/Matter Wall Switch) -* Kasa KS225 (Wifi/Matter Wall Dimmer Switch) +#### Plugs + +* Tapo P110 +* Tapo P135 (dimming not yet supported) + +#### Bulbs + +* Tapo L510B +* Tapo L530E + +#### Light strips + +* Tapo L900-5 +* Tapo L900-10 +* Tapo L920-5 + +### Newer Kasa branded devices Some newer hardware versions of Kasa branded devices are now using the same protocol as Tapo branded devices. Support for these devices is currently limited as per TAPO branded @@ -292,8 +303,11 @@ devices: * Kasa EP25 (plug) hw_version 2.6 * Kasa KP125M (plug) +* Kasa KS205 (Wifi/Matter Wall Switch) +* Kasa KS225 (Wifi/Matter Wall Dimmer Switch) + -**If your device is unlisted but working, please open a pull request to update the list and add a fixture file (use `devtools/dump_devinfo.py` to generate one).** +**If your device is unlisted but working, please open a pull request to update the list and add a fixture file (use `python -m devtools.dump_devinfo` to generate one).** ## Resources