From 8ee7b859b43f290162b06f8e2393e6e276dcaeba Mon Sep 17 00:00:00 2001 From: starkillerOG Date: Wed, 9 Sep 2026 11:16:13 +0200 Subject: [PATCH] Fix Reolink sub_channel in ptz_speed capability check (#181675) --- homeassistant/components/reolink/button.py | 2 +- .../reolink/snapshots/test_button.ambr | 21 +++++++------------ tests/components/reolink/test_button.py | 2 +- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/reolink/button.py b/homeassistant/components/reolink/button.py index 45b0616770c5..a3fb49e851d1 100644 --- a/homeassistant/components/reolink/button.py +++ b/homeassistant/components/reolink/button.py @@ -275,7 +275,7 @@ class ReolinkButtonEntity(ReolinkChannelCoordinatorEntity, ButtonEntity): ) if ( - self._host.api.supported(channel, "ptz_speed") + self._host.api.supported(channel, "ptz_speed", sub_channel) and entity_description.ptz_cmd is not None ): self._attr_supported_features = SUPPORT_PTZ_SPEED diff --git a/tests/components/reolink/snapshots/test_button.ambr b/tests/components/reolink/snapshots/test_button.ambr index e95e68c682dc..e3a4372d5fce 100644 --- a/tests/components/reolink/snapshots/test_button.ambr +++ b/tests/components/reolink/snapshots/test_button.ambr @@ -230,7 +230,7 @@ 'platform': 'reolink', 'previous_unique_id': None, 'suggested_object_id': None, - 'supported_features': , + 'supported_features': 0, 'translation_key': 'ptz_auto', 'unique_id': 'ABC1234567D89EFG_DEF7654321D89GHT_ptz_auto', 'unit_of_measurement': None, @@ -240,7 +240,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ : 'test_reolink_cam PTZ continuous rotation', - : , }), 'context': , 'entity_id': 'button.test_reolink_cam_ptz_continuous_rotation', @@ -383,7 +382,7 @@ 'platform': 'reolink', 'previous_unique_id': None, 'suggested_object_id': None, - 'supported_features': , + 'supported_features': 0, 'translation_key': 'ptz_left_down', 'unique_id': 'ABC1234567D89EFG_DEF7654321D89GHT_ptz_left_down', 'unit_of_measurement': None, @@ -393,7 +392,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ : 'test_reolink_cam PTZ left down', - : , }), 'context': , 'entity_id': 'button.test_reolink_cam_ptz_left_down', @@ -434,7 +432,7 @@ 'platform': 'reolink', 'previous_unique_id': None, 'suggested_object_id': None, - 'supported_features': , + 'supported_features': 0, 'translation_key': 'ptz_left_up', 'unique_id': 'ABC1234567D89EFG_DEF7654321D89GHT_ptz_left_up', 'unit_of_measurement': None, @@ -444,7 +442,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ : 'test_reolink_cam PTZ left up', - : , }), 'context': , 'entity_id': 'button.test_reolink_cam_ptz_left_up', @@ -536,7 +533,7 @@ 'platform': 'reolink', 'previous_unique_id': None, 'suggested_object_id': None, - 'supported_features': , + 'supported_features': 0, 'translation_key': 'ptz_right_down', 'unique_id': 'ABC1234567D89EFG_DEF7654321D89GHT_ptz_right_down', 'unit_of_measurement': None, @@ -546,7 +543,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ : 'test_reolink_cam PTZ right down', - : , }), 'context': , 'entity_id': 'button.test_reolink_cam_ptz_right_down', @@ -587,7 +583,7 @@ 'platform': 'reolink', 'previous_unique_id': None, 'suggested_object_id': None, - 'supported_features': , + 'supported_features': 0, 'translation_key': 'ptz_right_up', 'unique_id': 'ABC1234567D89EFG_DEF7654321D89GHT_ptz_right_up', 'unit_of_measurement': None, @@ -597,7 +593,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ : 'test_reolink_cam PTZ right up', - : , }), 'context': , 'entity_id': 'button.test_reolink_cam_ptz_right_up', @@ -739,7 +734,7 @@ 'platform': 'reolink', 'previous_unique_id': None, 'suggested_object_id': None, - 'supported_features': , + 'supported_features': 0, 'translation_key': 'ptz_zoom_in', 'unique_id': 'ABC1234567D89EFG_DEF7654321D89GHT_ptz_zoom_in', 'unit_of_measurement': None, @@ -749,7 +744,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ : 'test_reolink_cam PTZ zoom in', - : , }), 'context': , 'entity_id': 'button.test_reolink_cam_ptz_zoom_in', @@ -790,7 +784,7 @@ 'platform': 'reolink', 'previous_unique_id': None, 'suggested_object_id': None, - 'supported_features': , + 'supported_features': 0, 'translation_key': 'ptz_zoom_out', 'unique_id': 'ABC1234567D89EFG_DEF7654321D89GHT_ptz_zoom_out', 'unit_of_measurement': None, @@ -800,7 +794,6 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ : 'test_reolink_cam PTZ zoom out', - : , }), 'context': , 'entity_id': 'button.test_reolink_cam_ptz_zoom_out', diff --git a/tests/components/reolink/test_button.py b/tests/components/reolink/test_button.py index 07b7a4dab860..c102e900dd29 100644 --- a/tests/components/reolink/test_button.py +++ b/tests/components/reolink/test_button.py @@ -32,7 +32,7 @@ async def test_all_entities( """Test all entities.""" def mock_supported(ch, capability, sub_channel=None): - if capability in {"ptz_stop", "pan", "tilt"}: + if capability in {"ptz_stop", "pan", "tilt", "ptz_speed"}: return sub_channel == 1 if sub_channel is not None: return False