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:
Steven B.
2024-07-23 19:02:20 +01:00
committed by GitHub
parent 06ff598d9c
commit 58afeb28a1
5 changed files with 19 additions and 91 deletions

View File

@@ -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):

View File

@@ -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):

View File

@@ -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."""