mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
270614aa02
This improves the initial update cycle to fetch the information as early as possible and avoid requesting unnecessary information (like the child component listing) in every subsequent call of `update()`. The initial update performs the following steps: 1. `component_nego` (for components) and `get_device_info` (for common device info) are requested as first, and their results are stored in the internal state to allow individual modules (like colortemp) to access the data during the initialization later on. 2. If `child_device` component is available, the child device list and their components is requested separately to initialize the children. 3. The modules are initialized based on component lists, making the queries available for the regular `update()`. 4. Finally, a query requesting all module-defined queries is executed, including also those that we already did above, like the device info. All subsequent updates will only involve queries that are defined by the supported modules. This also means that we do not currently support adding & removing child devices on the fly. The internal state contains now only the responses for the most recent update (i.e., no component information is directly available anymore, but needs to be accessed separately if needed). If component information is wanted from homeassistant users via diagnostics reports, the diagnostic platform needs to be adapted to acquire this separately. |
||
---|---|---|
.. | ||
modules | ||
__init__.py | ||
smartbulb.py | ||
smartchilddevice.py | ||
smartdevice.py | ||
smartmodule.py |