Allows you to use MQTT topics to fill out the information needed for the Home Assistant Media Player Entity
- volume_up
- volume_down
- volume_set
- media_play_pause
- media_play
- media_pause
- media_next_track
- media_previous_track
Variables | Type | Default | Description | Expected Payload | Example |
---|---|---|---|---|---|
name | string | required | Name for the entity | string | "Musicbee" |
song_title | string | optional | Topic to listen to for the song title | string | "musicbee/songtitle" |
song_artist | string | optional | Topic to listen to for the song artist | string | "musicbee/artist" |
song_album | string | optional | Topic to listen to for the song album name | string | "musicbee/album" |
song_volume | string | optional | Topic to listen to for the player volume | string/int (0 to 100) | "musicbee/volume" |
album_art | string | optional | Topic to listen to for the song album art (Must be a base64 encoded string) | string (base64 encoded url) | "musicbee/albumart" |
player_status | string | optional | Topic to listen to for the player status (playing/paused) | string | "musicbee/player_status" |
vol_down* | service call | optional | MQTT service to call for the media_player.volume_down command | N/A | * see customize.yaml ex. |
vol_up* | service call | optional | MQTT service to call for the media_player.volume_up command | N/A | * see customize.yaml ex. |
vol_topic | string | optional | Topic to publish a change in the player volume | string | "musicbee/command" |
vol_payload* | string | optional | Payload to publish (put the keyword "VOL_VAL" where the volume is supposed to be) | string | "{\"command\":\"volume_set\", \"args\":{\"volume\":\"VOL_VAL\"}}" |
status_keyword* | string | optional | Keyword used to indicate your MQTT enabled player is currently playing a song | string | "true" |
next | service call | optional | MQTT service to call when the "next" button is pressed | N/A | * see customize.yaml ex. |
previous | service call | optional | MQTT service to call when the "previous" button is pressed | N/A | * see customize.yaml ex. |
play | service call | optional | MQTT service to call when the "play" button is pressed | N/A | * see customize.yaml ex. |
pause | service call | optional | MQTT service to call when the "pause" button is pressed | N/A | * see customize.yaml ex. |
*NOTES:
- vol_payload: the component will replace the part of the payload specified with VOL_VAL with the proper value. For example, if your media player expects a payload in the format of
{"command": "volume_set","args": {"volume": "0.78"}}
you must enter it in your customize.yaml like the example above:"{\"command\":\"volume_set\", \"args\":{\"volume\":\"VOL_VAL\"}}"
(escaping all necessary quotes) - status_keyword: This is the keyword your player publishes when it is PLAYING. You only need to mention the keyword for playing. For example, my player indicates it is playing by publishing
playing = true
to my broker. Therefore I enter"true"
in my customize.yaml - vol_up/vol_down: Setting this disables the volume_set service. Use vol_up/vol_down if your media player doesn't publish a volume level (i.e if your media player only responds to simple "volumeup"/"volumedown" commands. If you use vol_topic & vol_payload DONT use vol_up/vol_down. Same for the reverse
media_player:
- platform: mqtt-mediaplayer
name: "Musicbee"
topic:
song_title: "musicbee/songtitle"
song_artist: "musicbee/artist"
song_album: "musicbee/album"
song_volume: "musicbee/volume"
album_art: "musicbee/albumart"
player_status: "musicbee/playing"
volume:
vol_topic: "musicbee/command"
vol_payload: "{\"command\":\"volume_set\", \"args\":{\"volume\":\"VOL_VAL\"}}"
status_keyword: "true"
next:
service: mqtt.publish
data:
topic: "musicbee/command"
payload: "{\"command\": \"next\"}"
previous:
service: mqtt.publish
data:
topic: "musicbee/command"
payload: "{\"command\": \"previous\"}"
play:
service: mqtt.publish
data:
topic: "musicbee/command"
payload: "{\"command\": \"play\"}"
pause:
service: mqtt.publish
data:
topic: "musicbee/command"
payload: "{\"command\": \"pause\"}"
This is what my player outputs and what I see when I use MQTT Explorer
musicbee
playing = true
songtitle = Repeat After Me (Interlude)
artist = The Weeknd
volume = 86
album = After Hours
command = {"command": "next"}
albumart = /9j/4AAQSkZJRgABAQEASABI ...