mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Deprecate MediaPlayerState.STANDBY (#148151)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
02a11638b3
commit
62e3802ff2
@ -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:
|
||||||
|
@ -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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user