python-kasa/kasa/smart/modules
Teemu R 270614aa02
Revise device initialization and subsequent updates (#807)
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.
2024-03-15 17:18:13 +01:00
..
__init__.py Add brightness module (#806) 2024-03-05 15:41:40 +01:00
alarmmodule.py Add initial support for H100 and T315 (#776) 2024-02-22 23:09:38 +01:00
autooffmodule.py Auto auto-off module for smartdevice (#760) 2024-02-19 21:11:11 +01:00
battery.py Add initial support for H100 and T315 (#776) 2024-02-22 23:09:38 +01:00
brightness.py Add brightness module (#806) 2024-03-05 15:41:40 +01:00
childdevicemodule.py Revise device initialization and subsequent updates (#807) 2024-03-15 17:18:13 +01:00
cloudmodule.py Add cloud module for smartdevice (#767) 2024-02-19 20:48:46 +01:00
devicemodule.py Support for on_off_gradually v2+ (#793) 2024-02-24 02:16:43 +01:00
energymodule.py Fix energy module calling get_current_power (#798) 2024-02-28 17:57:02 +00:00
firmware.py Add support for firmware module v1 (#821) 2024-03-12 18:18:08 +01:00
humidity.py Add initial support for H100 and T315 (#776) 2024-02-22 23:09:38 +01:00
ledmodule.py Add smartdevice module for led controls (#761) 2024-02-19 20:59:09 +01:00
lighttransitionmodule.py Support for on_off_gradually v2+ (#793) 2024-02-24 02:16:43 +01:00
reportmodule.py Add initial support for H100 and T315 (#776) 2024-02-22 23:09:38 +01:00
temperature.py Add T315 fixture, tests for humidity&temperature modules (#802) 2024-03-06 18:04:09 +00:00
timemodule.py Initial implementation for modularized smartdevice (#757) 2024-02-19 18:01:31 +01:00