feat: add MQTT QoS support and timestamp to A01 protocol payload - #891
Merged
Merged
Conversation
Add MqttQos enum (AT_MOST_ONCE=0, AT_LEAST_ONCE=1, EXACTLY_ONCE=2) and thread a qos parameter through the publish chain (MqttSession -> MqttChannel -> send_decoded_command). All existing callers keep default AT_MOST_ONCE (backward compatible). Also add a unix timestamp field to A01 encode_mqtt_payload, required by Zeo/Dyad devices for command acceptance.
allenporter
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add MQTT QoS support pipeline and a Unix timestamp field to the A01 protocol — the two minimal, backward-compatible prerequisites needed for Zeo washer START commands to work over MQTT.
Motivation
The device firmware requires three conditions for a START command to be accepted:
AT_LEAST_ONCE; the defaultAT_MOST_ONCE(QoS 0) is silently rejected by the broker."t"field with a Unix timestamp.This PR addresses (1) and (2) — the protocol-level infrastructure. (3) will follow in a separate PR built on top of this one.
These findings build upon the excellent reverse engineering work done in ndwzy/roborock_washer_ha — many thanks for the foundational research.
Changes
New
MqttQosenum (roborock/mqtt/session.py)Thread
qosthrough the publish chainroborock/mqtt/session.pyMqttSession.publish()gainsqosparameterroborock/mqtt/roborock_session.pyRoborockMqttSession.publish()&LazyMqttSession.publish()passqosthroughroborock/devices/transport/mqtt_channel.pyMqttChannel.publish()passesqosthroughroborock/devices/rpc/a01_channel.pysend_decoded_command()gainsqosparameter, passes it on non-query publishesroborock/testing/channel.pyFakeChannel._publish()acceptsqosfor compatibility (not simulated)Add timestamp to A01 payload (
roborock/protocols/a01_protocol.py)encode_mqtt_payload()now includes"t": int(time.time())in every payload.Tests & fixtures
tests/devices/traits/a01/test_init.py— 4 assertions updated to tolerate"t"fieldtests/e2e/__snapshots__/test_device_manager.ambr— snapshot regeneratedtests/fixtures/logging_fixtures.py—deterministic_message_fixturesnow patchestime.timefor A01Breaking changes
None. Every new
qosparameter defaults toMqttQos.AT_MOST_ONCE(= 0), which is identical to the current hardcoded behavior. All existing callers work unchanged.Reviewer notes
Addresses the following feedback from #871:
time.timemonkeypatch intodeterministic_message_fixturesPart of: #871 (closed)