Skip to content

Commit 6c9955f

Browse files
Remove deprecated constants in camera (home-assistant#153363)
1 parent f56b94c commit 6c9955f

File tree

3 files changed

+2
-53
lines changed

3 files changed

+2
-53
lines changed

homeassistant/components/camera/__init__.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@
5151
from homeassistant.core import Event, HomeAssistant, ServiceCall, callback
5252
from homeassistant.exceptions import HomeAssistantError
5353
from homeassistant.helpers import config_validation as cv, issue_registry as ir
54-
from homeassistant.helpers.deprecation import (
55-
DeprecatedConstantEnum,
56-
all_with_deprecated_constants,
57-
check_if_deprecated_constant,
58-
dir_with_deprecated_constants,
59-
)
6054
from homeassistant.helpers.entity import Entity, EntityDescription
6155
from homeassistant.helpers.entity_component import EntityComponent
6256
from homeassistant.helpers.event import async_track_time_interval
@@ -118,12 +112,6 @@
118112
ATTR_MEDIA_PLAYER: Final = "media_player"
119113
ATTR_FORMAT: Final = "format"
120114

121-
# These constants are deprecated as of Home Assistant 2024.10
122-
# Please use the StreamType enum instead.
123-
_DEPRECATED_STATE_RECORDING = DeprecatedConstantEnum(CameraState.RECORDING, "2025.10")
124-
_DEPRECATED_STATE_STREAMING = DeprecatedConstantEnum(CameraState.STREAMING, "2025.10")
125-
_DEPRECATED_STATE_IDLE = DeprecatedConstantEnum(CameraState.IDLE, "2025.10")
126-
127115

128116
class CameraEntityFeature(IntFlag):
129117
"""Supported features of the camera entity."""
@@ -1117,11 +1105,3 @@ async def async_handle_record_service(
11171105
duration=service_call.data[CONF_DURATION],
11181106
lookback=service_call.data[CONF_LOOKBACK],
11191107
)
1120-
1121-
1122-
# These can be removed if no deprecated constant are in this module anymore
1123-
__getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
1124-
__dir__ = partial(
1125-
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
1126-
)
1127-
__all__ = all_with_deprecated_constants(globals())

tests/components/camera/test_init.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from collections.abc import Callable
44
from http import HTTPStatus
55
import io
6-
from types import ModuleType
76
from unittest.mock import ANY, AsyncMock, Mock, PropertyMock, mock_open, patch
87

98
import pytest
@@ -40,11 +39,7 @@
4039

4140
from .common import EMPTY_8_6_JPEG, STREAM_SOURCE, mock_turbo_jpeg
4241

43-
from tests.common import (
44-
async_fire_time_changed,
45-
help_test_all,
46-
import_and_test_deprecated_constant_enum,
47-
)
42+
from tests.common import async_fire_time_changed
4843
from tests.typing import ClientSessionGenerator, WebSocketGenerator
4944

5045

@@ -807,32 +802,6 @@ async def test_use_stream_for_stills(
807802
assert await resp.read() == b"stream_keyframe_image"
808803

809804

810-
@pytest.mark.parametrize(
811-
"module",
812-
[camera],
813-
)
814-
def test_all(module: ModuleType) -> None:
815-
"""Test module.__all__ is correctly set."""
816-
help_test_all(module)
817-
818-
819-
@pytest.mark.parametrize(
820-
"enum",
821-
list(camera.const.CameraState),
822-
)
823-
@pytest.mark.parametrize(
824-
"module",
825-
[camera],
826-
)
827-
def test_deprecated_state_constants(
828-
caplog: pytest.LogCaptureFixture,
829-
enum: camera.const.StreamType,
830-
module: ModuleType,
831-
) -> None:
832-
"""Test deprecated stream type constants."""
833-
import_and_test_deprecated_constant_enum(caplog, module, enum, "STATE_", "2025.10")
834-
835-
836805
@pytest.mark.usefixtures("mock_camera")
837806
async def test_entity_picture_url_changes_on_token_update(hass: HomeAssistant) -> None:
838807
"""Test the token is rotated and entity entity picture cache is cleared."""

tests/components/google_assistant/test_trait.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def test_camera_stream(hass: HomeAssistant) -> None:
155155
)
156156

157157
trt = trait.CameraStreamTrait(
158-
hass, State("camera.bla", camera.STATE_IDLE, {}), BASIC_CONFIG
158+
hass, State("camera.bla", camera.CameraState.IDLE, {}), BASIC_CONFIG
159159
)
160160

161161
assert trt.sync_attributes() == {

0 commit comments

Comments
 (0)