-
-
Notifications
You must be signed in to change notification settings - Fork 223
Convert the codebase to be more modular #299
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
Conversation
I think this is the outstanding issue
|
I don't have an HS300 at my current location. I was hoping to get one locally but they aren't in stock. I have ordered one |
Okay, after the next release with the light effects, I'll simply merge this to master with all its potential flaws to avoid the need for keeping branches in sync. That'll also hopefully get some more eyeballs to spot if there are other issues that needs to be done prior shipping 0.5. |
Strips are fixed here #326 |
I think all the tests will now pass as well with #326 |
Codecov Report
@@ Coverage Diff @@
## master #299 +/- ##
==========================================
- Coverage 82.34% 81.07% -1.27%
==========================================
Files 13 25 +12
Lines 1376 1723 +347
Branches 202 240 +38
==========================================
+ Hits 1133 1397 +264
- Misses 201 285 +84
+ Partials 42 41 -1
Continue to review full report at Codecov.
|
* Add module support & modularize existing query This creates a base to expose more features on the supported devices. At the moment, the most visible change is that each update cycle gets information from all available modules: * Basic system info * Cloud (new) * Countdown (new) * Antitheft (new) * Schedule (new) * Time (existing, implements the time/timezone handling) * Emeter (existing, partially separated from smartdevice) * Fix imports * Fix linting * Use device host instead of alias in module repr * Add property to list available modules, print them in cli state report * usage: fix the get_realtime query * separate usage from schedule to avoid multi-inheritance * Fix module querying * Add is_supported property to modules
* Consolidate API for both emeter&usage modules * Add new cli command 'usage' to query usage
* Do not request unsupported modules after the initial update * debugify logging
* Fix test_deprecated_type stalling * Fix strips with modularize * Fix test_deprecated_type stalling (#325)
This fixes the current broken tests in #844 caused by the fixtures for `HS107(US)_1.0_1.0.8.json` and `KP400(US)_1.0_1.0.10.json` having the `emeter` value in the fixture but no `get_realtime` value. Other strips do not fail because they do not have the `emeter` value in the fixture and the `FakeIotProtocol` creates one for them. It seems that #299 introduced the adding of Emeter in the smart strip constructor (in commit c8ad99a) and this was added after #243 which adds the Emeter in the IoDevice `update()` method so perhaps there is an implication to this change that I'm missing, although it seems `_create_emeter_request` is no longer called anywhere so maybe that was a historical reason. N.B. The tests all pass with this PR. Link to [CI run on branch](https://github.com/sdb9696/python-kasa/actions/runs/8831324308)
This PR creates a modularized foundation to expose more features on the supported devices, making it more straightforward to implement new features in the future. This work forms the basis for 0.5 series.
At the moment, the most visible change is that each update cycle queries the information from all modules supported by the device type in a single query:
Some of the new features are directly exposed to the cli while others are not, the follow-up PRs should add module-based tests and expose features where it makes sense.
Fixes #295 #268 #244