| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I think this is the outstanding issue 2022-01-30 14:53:03 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up tplink platform for sensor
Traceback (most recent call last):
File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/Users/bdraco/home-assistant/homeassistant/components/tplink/sensor.py", line 133, in async_setup_entry
entities.extend(_async_sensors_for_device(child))
File "/Users/bdraco/home-assistant/homeassistant/components/tplink/sensor.py", line 124, in _async_sensors_for_device
return [
File "/Users/bdraco/home-assistant/homeassistant/components/tplink/sensor.py", line 127, in <listcomp>
if async_emeter_from_device(device, description) is not None
File "/Users/bdraco/home-assistant/homeassistant/components/tplink/sensor.py", line 99, in async_emeter_from_device
if (val := getattr(device.emeter_realtime, attr)) is None:
File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/kasa/smartdevice.py", line 88, in wrapped
return f(*args, **kwargs)
File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/kasa/smartdevice.py", line 462, in emeter_realtime
return EmeterStatus(self.modules["emeter"].realtime)
KeyError: 'emeter'
|
Sorry, something went wrong.
|
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 |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
I think all the tests will now pass as well with #326 |
Sorry, something went wrong.
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.
|
Sorry, something went wrong.
* 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)
| Back | FazBrowse Home | New Git URL |
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