mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-04 09:44:14 +00:00
Handle module errors more robustly and add query params to light preset and transition (#1036)
Ensures that all modules try to access their data in `_post_update_hook` in a safe manner and disable themselves if there's an error. Also adds parameters to get_preset_rules and get_on_off_gradually_info to fix issues with recent firmware updates. [#1033](https://github.com/python-kasa/python-kasa/issues/1033)
This commit is contained in:
@@ -284,6 +284,15 @@ class SmartRequest:
|
||||
"""Get preset rules."""
|
||||
return SmartRequest("get_preset_rules", params or SmartRequest.GetRulesParams())
|
||||
|
||||
@staticmethod
|
||||
def get_on_off_gradually_info(
|
||||
params: SmartRequestParams | None = None,
|
||||
) -> SmartRequest:
|
||||
"""Get preset rules."""
|
||||
return SmartRequest(
|
||||
"get_on_off_gradually_info", params or SmartRequest.SmartRequestParams()
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_auto_light_info() -> SmartRequest:
|
||||
"""Get auto light info."""
|
||||
@@ -382,7 +391,7 @@ COMPONENT_REQUESTS = {
|
||||
"auto_light": [SmartRequest.get_auto_light_info()],
|
||||
"light_effect": [SmartRequest.get_dynamic_light_effect_rules()],
|
||||
"bulb_quick_control": [],
|
||||
"on_off_gradually": [SmartRequest.get_raw_request("get_on_off_gradually_info")],
|
||||
"on_off_gradually": [SmartRequest.get_on_off_gradually_info()],
|
||||
"light_strip": [],
|
||||
"light_strip_lighting_effect": [
|
||||
SmartRequest.get_raw_request("get_lighting_effect")
|
||||
|
Reference in New Issue
Block a user