From c1f2f8fe670a466bee053fe7967761ecda5aff77 Mon Sep 17 00:00:00 2001 From: Teemu R Date: Tue, 23 Jan 2024 11:14:59 +0100 Subject: [PATCH] Check README for supported models (#684) * Check README for supported models * Use poetry for running due to imports * Update README --- .github/workflows/ci.yml | 4 ++++ README.md | 36 +++++++++++++++++++--------- devtools/check_readme_vs_fixtures.py | 8 +++++++ 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1dcd091e..761ed8ba 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 README for supported models" + run: | + poetry run python -m devtools.check_readme_vs_fixtures + tests: name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} diff --git a/README.md b/README.md index fdc9a4b8..eeb5e7e2 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 diff --git a/devtools/check_readme_vs_fixtures.py b/devtools/check_readme_vs_fixtures.py index 1f55eea8..f7a2f2c3 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)