Skip to content

feat(web_api): add inbox message retrieval - #840

Draft
ximex wants to merge 1 commit into
Python-roborock:mainfrom
ximex:inbox-messages
Draft

feat(web_api): add inbox message retrieval#840
ximex wants to merge 1 commit into
Python-roborock:mainfrom
ximex:inbox-messages

Conversation

@ximex

@ximexximex commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds retrieval of the user/device inbox to RoborockApiClient. This is the
app's server-side, localized event history for a device (cleaning finished,
battery low, ...) — richer context than the raw MQTT status. Part of #739.

GET /user/inbox on the rriot API host (api-eu.roborock.com) with Hawk auth.

What's added

  • InboxMessage dataclass (id, trigger, duid, subject, content,
    extra, read, create_time).
  • get_inbox_messages(user_data, message_type="NOTIFICATION", duid=None, offset=0, limit=20) -> list of InboxMessage, newest first.

Message types

  • NOTIFICATION / WARNING — device-scoped (require duid).
  • SYSTEM / MARKETING / SHARE — account-scoped.

extra carries a raw JSON string with action/templateId metadata; the
templateId is a language-independent message-type code (more stable than the
localized text).

Verification

  • Logged against a real account (read-only) — returned real device events.
  • New unit test + aioresponses fixture; ruff clean.

CopilotAI review requested due to automatic review settings June 3, 2026 22:21

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for fetching Roborock “inbox” messages via the web API and introduces a corresponding data container plus test coverage.

Changes:

  • Add RoborockApiClient.get_inbox_messages() that calls /user/inbox using Hawk auth.
  • Introduce InboxMessage container for parsed inbox message entries.
  • Add an aioresponses fixture route and a new async test validating message parsing.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

FileDescription
tests/test_web_api.pyAdds a new async test for fetching inbox messages.
tests/fixtures/web_api_fixtures.pyMocks the /user/inbox endpoint response for tests.
roborock/web_api.pyImplements get_inbox_messages() and imports InboxMessage.
roborock/data/containers.pyAdds InboxMessage dataclass container.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadtests/test_web_api.py Outdated
Comment on lines +77 to +81
async def test_get_inbox_messages():
"""Test that we can fetch device inbox messages."""
api = RoborockApiClient(username="test_user@gmail.com")
ud = await api.pass_login("password")
messages = await api.get_inbox_messages(ud, "NOTIFICATION", duid="abc123")
Comment threadroborock/web_api.py
"Authorization": _get_hawk_authentication(rriot, path, params=params),
},
)
inbox_response = await inbox_request.request("get", path, params=params)
@Lash-L
Lash-L marked this pull request as draft June 3, 2026 23:52
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ximex