Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions roborock/devices/rpc/b01_q7_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
import logging
from collections.abc import Callable
from typing import Any, TypeVar
from typing import TypeAlias, TypeVar

from roborock.devices.transport.mqtt_channel import MqttChannel
from roborock.exceptions import RoborockException
Expand All @@ -16,6 +16,7 @@
_LOGGER = logging.getLogger(__name__)
_TIMEOUT = 10.0
_T = TypeVar("_T")
DecodedB01Response: TypeAlias = dict[str, object] | str


def _matches_map_response(response_message: RoborockMessage, *, version: bytes | None) -> bytes | None:
Expand Down Expand Up @@ -61,11 +62,11 @@ def on_message(response_message: RoborockMessage) -> None:
async def send_decoded_command(
mqtt_channel: MqttChannel,
request_message: Q7RequestMessage,
) -> Any:
) -> DecodedB01Response:
"""Send a command on the MQTT channel and get a decoded response."""
_LOGGER.debug("Sending B01 MQTT command: %s", request_message)

def find_response(response_message: RoborockMessage) -> Any | None:
def find_response(response_message: RoborockMessage) -> DecodedB01Response | None:
"""Handle incoming messages and resolve the future."""
try:
decoded_dps = decode_rpc_response(response_message)
Expand Down