mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Deprecate RTSPtoWebRTC (#131467)
* Deprecate RTSPtoWebRTC * Update homeassistant/components/rtsp_to_webrtc/strings.json Co-authored-by: Allen Porter <allen@thebends.org> * Updated text --------- Co-authored-by: Allen Porter <allen@thebends.org>
This commit is contained in:
parent
7aa30758f9
commit
1b62e12261
@ -30,6 +30,7 @@ from homeassistant.components import camera
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
|
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
|
||||||
|
from homeassistant.helpers import issue_registry as ir
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -40,10 +41,24 @@ DATA_UNSUB = "unsub"
|
|||||||
TIMEOUT = 10
|
TIMEOUT = 10
|
||||||
CONF_STUN_SERVER = "stun_server"
|
CONF_STUN_SERVER = "stun_server"
|
||||||
|
|
||||||
|
_DEPRECATED = "deprecated"
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up RTSPtoWebRTC from a config entry."""
|
"""Set up RTSPtoWebRTC from a config entry."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
|
ir.async_create_issue(
|
||||||
|
hass,
|
||||||
|
DOMAIN,
|
||||||
|
_DEPRECATED,
|
||||||
|
breaks_in_ha_version="2025.6.0",
|
||||||
|
is_fixable=False,
|
||||||
|
severity=ir.IssueSeverity.WARNING,
|
||||||
|
translation_key=_DEPRECATED,
|
||||||
|
translation_placeholders={
|
||||||
|
"go2rtc": "[go2rtc](https://www.home-assistant.io/integrations/go2rtc/)",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
client: WebRTCClientInterface
|
client: WebRTCClientInterface
|
||||||
try:
|
try:
|
||||||
@ -98,6 +113,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
if DOMAIN in hass.data:
|
if DOMAIN in hass.data:
|
||||||
del hass.data[DOMAIN]
|
del hass.data[DOMAIN]
|
||||||
|
ir.async_delete_issue(hass, DOMAIN, _DEPRECATED)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,12 @@
|
|||||||
"server_unreachable": "[%key:component::rtsp_to_webrtc::config::error::server_unreachable%]"
|
"server_unreachable": "[%key:component::rtsp_to_webrtc::config::error::server_unreachable%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"issues": {
|
||||||
|
"deprecated": {
|
||||||
|
"title": "The RTSPtoWebRTC integration is deprecated",
|
||||||
|
"description": "The RTSPtoWebRTC integration is deprecated and will be removed. Please use the {go2rtc} integration instead, which is enabled by default and provides a better experience. You only need to remove the RTSPtoWebRTC config entry."
|
||||||
|
}
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
|
@ -14,10 +14,12 @@ from homeassistant.components.rtsp_to_webrtc import DOMAIN
|
|||||||
from homeassistant.components.websocket_api import TYPE_RESULT
|
from homeassistant.components.websocket_api import TYPE_RESULT
|
||||||
from homeassistant.config_entries import ConfigEntryState
|
from homeassistant.config_entries import ConfigEntryState
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers import issue_registry as ir
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from .conftest import SERVER_URL, STREAM_SOURCE, ComponentSetup
|
from .conftest import SERVER_URL, STREAM_SOURCE, ComponentSetup
|
||||||
|
|
||||||
|
from tests.common import MockConfigEntry
|
||||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||||
from tests.typing import WebSocketGenerator
|
from tests.typing import WebSocketGenerator
|
||||||
|
|
||||||
@ -33,15 +35,28 @@ async def setup_homeassistant(hass: HomeAssistant):
|
|||||||
await async_setup_component(hass, "homeassistant", {})
|
await async_setup_component(hass, "homeassistant", {})
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("rtsp_to_webrtc_client")
|
||||||
async def test_setup_success(
|
async def test_setup_success(
|
||||||
hass: HomeAssistant, rtsp_to_webrtc_client: Any, setup_integration: ComponentSetup
|
hass: HomeAssistant,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test successful setup and unload."""
|
"""Test successful setup and unload."""
|
||||||
await setup_integration()
|
config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
|
assert await async_setup_component(hass, DOMAIN, {})
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
assert issue_registry.async_get_issue(DOMAIN, "deprecated")
|
||||||
|
|
||||||
entries = hass.config_entries.async_entries(DOMAIN)
|
entries = hass.config_entries.async_entries(DOMAIN)
|
||||||
assert len(entries) == 1
|
assert len(entries) == 1
|
||||||
assert entries[0].state is ConfigEntryState.LOADED
|
assert entries[0].state is ConfigEntryState.LOADED
|
||||||
|
await hass.config_entries.async_unload(entries[0].entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
assert not hass.data.get(DOMAIN)
|
||||||
|
assert entries[0].state is ConfigEntryState.NOT_LOADED
|
||||||
|
assert not issue_registry.async_get_issue(DOMAIN, "deprecated")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("config_entry_data", [{}])
|
@pytest.mark.parametrize("config_entry_data", [{}])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user