-
-
Notifications
You must be signed in to change notification settings - Fork 239
Optimize I/O access #59
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
Optimize I/O access #59
Conversation
|
This is the last showstopper I wanted to tackle before making a release. It may not be be prettiest code you have ever seen, but I think it's the time to get the first (pre-)release out and let the downstream users to enjoy the improvements, at last.. edit: I think there is one more thing that should be done pre-release: getting rid of implicit |
the backend lib will after python-kasa/python-kasa#59 fetch all the necessary wanted in a single update cycle.
|
I'm in favor of removing the automatic updates everywhere. I think it should be up to the user of the library to determine when its best to ask for information. |
A single update() will now fetch information from all interesting modules, including the current device state and the emeter information. In practice, this will allow dropping the number of I/O reqs per homeassistant update cycle to 1, which is paramount at least for bulbs which are very picky about sequential accesses. This can be further extend to other modules/methods, if needed. Currently fetched data: * sysinfo * realtime, today's and this months emeter stats New properties: * emeter_realtime: return the most recent emeter information, update()-version of get_emeter_realtime() * emeter_today: returning today's energy consumption * emeter_this_month: same for this month Other changes: * Accessing @requires_update properties will cause SmartDeviceException if the device has not ever been update()d * Fix __repr__ for devices that haven't been updated * Smartbulb uses now the state data from get_sysinfo instead of separately querying the bulb service * SmartStrip's state_information no longer lists onsince for separate plugs * The above mentioned properties are now printed out by cli * Simplify is_on handling for bulbs
…README.md instructions. fixes python-kasa#61
9c641a5 to
4faa24a
Compare
Codecov Report
@@ Coverage Diff @@
## master #59 +/- ##
==========================================
- Coverage 78.73% 76.27% -2.47%
==========================================
Files 7 7
Lines 790 826 +36
Branches 104 110 +6
==========================================
+ Hits 622 630 +8
- Misses 150 172 +22
- Partials 18 24 +6
Continue to review full report at Codecov.
|
|
I presume that we can merge this now (and fix any issues in future PRs). |
the backend lib will after python-kasa/python-kasa#59 fetch all the necessary wanted in a single update cycle.
the backend lib will after python-kasa/python-kasa#59 fetch all the necessary wanted in a single update cycle.
the backend lib will after python-kasa/python-kasa#59 fetch all the necessary wanted in a single update cycle.
the backend lib will after python-kasa/python-kasa#59 fetch all the necessary wanted in a single update cycle.
A single update() will now fetch information from all interesting modules,
including the current device state and the emeter information.
In practice, this will allow dropping the number of I/O reqs per homeassistant update cycle to 1,
which is paramount at least for bulbs which are very picky about sequential accesses.
This can be further extend to other modules/methods, if needed.
This will also remove the implicit
update()calls from device state changing methods such asset_brightness(). This allows executing multiple changes on a device without unnecessary I/O.Currently fetched data:
New properties:
Other changes:
Closes #53, closes #61.