mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Defer module updates for less volatile modules (#1052)
Addresses stability issues on older hw device versions - Handles module timeout errors better by querying modules individually on errors and disabling problematic modules like Firmware that go out to the internet to get updates. - Addresses an issue with the Led module on P100 hardware version 1.0 which appears to have a memory leak and will cause the device to crash after approximately 500 calls. - Delays updates of modules that do not have regular changes like LightPreset and LightEffect and enables them to be updated on the next update cycle only if required values have changed.
This commit is contained in:
@@ -9,7 +9,7 @@ import copy
|
||||
from typing import Any
|
||||
|
||||
from ..effects import SmartLightEffect
|
||||
from ..smartmodule import Module, SmartModule
|
||||
from ..smartmodule import Module, SmartModule, allow_update_after
|
||||
|
||||
|
||||
class LightEffect(SmartModule, SmartLightEffect):
|
||||
@@ -17,6 +17,7 @@ class LightEffect(SmartModule, SmartLightEffect):
|
||||
|
||||
REQUIRED_COMPONENT = "light_effect"
|
||||
QUERY_GETTER_NAME = "get_dynamic_light_effect_rules"
|
||||
MINIMUM_UPDATE_INTERVAL_SECS = 60
|
||||
AVAILABLE_BULB_EFFECTS = {
|
||||
"L1": "Party",
|
||||
"L2": "Relax",
|
||||
@@ -130,6 +131,7 @@ class LightEffect(SmartModule, SmartLightEffect):
|
||||
|
||||
return brightness
|
||||
|
||||
@allow_update_after
|
||||
async def set_brightness(
|
||||
self,
|
||||
brightness: int,
|
||||
@@ -156,6 +158,7 @@ class LightEffect(SmartModule, SmartLightEffect):
|
||||
|
||||
return await self.call("edit_dynamic_light_effect_rule", new_effect)
|
||||
|
||||
@allow_update_after
|
||||
async def set_custom_effect(
|
||||
self,
|
||||
effect_dict: dict,
|
||||
|
Reference in New Issue
Block a user