mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Deprecate camera async_handle_web_rtc_offer (#131285)
This commit is contained in:
parent
97f574a86a
commit
754cf1fdb4
@ -55,6 +55,7 @@ from homeassistant.helpers.deprecation import (
|
||||
DeprecatedConstantEnum,
|
||||
all_with_deprecated_constants,
|
||||
check_if_deprecated_constant,
|
||||
deprecated_function,
|
||||
dir_with_deprecated_constants,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity, EntityDescription
|
||||
@ -665,7 +666,10 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
"""
|
||||
if self._supports_native_sync_webrtc:
|
||||
try:
|
||||
answer = await self.async_handle_web_rtc_offer(offer_sdp)
|
||||
answer = await deprecated_function(
|
||||
"async_handle_async_webrtc_offer",
|
||||
breaks_in_ha_version="2025.6",
|
||||
)(self.async_handle_web_rtc_offer)(offer_sdp)
|
||||
except ValueError as ex:
|
||||
_LOGGER.error("Error handling WebRTC offer: %s", ex)
|
||||
send_message(
|
||||
|
@ -65,7 +65,6 @@ class MockCamera(Camera):
|
||||
|
||||
_attr_name = "Test"
|
||||
_attr_supported_features: CameraEntityFeature = CameraEntityFeature.STREAM
|
||||
_attr_frontend_stream_type: StreamType = StreamType.WEB_RTC
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the mock entity."""
|
||||
@ -684,24 +683,33 @@ async def test_websocket_webrtc_offer_failure(
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_test_webrtc_cameras")
|
||||
async def test_websocket_webrtc_offer_sync(
|
||||
hass: HomeAssistant,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
init_test_integration: MockCamera,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test sync WebRTC stream offer."""
|
||||
client = await hass_ws_client(hass)
|
||||
init_test_integration.set_sync_answer(WEBRTC_ANSWER)
|
||||
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "camera/webrtc/offer",
|
||||
"entity_id": "camera.test",
|
||||
"entity_id": "camera.sync",
|
||||
"offer": WEBRTC_OFFER,
|
||||
}
|
||||
)
|
||||
response = await client.receive_json()
|
||||
|
||||
assert (
|
||||
"tests.components.camera.conftest",
|
||||
logging.WARNING,
|
||||
(
|
||||
"async_handle_web_rtc_offer was called from camera, this is a deprecated "
|
||||
"function which will be removed in HA Core 2025.6. Use "
|
||||
"async_handle_async_webrtc_offer instead"
|
||||
),
|
||||
) in caplog.record_tuples
|
||||
assert response["type"] == TYPE_RESULT
|
||||
assert response["success"]
|
||||
subscription_id = response["id"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user