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 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -1129,13 +1129,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 @@ -1167,6 +1180,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
400 changes: 200 additions & 200 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 @@ -812,6 +812,9 @@ class MediaPlayerState(APIIntEnum):
IDLE = 1
PLAYING = 2
PAUSED = 3
ANNOUNCING = 4
OFF = 5
ON = 6


class MediaPlayerCommand(APIIntEnum):
Expand All @@ -820,6 +823,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 @@ -852,6 +864,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