From e828dc2560ec463efd62e8df5955348bb88f825e Mon Sep 17 00:00:00 2001 From: Harry Coureau Date: Tue, 10 Nov 2026 21:09:26 +0000 Subject: [PATCH 1/2] fix: omit obstacle photos for Qrevo 2 Pro --- roborock/devices/traits/v1/device_features.py | 5 ++++ roborock/devices/traits/v1/obstacle_photos.py | 2 +- .../devices/traits/v1/test_obstacle_photos.py | 24 ++++++++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/roborock/devices/traits/v1/device_features.py b/roborock/devices/traits/v1/device_features.py index 1f785e65a..a81595deb 100644 --- a/roborock/devices/traits/v1/device_features.py +++ b/roborock/devices/traits/v1/device_features.py @@ -69,6 +69,11 @@ def __init__(self, product: HomeDataProduct, device_cache: DeviceCache) -> None: for field in fields(self): setattr(self, field.name, False) + @property + def is_obstacle_photo_download_supported(self) -> bool: + """Return whether obstacle-photo downloads are supported for trait discovery.""" + return self.is_ai_recognition_obstacle_supported and self._product.model != "roborock.vacuum.a294" + def is_field_supported(self, cls: type[RoborockBase], field_name: FieldNameBase) -> bool: """Determines if the specified field is supported by this device. diff --git a/roborock/devices/traits/v1/obstacle_photos.py b/roborock/devices/traits/v1/obstacle_photos.py index 3a8d98825..11de2794b 100644 --- a/roborock/devices/traits/v1/obstacle_photos.py +++ b/roborock/devices/traits/v1/obstacle_photos.py @@ -74,7 +74,7 @@ class ObstaclePhotoTrait(RoborockBase, common.V1TraitMixin): command = RoborockCommand.GET_PHOTO converter = ObstaclePhotoConverter() blob_rpc_channel = True - requires_feature = "is_ai_recognition_obstacle_supported" + requires_feature = "is_obstacle_photo_download_supported" def __init__(self, standard_rpc_channel: V1RpcChannel) -> None: """Initialize the obstacle photo trait.""" diff --git a/tests/devices/traits/v1/test_obstacle_photos.py b/tests/devices/traits/v1/test_obstacle_photos.py index 5597ec3e0..ec2a807c2 100644 --- a/tests/devices/traits/v1/test_obstacle_photos.py +++ b/tests/devices/traits/v1/test_obstacle_photos.py @@ -5,6 +5,7 @@ import pytest +from roborock.data import HomeDataDevice from roborock.devices.device import RoborockDevice from roborock.devices.traits.v1.obstacle_photos import ( ObstaclePhotoTrait, @@ -15,6 +16,7 @@ from roborock.protocols.v1_protocol import create_blob_response_decoder from roborock.roborock_message import RoborockMessage, RoborockMessageProtocol from roborock.roborock_typing import RoborockCommand +from tests import mock_data PNG_BYTES = b"\x89PNG\r\n\x1a\nphoto-bytes" JPEG_BYTES = b"\xff\xd8\xff\xe0photo-bytes" @@ -114,7 +116,27 @@ def test_decode_blob_response_does_not_wrap_unexpected_errors() -> None: def test_obstacle_photo_trait_metadata() -> None: """Test obstacle photos use the blob RPC channel when discovered.""" assert ObstaclePhotoTrait.blob_rpc_channel is True - assert ObstaclePhotoTrait.requires_feature == "is_ai_recognition_obstacle_supported" + assert ObstaclePhotoTrait.requires_feature == "is_obstacle_photo_download_supported" + + +@pytest.mark.parametrize( + ("device_info", "photos_supported"), + [ + (mock_data.DEVICE_PRODUCT_PAIRS["home_data_device_qrevo_2_pro.json"][0], False), + (mock_data.DEVICE_PRODUCT_PAIRS["home_data_device_s7_maxv.json"][0], True), + ], + ids=["qrevo_2_pro", "s7_maxv"], +) +async def test_obstacle_photo_discovery( + device_info: HomeDataDevice, + photos_supported: bool, + device: RoborockDevice, + discover_features_fixture: None, +) -> None: + """Discover photo downloads separately from generic obstacle recognition.""" + assert device.v1_properties is not None + assert device.v1_properties.device_features.is_ai_recognition_obstacle_supported is True + assert (device.v1_properties.obstacle_photos is not None) is photos_supported async def test_get_enabled(obstacle_photo_trait: ObstaclePhotoTrait, mock_rpc_channel: AsyncMock) -> None: From cde6801b5ff18e88a05245ac02d5afab15fb4c93 Mon Sep 17 00:00:00 2001 From: Harry Coureau Date: Tue, 10 Nov 2026 21:28:29 +0000 Subject: [PATCH 2/2] fix: name models without obstacle photos --- roborock/devices/traits/v1/device_features.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roborock/devices/traits/v1/device_features.py b/roborock/devices/traits/v1/device_features.py index a81595deb..f8ecb1358 100644 --- a/roborock/devices/traits/v1/device_features.py +++ b/roborock/devices/traits/v1/device_features.py @@ -9,6 +9,9 @@ from roborock.devices.traits.v1 import common from roborock.roborock_typing import RoborockCommand +# Qrevo 2 Pro uses single-line laser obstacle sensing without an RGB camera. +_MODELS_WITHOUT_OBSTACLE_PHOTOS = frozenset({"roborock.vacuum.a294"}) + # Cache of metadata for each trait class _metadata_cache: dict[type[RoborockBase], dict[str, dict[str, Any]]] = {} @@ -72,7 +75,7 @@ def __init__(self, product: HomeDataProduct, device_cache: DeviceCache) -> None: @property def is_obstacle_photo_download_supported(self) -> bool: """Return whether obstacle-photo downloads are supported for trait discovery.""" - return self.is_ai_recognition_obstacle_supported and self._product.model != "roborock.vacuum.a294" + return self.is_ai_recognition_obstacle_supported and self._product.model not in _MODELS_WITHOUT_OBSTACLE_PHOTOS def is_field_supported(self, cls: type[RoborockBase], field_name: FieldNameBase) -> bool: """Determines if the specified field is supported by this device.