Deprecate MediaPlayerState.STANDBY (#148151)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Erik Montnemery 2025-07-16 14:22:42 +02:00 committed by GitHub
parent 02a11638b3
commit 62e3802ff2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -1041,7 +1041,8 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
if self.state in { if self.state in {
MediaPlayerState.OFF, MediaPlayerState.OFF,
MediaPlayerState.STANDBY, # Not comparing to MediaPlayerState.STANDBY to avoid deprecation warning
"standby",
}: }:
await self.async_turn_on() await self.async_turn_on()
else: else:

View File

@ -5,6 +5,7 @@ from functools import partial
from homeassistant.helpers.deprecation import ( from homeassistant.helpers.deprecation import (
DeprecatedConstantEnum, DeprecatedConstantEnum,
EnumWithDeprecatedMembers,
all_with_deprecated_constants, all_with_deprecated_constants,
check_if_deprecated_constant, check_if_deprecated_constant,
dir_with_deprecated_constants, dir_with_deprecated_constants,
@ -50,7 +51,13 @@ ATTR_SOUND_MODE_LIST = "sound_mode_list"
DOMAIN = "media_player" DOMAIN = "media_player"
class MediaPlayerState(StrEnum): class MediaPlayerState(
StrEnum,
metaclass=EnumWithDeprecatedMembers,
deprecated={
"STANDBY": ("MediaPlayerState.OFF or MediaPlayerState.IDLE", "2026.8.0"),
},
):
"""State of media player entities.""" """State of media player entities."""
OFF = "off" OFF = "off"