mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Update smart request parameter handling (#1061)
Changes to the smart request handling: - Do not send params if null - Drop the requestId parameter - get_preset_rules doesn't send parameters for preset component version less than 3 - get_led_info no longer sends the wrong parameters - get_on_off_gradually_info no longer sends an empty {} parameter
This commit is contained in:
@@ -16,7 +16,7 @@ class Led(SmartModule, LedInterface):
|
||||
|
||||
def query(self) -> dict:
|
||||
"""Query to execute during the update cycle."""
|
||||
return {self.QUERY_GETTER_NAME: {"led_rule": None}}
|
||||
return {self.QUERY_GETTER_NAME: None}
|
||||
|
||||
@property
|
||||
def mode(self):
|
||||
|
@@ -153,6 +153,9 @@ class LightPreset(SmartModule, LightPresetInterface):
|
||||
"""Query to execute during the update cycle."""
|
||||
if self._state_in_sysinfo: # Child lights can have states in the child info
|
||||
return {}
|
||||
if self.supported_version < 3:
|
||||
return {self.QUERY_GETTER_NAME: None}
|
||||
|
||||
return {self.QUERY_GETTER_NAME: {"start_index": 0}}
|
||||
|
||||
async def _check_supported(self):
|
||||
|
@@ -234,7 +234,7 @@ class LightTransition(SmartModule):
|
||||
if self._state_in_sysinfo:
|
||||
return {}
|
||||
else:
|
||||
return {self.QUERY_GETTER_NAME: {}}
|
||||
return {self.QUERY_GETTER_NAME: None}
|
||||
|
||||
async def _check_supported(self):
|
||||
"""Additional check to see if the module is supported by the device."""
|
||||
|
Reference in New Issue
Block a user