Skip to content

media_player add off on capability #1092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c331d50
media_player_all_features
rwrozelle Feb 28, 2025
b8abce2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 28, 2025
a977a4b
Remove commas from MediaPlayerCommand attributes
rwrozelle Feb 28, 2025
72918f2
Merge branch 'media_player_all_features' of https://github.com/rwroze…
rwrozelle Feb 28, 2025
18436fa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 28, 2025
40f5696
Update test_client.py
rwrozelle Feb 28, 2025
632f14a
Merge branch 'main' into media_player_all_features
bdraco Mar 8, 2025
15b2705
Merge branch 'main' into media_player_all_features
bdraco Mar 12, 2025
329eb15
Merge branch 'main' into media_player_all_features
bdraco Mar 12, 2025
b8a4e06
regen protobuf
bdraco Mar 12, 2025
35316b7
Merge branch 'esphome:main' into media_player_all_features
rwrozelle Mar 20, 2025
ef8f8f2
Merge branch 'esphome:main' into media_player_all_features
rwrozelle Apr 14, 2025
95f10db
With MA MP only needs turn_off_on Trait added
rwrozelle Apr 14, 2025
9c7a352
Merge branch 'media_player_all_features' of https://github.com/rwroze…
rwrozelle Apr 14, 2025
564f47d
Merge branch 'esphome:main' into media_player_all_features
rwrozelle Apr 17, 2025
3615415
Merge remote-tracking branch 'upstream/main' into media_player_all_fe…
rwrozelle Apr 29, 2025
bce91a6
Update api_pb2.py
rwrozelle Apr 29, 2025
3682eb4
Merge branch 'esphome:main' into media_player_all_features
rwrozelle May 7, 2025
f4622d0
Merge branch 'esphome:main' into media_player_all_features
rwrozelle May 12, 2025
bf1994e
Merge remote-tracking branch 'upstream/main' into media_player_all_fe…
rwrozelle May 22, 2025
edd1ec2
Update api_pb2.py
rwrozelle May 22, 2025
feb7c7f
Merge branch 'esphome:main' into media_player_all_features
rwrozelle Jun 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions aioesphomeapi/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1173,13 +1173,26 @@ enum MediaPlayerState {
MEDIA_PLAYER_STATE_IDLE = 1;
MEDIA_PLAYER_STATE_PLAYING = 2;
MEDIA_PLAYER_STATE_PAUSED = 3;
MEDIA_PLAYER_STATE_ANNOUNCING = 4;
MEDIA_PLAYER_STATE_OFF = 5;
MEDIA_PLAYER_STATE_ON = 6;

}
enum MediaPlayerCommand {
MEDIA_PLAYER_COMMAND_PLAY = 0;
MEDIA_PLAYER_COMMAND_PAUSE = 1;
MEDIA_PLAYER_COMMAND_STOP = 2;
MEDIA_PLAYER_COMMAND_MUTE = 3;
MEDIA_PLAYER_COMMAND_UNMUTE = 4;
MEDIA_PLAYER_COMMAND_TOGGLE = 5;
MEDIA_PLAYER_COMMAND_VOLUME_UP = 6;
MEDIA_PLAYER_COMMAND_VOLUME_DOWN = 7;
MEDIA_PLAYER_COMMAND_ENQUEUE = 8;
MEDIA_PLAYER_COMMAND_REPEAT_ONE = 9;
MEDIA_PLAYER_COMMAND_REPEAT_OFF = 10;
MEDIA_PLAYER_COMMAND_CLEAR_PLAYLIST = 11;
MEDIA_PLAYER_COMMAND_TURN_ON = 12;
MEDIA_PLAYER_COMMAND_TURN_OFF = 13;
}
enum MediaPlayerFormatPurpose {
MEDIA_PLAYER_FORMAT_PURPOSE_DEFAULT = 0;
Expand Down Expand Up @@ -1211,6 +1224,7 @@ message ListEntitiesMediaPlayerResponse {
bool supports_pause = 8;

repeated MediaPlayerSupportedFormat supported_formats = 9;
bool supports_turn_off_on = 10;
}
message MediaPlayerStateResponse {
option (id) = 64;
Expand Down
424 changes: 212 additions & 212 deletions aioesphomeapi/api_pb2.py

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions aioesphomeapi/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,9 @@ class MediaPlayerState(APIIntEnum):
IDLE = 1
PLAYING = 2
PAUSED = 3
ANNOUNCING = 4
OFF = 5
ON = 6


class MediaPlayerCommand(APIIntEnum):
Expand All @@ -835,6 +838,15 @@ class MediaPlayerCommand(APIIntEnum):
STOP = 2
MUTE = 3
UNMUTE = 4
TOGGLE = 5
VOLUME_UP = 6
VOLUME_DOWN = 7
ENQUEUE = 8
REPEAT_ONE = 9
REPEAT_OFF = 10
CLEAR_PLAYLIST = 11
TURN_ON = 12
TURN_OFF = 13


class MediaPlayerFormatPurpose(APIIntEnum):
Expand Down Expand Up @@ -867,6 +879,7 @@ def convert_list(cls, value: list[Any]) -> list[MediaPlayerSupportedFormat]:
@_frozen_dataclass_decorator
class MediaPlayerInfo(EntityInfo):
supports_pause: bool = False
supports_turn_off_on: bool = False

supported_formats: list[MediaPlayerSupportedFormat] = converter_field(
default_factory=list, converter=MediaPlayerSupportedFormat.convert_list
Expand Down