python-kasa/kasa
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
..
iot Add iot brightness feature (#808) 2024-03-06 16:45:08 +00:00
smart Revise device initialization and subsequent updates (#807) 2024-03-15 17:18:13 +01:00
tests Revise device initialization and subsequent updates (#807) 2024-03-15 17:18:13 +01:00
__init__.py Remove SmartPlug in favor of SmartDevice (#781) 2024-02-22 14:34:55 +01:00
aestransport.py Fix slow aestransport and cli tests (#816) 2024-03-11 10:17:12 +00:00
bulb.py Refactor devices into subpackages and deprecate old names (#716) 2024-02-04 16:20:08 +01:00
cli.py Add WallSwitch device type and autogenerate supported devices docs (#758) 2024-03-01 18:32:45 +00:00
credentials.py Cleanup credentials handling (#605) 2024-01-03 19:26:52 +01:00
device_factory.py Add WallSwitch device type and autogenerate supported devices docs (#758) 2024-03-01 18:32:45 +00:00
device_type.py Add WallSwitch device type and autogenerate supported devices docs (#758) 2024-03-01 18:32:45 +00:00
device.py Simplify device __repr__ (#805) 2024-03-05 13:35:19 +01:00
deviceconfig.py Add initial support for H100 and T315 (#776) 2024-02-22 23:09:38 +01:00
discover.py Rename and deprecate exception classes (#739) 2024-02-21 16:52:55 +01:00
effects.py Add effect support for light strips (#293) 2022-03-21 22:10:12 +01:00
emeterstatus.py Avoid crashing on childdevice property accesses (#732) 2024-02-02 17:29:14 +01:00
exceptions.py Rename and deprecate exception classes (#739) 2024-02-21 16:52:55 +01:00
feature.py Support for on_off_gradually v2+ (#793) 2024-02-24 02:16:43 +01:00
httpclient.py Rename and deprecate exception classes (#739) 2024-02-21 16:52:55 +01:00
iotprotocol.py Rename and deprecate exception classes (#739) 2024-02-21 16:52:55 +01:00
json.py Generate AES KeyPair lazily (#687) 2024-01-23 15:29:27 +00:00
klaptransport.py Retry query on 403 after succesful handshake (#785) 2024-02-22 18:02:03 +01:00
module.py Add T315 fixture, tests for humidity&temperature modules (#802) 2024-03-06 18:04:09 +00:00
plug.py Refactor devices into subpackages and deprecate old names (#716) 2024-02-04 16:20:08 +01:00
protocol.py Use hashlib in place of hashes.Hash (#714) 2024-01-26 06:57:56 -10:00
py.typed Add py.typed to flag that the package is typed (#251) 2021-11-15 18:21:24 +01:00
smartprotocol.py Support multiple child requests (#795) 2024-02-26 17:13:46 +01:00
xortransport.py Rename and deprecate exception classes (#739) 2024-02-21 16:52:55 +01:00