Improve type hints in tuya vacuum (#90041)

This commit is contained in:
epenet 2023-03-21 13:25:19 +01:00 committed by GitHub
parent 2a0401366b
commit f01f5e1d2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,9 +190,14 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
self._send_command([{"code": DPCode.SUCTION, "value": fan_speed}])
def send_command(
self, command: str, params: dict | list | None = None, **kwargs: Any
self,
command: str,
params: dict[str, Any] | list[Any] | None = None,
**kwargs: Any,
) -> None:
"""Send raw command."""
if not params:
raise ValueError("Params cannot be omitted for Tuya vacuum commands")
if not isinstance(params, list):
raise TypeError("Params must be a list for Tuya vacuum commands")
self._send_command([{"code": command, "value": params[0]}])