Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Media Player Entity


A media player entity controls playback of media on a device. This could be an online music streaming service, a TV, a stereo or a video player.

Features

Media-player features define the capabilities of the controlled device. For example the dpad feature will enable the four directional commands and the enter command. Furthermore, certain features control the appearance and functionality of the media-player UI on the Remote Two.

NameRWDescription
on_offThe media player can be switched on and off.
toggleThe media player's power state can be toggled.
volumeThe volume level can be set to a specific level.
volume_up_downThe volume can be adjusted up (louder) and down.
mute_toggleThe mute state can be toggled.
muteThe volume can be muted.
unmuteThe volume can be un-muted.
play_pauseThe player supports starting and pausing media playback.
stopThe player supports stopping media playback.
nextThe player supports skipping to the next track.
previousThe player supports returning to the previous track.
fast_forwardThe player supports fast-forwarding the current track.
rewindThe player supports rewinding the current track.
repeatThe current track or playlist can be repeated.
shuffleThe player supports random playback / shuffling the current playlist.
seekThe player supports seeking the playback position.
media_durationThe player announces the duration of the current media being played.
media_positionThe player announces the current position of the media being played.
media_titleThe player announces the media title.
media_artistThe player announces the media artist.
media_albumThe player announces the media album if music is being played.
media_image_urlThe player provides an image url of the media being played.
media_typeThe player announces the type of media being played.
dpadDirectional pad navigation, provides up / down / left / right / enter commands.
numpadNumber pad, provides digit_0, .. , digit_9 commands.
homeHome navigation support with home & back commands.
menuMenu navigation support with menu & back commands.
context_menuContext menu (for example right clicking or long pressing an item).
guideProgram guide support with guide & back commands.
infoInformation popup / menu support with info & back commands.
color_buttonsColor button support for red / green / yellow / blue function commands.
channel_switcherChannel zapping support with channel up and down commands.
select_sourceMedia playback sources or inputs can be selected.
select_sound_modeSound modes can be selected, e.g. stereo or surround.
ejectThe media can be ejected, e.g. a slot-in CD or USB stick.
open_closeThe player supports opening and closing, e.g. a disc tray.
audio_trackThe player supports selecting or switching the audio track.
subtitleThe player supports selecting or switching subtitles.
recordThe player has recording capabilities with record, my_recordings, live commands
settingsThe player supports a settings menu.
  • R: readable
    • ✅ Feature has a readable attribute to retrieve the current or available values.
    • ❌ Feature value(s) cannot be read.
  • W: writeable
    • ✅ Feature has one or multiple commands to trigger an action or set a value.
    • ❌ No corresponding command(s), only the current value(s) of the feature can be read.

🚧 Planned features are playlist handling, media browsing and searching.

🧑‍💻 Integration driver developers:

  • If certain features or commands are missing for your device, they can be defined with "simple commands".
  • If a feature doesn't fully match your device, for example it only has a record function but no my_recordings or live functions, then the desired command(s) should also be defined as a "simple command".
    • For the command name use the corresponding cmd_id in uppercase to keep any command related automations.
      (This would be RECORD for the record-only feature example).

Attributes

Entity attributes are enabled by features and hold the current value of a feature or provide available options. Multiple features can act on the same attribute.

AttributeFeaturesTypeValuesDescription
stateon_offenumStatesState of the media player, influenced by the play and power commands.
toggle
play_pause, stop
volumevolumenumber0..100Current volume level.
volume_up_down
mutedmute_togglebooleanFlag if the volume is muted.
mute, unmute
media_durationmedia_durationnumberMedia duration in seconds.
media_positionmedia_positionnumberCurrent media position in seconds.
play_pause, stop
fast_forward, rewind, seek
media_position_updated_atmedia_positionstringdatetime (ISO 8601)Optional timestamp when media_position was last updated. Requires integration support.
media_typemedia_typeenumplatform specificThe type of media being played.
media_image_urlmedia_image_urlstringURL to retrieve the album art or an image representing what's being played.
play_pause
next, previous
media_titlemedia_titlestringCurrently playing media information.
play_pause
next, previous
media_artistmedia_artiststringCurrently playing media information.
play_pause
next, previous
media_albummedia_albumstringCurrently playing media information.
play_pause
next, previous
repeatrepeatenumOFF, ALL, ONECurrent repeat mode.
shuffleshufflebooleanShuffle mode on or off.
sourceselect_sourcestringCurrently selected media or input source.
source_listselect_sourcelisttext itemsAvailable media or input sources.
sound_modeselect_sound_modestringCurrently selected sound mode.
sound_mode_listselect_sound_modelisttext itemsAvailable sound modes.

States

The entity state attribute holds the following values:

ValueDescription
ONThe media player is switched on
OFFThe media player is switched off
PLAYINGThe media player is playing something
PAUSEDThe media player is paused
STANDBYThe device is in low power state and accepting commands
BUFFERINGThe media player is buffering to start playback

See also common entity states.

Device Classes

Optional: the media player can be classified what kind of device it represents. This can be used by the UI to represent the media player with a different icon, behaviour etc.

NameDescription
receiverAudio-video receiver.
set_top_boxSet-top box for multichannel video and media playback
speakerSmart speakers or stereo device.
streaming_boxDevice for media streaming services.
tvTelevision device.

Options

Optional features of the media-player entity.

NameTypeValuesDefaultDescription
simple_commandsarraystring[]Additional commands the media-player supports, which are not covered in the feature list. See simple commands.
Example: ["EXIT", "THUMBS_UP", "THUMBS_DOWN"]
volume_stepsnumber2..100100Number of available volume steps for the set volume command and UI controls.
Examples: 100 = any value between 0..100, 50 = only odd numbers, 3 = [33, 67, 100] etc. Value 0 = mute.
Note: if the integration receives an "unexpected" number it is required to round up or down to the next matching value.

Integration API

Commands

The integration driver has to implement a handler for the entity_command message to process the following command requests in msg_data.cmd_id.

cmd_idParametersDescription
on-Switch on media player.
off-Switch off media player.
toggle-Toggle the current power state, either from on -> off or from off -> on.
play_pause-Toggle play / pause.
stop-Stop playback.
previous-Go back to previous track.
next-Skip to next track.
fast_forward-Fast forward current track.
rewind-Rewind current track.
seekmedia_positionSeek to given position in current track. Position is given in seconds.
volumevolumeSet volume to given level.
volume_up-Increase volume.
volume_down-Decrease volume.
mute_toggle-Toggle mute state.
mute-Mute volume.
unmute-Unmute volume.
repeatrepeatRepeat track or playlist.
shuffleshuffleShuffle playlist or start random playback.
channel_up-Channel up.
channel_down-Channel down.
cursor_up-Directional pad up.
cursor_down-Directional pad down.
cursor_left-Directional pad left.
cursor_right-Directional pad right.
cursor_enter-Directional pad enter.
digit_0 - digit_9-Number pad digits 0..9.
function_red-Function red.
function_green-Function green.
function_yellow-Function yellow.
function_blue-Function blue.
home-Home menu
menu-Menu
context_menu-Context menu
guide-Program guide menu.
info-Information menu / what's playing.
back-Back / exit function for menu navigation (to exit menu, guide, info).
select_sourcesourceSelect an input source from the available sources.
select_sound_modemodeSelect a sound mode from the available modes.
record-Start, stop or open recording menu (device dependant).
my_recordings-Open recordings.
live-Switch to live view.
eject-Eject media.
open_close-Open or close.
audio_track-Switch or select audio track.
subtitle-Switch or select subtitle.
settings-Settings menu
🚧 search

Simple Commands

Additional commands can be enabled with the simple_commands options. A device exposing a media-player entity can support all additional device commands, not covered with the standard features, as so-called "simple commands". These commands are comparable with the infrared remote-entity commands, where keys trigger an action on the device:

  • The command is fully defined by its name and doesn't have any further arguments or related attributes.
  • Command names must be upper case and may not contain spaces.
    • The upper case restriction makes them distinguishable from the pre-defined feature commands.
    • Only a subset of the 7-bit ASCII printable characters are allowed: -/_.:+#*°@%()?
    • Maximum length is 20 characters.
    • Command name regex: ^[A-Z0-9\/_.:+#*°@%()?-]{1,20}$
  • 🚧 Simple commands cannot be translated yet. In the web-configurator they show up as defined.

Command Name Patterns

Even though command names can be freely defined with the allowed characters, the following prefixes should be used. This allows better integration into Remote Two, like default UI mappings and grouping of similar commands.

  • INPUT_: source inputs, e.g. INPUT_AUX1, INPUT_TV, INPUT_RADIO
  • APP_: applications, e.g. APP_MY_TV_STREAMING, APP_INTERNET
  • MODE_: mode changing functions, e.g. MODE_16/9, MODE_SURROUND, MODE_FOOTBALL
  • MENU_: additional menus, e.g. MENU_SMART_HOME, MENU_QUICK
  • DIGIT_: additional input digits besides the pre-defined numpad digits, e.g. DIGIT_10, DIGIT_10+
  • ZONE_: multi-room functions, e.g. ZONE_A, ZONE_MULTIROOM

Events

The entity_change event must be emitted by the integration driver if the state or an attribute of the media player changes.

The following attributes are supported:

AttributeDescription
stateNew entity state.
volumeCurrent volume.
mutedMute state.
media_positionCurrent playback position.
media_durationDuration of current media.
media_titleCurrent media title.
media_artistCurrent media artist.
media_albumCurrent media artist.
media_image_urlCurrent media image url, which will be resized for small and medium representations.
If the player already has multiple sizes it's recommended to use the _small, _med, _large attributes.
media_image_url_smallCurrent media image url for the small image.
media_image_url_mediumCurrent media image url for the medium size image.
media_image_url_largeCurrent media image url for the large image.
media_typeCurrent media type.
repeatCurrent repeat mode.
shuffleCurrent shuffle mode.
sourceSelected source.
source_listList of available media sources or inputs.
sound_modeSelected sound mode.
sound_mode_listAvailable sound modes.

At least one attribute must be specified in the entity_change message. If the entity state and another attribute changed at the same time, for example if a new track starts playing, they may both be included in the same message. It's also valid to always send every attribute.

Media types

The media_type attribute specifies the media being played:

  • MUSIC
  • RADIO
  • TVSHOW
  • MOVIE
  • VIDEO

The integration may return other values, but the UI will most likely handle them as an "unknown media".

Media images

  • Supported image formats: jpg and png.
  • The album art image can either be provided as a single image or as three matching image sizes.
    • Images will automatically be resized to the required sizes.
      Either from the single image in media_image_url or from the individual sizes.
    • Images too large in pixel or file size will be rejected due to resource constraints on the remote.
  • Preferred image sizes in pixel:
    • Large, for full screen album art: 420 x 420
    • Medium: 100 x 100
    • Small, for thumbnails: 60 x 60

Command examples

on

{
  "kind": "req",
  "id": 123,
  "msg": "entity_command",
  "msg_data": {
    "entity_type": "media_player",
    "entity_id": "media-1",
    "cmd_id": "on"
  }
}

play_pause

{
  "kind": "req",
  "id": 123,
  "msg": "entity_command",
  "msg_data": {
    "entity_type": "media_player",
    "entity_id": "media-1",
    "cmd_id": "play_pause"
  }
}

volume

{
  "kind": "req",
  "id": 123,
  "msg": "entity_command",
  "msg_data": {
    "entity_type": "media_player",
    "entity_id": "media-1",
    "cmd_id": "volume",
    "params": {
      "volume": 40
    }
  }
}

seek

{
  "kind": "req",
  "id": 123,
  "msg": "entity_command",
  "msg_data": {
    "entity_type": "media_player",
    "entity_id": "media-1",
    "cmd_id": "seek",
    "params": {
      "media_position": 180
    }
  }
}

repeat

{
  "kind": "req",
  "id": 123,
  "msg": "entity_command",
  "msg_data": {
    "entity_type": "media_player",
    "entity_id": "media-1",
    "cmd_id": "repeat",
    "params": {
      "repeat": "ALL"
    }
  }
}

shuffle

{
  "kind": "req",
  "id": 123,
  "msg": "entity_command",
  "msg_data": {
    "entity_type": "media_player",
    "entity_id": "media-1",
    "cmd_id": "shuffle",
    "params": {
      "shuffle": true
    }
  }
}

select_sound_mode

Specify a sound mode value contained in the sound_mode_list attribute array.

{
  "kind": "req",
  "id": 123,
  "msg": "entity_command",
  "msg_data": {
    "entity_type": "media_player",
    "entity_id": "media-1",
    "cmd_id": "select_sound_mode",
    "params": {
      "mode": "MOVIE"
    }
  }
}

Custom simple command

{
  "kind": "req",
  "id": 123,
  "msg": "entity_command",
  "msg_data": {
    "entity_type": "media_player",
    "entity_id": "media-1",
    "cmd_id": "THUMBS_UP"
  }
}

Event examples

State change event

{
  "kind": "event",
  "msg": "entity_change",
  "cat": "ENTITY",
  "msg_data": {
    "entity_type": "media_player",
    "entity_id": "media-1",
    "attributes": {
      "state": "PLAYING",
      "media_duration": 245,
      "media_position": 1,
      "media_position_updated_at": "2025-03-18T07:30:00.000Z",
      "media_title": "Some title",
      "media_artist": "My artist",
      "media_album": "Best of",
      "media_image_url_large": "http://192.168.1.100/player/current/album_l.png",
      "media_image_url_medium": "http://192.168.1.100/player/current/album_m.png",
      "media_image_url_small": "http://192.168.1.100/player/current/album_s.png"
    }
  }
}

Open issues and missing features

  • Define album art image limits
  • Define media types
  • Playlist handling
  • Media browsing
  • Searching