Remove deprecated camera constants (#131796)
parent
717f2ee206
commit
28ec8272ee
|
@ -67,9 +67,7 @@ from homeassistant.helpers.template import Template
|
|||
from homeassistant.helpers.typing import ConfigType, VolDictType
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
from .const import ( # noqa: F401
|
||||
_DEPRECATED_STREAM_TYPE_HLS,
|
||||
_DEPRECATED_STREAM_TYPE_WEB_RTC,
|
||||
from .const import (
|
||||
CAMERA_IMAGE_TIMEOUT,
|
||||
CAMERA_STREAM_SOURCE_TIMEOUT,
|
||||
CONF_DURATION,
|
||||
|
@ -135,16 +133,6 @@ class CameraEntityFeature(IntFlag):
|
|||
STREAM = 2
|
||||
|
||||
|
||||
# These SUPPORT_* constants are deprecated as of Home Assistant 2022.5.
|
||||
# Pleease use the CameraEntityFeature enum instead.
|
||||
_DEPRECATED_SUPPORT_ON_OFF: Final = DeprecatedConstantEnum(
|
||||
CameraEntityFeature.ON_OFF, "2025.1"
|
||||
)
|
||||
_DEPRECATED_SUPPORT_STREAM: Final = DeprecatedConstantEnum(
|
||||
CameraEntityFeature.STREAM, "2025.1"
|
||||
)
|
||||
|
||||
|
||||
DEFAULT_CONTENT_TYPE: Final = "image/jpeg"
|
||||
ENTITY_IMAGE_URL: Final = "/api/camera_proxy/{0}?token={1}"
|
||||
|
||||
|
|
|
@ -3,15 +3,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from enum import StrEnum
|
||||
from functools import partial
|
||||
from typing import TYPE_CHECKING, Final
|
||||
|
||||
from homeassistant.helpers.deprecation import (
|
||||
DeprecatedConstantEnum,
|
||||
all_with_deprecated_constants,
|
||||
check_if_deprecated_constant,
|
||||
dir_with_deprecated_constants,
|
||||
)
|
||||
from homeassistant.util.hass_dict import HassKey
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
@ -58,17 +51,3 @@ class StreamType(StrEnum):
|
|||
|
||||
HLS = "hls"
|
||||
WEB_RTC = "web_rtc"
|
||||
|
||||
|
||||
# These constants are deprecated as of Home Assistant 2022.5
|
||||
# Please use the StreamType enum instead.
|
||||
_DEPRECATED_STREAM_TYPE_HLS = DeprecatedConstantEnum(StreamType.HLS, "2025.1")
|
||||
_DEPRECATED_STREAM_TYPE_WEB_RTC = DeprecatedConstantEnum(StreamType.WEB_RTC, "2025.1")
|
||||
|
||||
|
||||
# These can be removed if no deprecated constant are in this module anymore
|
||||
__getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
|
||||
__dir__ = partial(
|
||||
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
|
||||
)
|
||||
__all__ = all_with_deprecated_constants(globals())
|
||||
|
|
|
@ -802,32 +802,13 @@ async def test_use_stream_for_stills(
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
"module",
|
||||
[camera, camera.const],
|
||||
[camera],
|
||||
)
|
||||
def test_all(module: ModuleType) -> None:
|
||||
"""Test module.__all__ is correctly set."""
|
||||
help_test_all(module)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"enum",
|
||||
list(camera.const.StreamType),
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"module",
|
||||
[camera, camera.const],
|
||||
)
|
||||
def test_deprecated_stream_type_constants(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
enum: camera.const.StreamType,
|
||||
module: ModuleType,
|
||||
) -> None:
|
||||
"""Test deprecated stream type constants."""
|
||||
import_and_test_deprecated_constant_enum(
|
||||
caplog, module, enum, "STREAM_TYPE_", "2025.1"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"enum",
|
||||
list(camera.const.CameraState),
|
||||
|
@ -845,20 +826,6 @@ def test_deprecated_state_constants(
|
|||
import_and_test_deprecated_constant_enum(caplog, module, enum, "STATE_", "2025.10")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_feature",
|
||||
list(camera.CameraEntityFeature),
|
||||
)
|
||||
def test_deprecated_support_constants(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
entity_feature: camera.CameraEntityFeature,
|
||||
) -> None:
|
||||
"""Test deprecated support constants."""
|
||||
import_and_test_deprecated_constant_enum(
|
||||
caplog, camera, entity_feature, "SUPPORT_", "2025.1"
|
||||
)
|
||||
|
||||
|
||||
def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) -> None:
|
||||
"""Test deprecated supported features ints."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue