mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
fix: unifiprotect prevent RTSP repair for third-party cameras (#132212)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
1fe2a928a2
commit
cb36184511
@ -90,7 +90,7 @@ def _get_camera_channels(
|
|||||||
is_default = False
|
is_default = False
|
||||||
|
|
||||||
# no RTSP enabled use first channel with no stream
|
# 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)
|
_create_rtsp_repair(hass, entry, data, camera)
|
||||||
yield camera, camera.channels[0], True
|
yield camera, camera.channels[0], True
|
||||||
else:
|
else:
|
||||||
|
@ -363,3 +363,30 @@ async def test_rtsp_writable_fix_when_not_setup(
|
|||||||
ufp.api.update_device.assert_called_with(
|
ufp.api.update_device.assert_called_with(
|
||||||
ModelType.CAMERA, doorbell.id, {"channels": channels}
|
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…
x
Reference in New Issue
Block a user