diff --git a/homeassistant/components/unifiprotect/camera.py b/homeassistant/components/unifiprotect/camera.py index f3d26ca7cc05..e3462a5e0d70 100644 --- a/homeassistant/components/unifiprotect/camera.py +++ b/homeassistant/components/unifiprotect/camera.py @@ -92,7 +92,11 @@ def _get_camera_channels( # no RTSP enabled use first channel with no stream if is_default and not camera.is_third_party_camera: - _create_rtsp_repair(hass, entry, data, camera) + # Only create repair issue if RTSP is not disabled globally + if not data.disable_stream: + _create_rtsp_repair(hass, entry, data, camera) + else: + ir.async_delete_issue(hass, DOMAIN, f"rtsp_disabled_{camera.id}") yield camera, camera.channels[0], True else: ir.async_delete_issue(hass, DOMAIN, f"rtsp_disabled_{camera.id}") diff --git a/tests/components/unifiprotect/test_repairs.py b/tests/components/unifiprotect/test_repairs.py index 6bd42b5b39ac..b0fdd343e64b 100644 --- a/tests/components/unifiprotect/test_repairs.py +++ b/tests/components/unifiprotect/test_repairs.py @@ -7,9 +7,10 @@ from unittest.mock import AsyncMock from uiprotect.data import Camera, CloudAccount, Version -from homeassistant.components.unifiprotect.const import DOMAIN +from homeassistant.components.unifiprotect.const import CONF_DISABLE_RTSP, DOMAIN from homeassistant.config_entries import SOURCE_REAUTH from homeassistant.core import HomeAssistant +from homeassistant.helpers import issue_registry as ir from .utils import MockUFPFixture, init_entry @@ -282,3 +283,26 @@ async def test_rtsp_no_fix_if_third_party( assert msg["success"] assert not msg["result"]["issues"] + + +async def test_rtsp_no_fix_if_globally_disabled( + hass: HomeAssistant, + ufp: MockUFPFixture, + doorbell: Camera, + issue_registry: ir.IssueRegistry, +) -> None: + """Test no RTSP disabled warning if RTSP is globally disabled on integration.""" + + for channel in doorbell.channels: + channel.is_rtsp_enabled = False + + # Set RTSP globally disabled in config entry options + hass.config_entries.async_update_entry( + ufp.entry, + options={**ufp.entry.options, CONF_DISABLE_RTSP: True}, + ) + + await init_entry(hass, ufp, [doorbell]) + await async_process_repairs_platforms(hass) + + assert len(issue_registry.issues) == 0