Skip to content

Commit ff51929

Browse files
committed
chore: merge
2 parents 8eabcf5 + b7b47cb commit ff51929

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

roborock/devices/b01_channel.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,26 @@ def find_response(response_message: RoborockMessage) -> None:
4343
_LOGGER.info("Failed to decode b01 message: %s: %s", response_message, ex)
4444
return
4545

46-
for _, dps_value in decoded_dps.items():
46+
for dps_value in decoded_dps.values():
4747
# valid responses are JSON strings wrapped in the dps value
48-
if isinstance(dps_value, str):
49-
try:
50-
inner = json.loads(dps_value)
51-
except (json.JSONDecodeError, TypeError):
52-
_LOGGER.debug("Received unexpected response: %s", dps_value)
53-
continue
48+
if not isinstance(dps_value, str):
49+
_LOGGER.debug("Received unexpected response: %s", dps_value)
50+
continue
5451

55-
if isinstance(inner, dict) and inner.get("msgId") == msg_id:
56-
_LOGGER.debug("Received query response: %s", inner)
57-
data = inner.get("data")
58-
if not future.done():
59-
if isinstance(data, dict):
60-
future.set_result(data)
61-
else:
62-
future.set_exception(RoborockException(f"Unexpected data type for response: {data}"))
63-
else:
52+
try:
53+
inner = json.loads(dps_value)
54+
except (json.JSONDecodeError, TypeError):
6455
_LOGGER.debug("Received unexpected response: %s", dps_value)
56+
continue
57+
58+
if isinstance(inner, dict) and inner.get("msgId") == msg_id:
59+
_LOGGER.debug("Received query response: %s", inner)
60+
data = inner.get("data")
61+
if not future.done():
62+
if isinstance(data, dict):
63+
future.set_result(data)
64+
else:
65+
future.set_exception(RoborockException(f"Unexpected data type for response: {data}"))
6566

6667
unsub = await mqtt_channel.subscribe(find_response)
6768

roborock/devices/traits/b01/q7/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, channel: MqttChannel) -> None:
2121
self._channel = channel
2222

2323
async def query_values(self, props: list[RoborockB01Props]) -> B01Props | None:
24-
"""Query the device for the values of the given Q7 protocols."""
24+
"""Query the device for the values of the given Q7 properties."""
2525
result = await send_decoded_command(
2626
self._channel, dps=10000, command=RoborockB01Q7Methods.GET_PROP, params={"property": props}
2727
)

0 commit comments

Comments
 (0)