mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Add post update hook to module and use in smart LightEffect (#921)
Adds a post update hook to modules so they can calculate values and collections once rather than on each property access
This commit is contained in:
@@ -107,6 +107,18 @@ class Module(ABC):
|
||||
"""Initialize features after the initial update.
|
||||
|
||||
This can be implemented if features depend on module query responses.
|
||||
It will only be called once per module and will always be called
|
||||
after *_post_update_hook* has been called for every device module and its
|
||||
children's modules.
|
||||
"""
|
||||
|
||||
def _post_update_hook(self): # noqa: B027
|
||||
"""Perform actions after a device update.
|
||||
|
||||
This can be implemented if a module needs to perform actions each time
|
||||
the device has updated like generating collections for property access.
|
||||
It will be called after every update and will be called prior to
|
||||
*_initialize_features* on the first update.
|
||||
"""
|
||||
|
||||
def _add_feature(self, feature: Feature):
|
||||
|
Reference in New Issue
Block a user