Skip to content

feat: track whether V1 and A01 devices are online - #1094

Open
infy1995 wants to merge 2 commits into
Python-roborock:mainfrom
infy1995:feat/a01-online-notice
Open

infy1995 wants to merge 2 commits into
Python-roborock:mainfrom
infy1995:feat/a01-online-notice

Conversation

@infy1995

@infy1995 infy1995 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Roborock cloud, not the device, publishes a notice on a V1 or A01 device topic when it loses or regains that device (message protocol 500, plain JSON {"online": bool}). The false notice arrived while the device was cut off from the network, so the device could not have sent it. The library dropped the notice, so consumers could not tell a device the cloud has lost from one that only stopped answering.

A01 (device.dyad / device.zeo)

  • is_online is None until something arrives, then follows the notice. Any data message from the device also marks it online.
  • Update listeners fire when it changes, at most once per message. A notice does not move last_message_time.

V1 (device.v1_properties)

  • is_online is None until something arrives, then follows the notice. Any other cloud or local message, and a successful local connection, mean online.
  • add_online_listener() fires only when is_online changes.
  • The value is the last thing heard: losing a connection does not change it.
  • PropertiesApi and traits.v1.create take a new required online_tracker argument.

Testing helpers: set_online() on the base device simulator. While offline it ignores commands, pushes nothing and drops the local connection.

The A01 part is the first step of the Dyad traits work mentioned in #1021. Requests to offline devices and the MQTT health manager are unchanged.

Device check

Run with this branch, listening only. Network blocks were made in the router.

Device Action Result
Saros 10R (roborock.vacuum.a144) switched on notice true; is_online True once the library connected
Saros 10R cut off from Wi-Fi notice false after about 50 s, is_online False; unblocked: true
Saros 10R internet blocked, local network up notice false, then a local message set is_online back to True 8 s later
Dyad F25 Ultra (roborock.wdv.a194) left the dock false after 5 minutes (sleep), true after docking (run with the A01 commit)
Dyad F25 Ultra cut off from Wi-Fi false after about a minute, true after unblock

So the notice comes from the cloud when it loses or regains a device. It is not a sleep announcement from the device, and it does not say why the device was lost. Neither notice moved last_message_time. The notice was not seen on the local connection.

A notice sent while the library is not subscribed is missed, for example while the connect of an offline V1 device is waiting to retry.

Not checked: power loss as such, Zeo, and notices during an MQTT session outage.

Conflicts with open PRs

Tests

  • Full pytest under WSL2 (Ubuntu): 3321 passed, 45 xfailed on Python 3.11 and 3.14
  • pre-commit run --all-files: clean

@github-actions github-actions Bot added documentation Improvements or additions to documentation A01 A01 (Dyad / Zeo) platform labels Nov 29, 2026
@infy1995
infy1995 marked this pull request as draft November 29, 2026 21:54
@infy1995
infy1995 marked this pull request as ready for review November 29, 2026 22:00
@infy1995
infy1995 marked this pull request as draft November 30, 2026 08:24
@infy1995
infy1995 force-pushed the feat/a01-online-notice branch from 71288d7 to ea7a537 Compare November 30, 2026 09:11
@infy1995 infy1995 changed the title feat(a01): track whether the device is online feat: track whether V1 and A01 devices are online Nov 30, 2026
@github-actions github-actions Bot added V1 V1 platform Q10 B01 Q10 platform labels Nov 30, 2026
@infy1995
infy1995 marked this pull request as ready for review November 30, 2026 09:16
The cloud sends a notice (message protocol 500, `{"online": bool}`) on an A01
device's topic when it loses or regains the device, for example when it goes to
sleep and wakes up. The library dropped it, so a sleeping device could not be
told apart from one that stopped answering.

`device.dyad.is_online` (and `device.zeo.is_online`) now follows the notice.
Update listeners fire when it changes, and any data message from the device
also marks it online. The decoder lives in `protocols/online_notice.py`, so
other protocol families can use it. `A01DeviceSimulator.set_online()`
simulates it.
The cloud sends the same online notice on a V1 device's topic when it loses or
regains the device, for example when the vacuum is switched off or loses the
network. Without it a consumer cannot tell such a vacuum from one that stopped
answering.

`device.v1_properties.is_online` follows the notice, and any other message or
a local connection marks the device online. `add_online_listener()` reports
changes. `set_online()` moved to the base simulator, so V1 devices can be
simulated offline too.
@infy1995
infy1995 force-pushed the feat/a01-online-notice branch from ea7a537 to fbd33de Compare November 30, 2026 09:27

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A01 A01 (Dyad / Zeo) platform documentation Improvements or additions to documentation Q10 B01 Q10 platform V1 V1 platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant