Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unifiprotect prevent RTSP repair for third-party cameras #132212

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/unifiprotect/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _get_camera_channels(
is_default = False

# no RTSP enabled use first channel with no stream
if is_default:
if is_default and not camera.is_third_party_camera:
_create_rtsp_repair(hass, entry, data, camera)
yield camera, camera.channels[0], True
else:
Expand Down
27 changes: 27 additions & 0 deletions tests/components/unifiprotect/test_repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,30 @@ async def test_rtsp_writable_fix_when_not_setup(
ufp.api.update_device.assert_called_with(
ModelType.CAMERA, doorbell.id, {"channels": channels}
)


async def test_rtsp_no_fix_if_third_party(
hass: HomeAssistant,
ufp: MockUFPFixture,
doorbell: Camera,
hass_ws_client: WebSocketGenerator,
) -> None:
"""Test no RTSP disabled warning if camera is third-party."""

for channel in doorbell.channels:
channel.is_rtsp_enabled = False
for user in ufp.api.bootstrap.users.values():
user.all_permissions = []

ufp.api.get_camera = AsyncMock(return_value=doorbell)
doorbell.is_third_party_camera = True

await init_entry(hass, ufp, [doorbell])
await async_process_repairs_platforms(hass)
ws_client = await hass_ws_client(hass)

await ws_client.send_json({"id": 1, "type": "repairs/list_issues"})
msg = await ws_client.receive_json()

assert msg["success"]
assert not msg["result"]["issues"]
Loading