Skip to content

feat: add photo for obstacle avoidance#880

Open
Lash-L wants to merge 3 commits into
mainfrom
roborock_photo_obstacle
Open

feat: add photo for obstacle avoidance#880
Lash-L wants to merge 3 commits into
mainfrom
roborock_photo_obstacle

Conversation

@Lash-L

@Lash-L Lash-L commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

This is kind of a fun one, it will show the photos from the vacuum when it sees obstacles (if the vac supports it).

Let me know if you want me to split it up into a few different smaller PRs there are a couple of quick and easy PRs i can break out if you'd like

HA will have to call this and cache images appropriately and gate on features.

@Lash-L
Lash-L requested review from allenporter and Copilot July 19, 2026 14:58

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.92035% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
roborock/devices/traits/v1/obstacle_photos.py 85.96% 4 Missing and 4 partials ⚠️
roborock/protocols/v1_protocol.py 77.77% 3 Missing and 3 partials ⚠️
roborock/devices/rpc/v1_channel.py 89.47% 1 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
roborock/device_features.py 97.72% <100.00%> (+0.01%) ⬆️
roborock/devices/device_manager.py 98.58% <ø> (ø)
roborock/devices/traits/v1/__init__.py 91.50% <100.00%> (+0.49%) ⬆️
roborock/devices/traits/v1/common.py 93.75% <100.00%> (ø)
roborock/roborock_typing.py 100.00% <100.00%> (+3.74%) ⬆️
tests/devices/rpc/test_v1_channel.py 99.09% <100.00%> (+0.08%) ⬆️
tests/devices/test_v1_device.py 100.00% <100.00%> (ø)
tests/devices/traits/v1/fixtures.py 100.00% <100.00%> (ø)
tests/devices/traits/v1/test_obstacle_photos.py 100.00% <100.00%> (ø)
roborock/devices/rpc/v1_channel.py 88.81% <89.47%> (+0.04%) ⬆️
... and 2 more

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@allenporter allenporter 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.

Very cool, high level i have one starting comment about protocol layering. The idea behind some of these layers was to not have to pass security data everywhere.

public_key = await self._standard_rpc_channel.send_command(RoborockCommand.GET_RANDOM_PKEY)
if not isinstance(public_key, dict) or not isinstance(public_key.get("pub_key"), dict):
raise RoborockException("get_random_pkey response did not contain a public key")
security = self._security_data.to_dict()["security"]

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.

Can we put this behind the blob rpc channel?

That is, it can handle wrapping the payload adding necessary lower level security information given a higher level command + params. Or there can be two things, a blob channel and a blob rpc channel, if you want to keep the internal layers separate.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

How is that?

@Lash-L
Lash-L requested a review from allenporter July 20, 2026 02:19
allenporter
allenporter previously approved these changes Jul 20, 2026
return bool((response[0] >> _MAP_OBJECT_PHOTO_ENABLED_BIT) & 1)

async def get_photo(self, photo_id: str, photo_type: int = _PHOTO_TYPE_SMALL) -> ObstaclePhoto:
"""Fetch an obstacle photo by its map photo id."""

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.

can you include details in the get photo pydoc about how you obtain these photo ids or photo types? (should photo type be an enum, or not exposed at all?)

Comment thread roborock/protocols/v1_protocol.py Outdated
raise RoborockException("Invalid V1 blob response format")
try:
data = Utils.decompress(payload[header_size:end_offset])
except Exception as err:

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.

i think we can probably make this more narrow to just exceptions that we're expecting here

Sign up for free to 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.

3 participants