Play playlist from Home Assistant

Hi,

I have really been struggling with this but I would like to be able to play a playlist as part of an automation or scene but I am not able to get it to work. I have both plex and logitech media server integrations working I am however unable to call a service to get the players to start playing. I am hoping someone has a working example they could share or point my in the right direction.

According to documentation we can use media_player.play_media to play media on a ‘ connected ’ client, using the following detail:

  • entity_id - media_player.theater_plex
  • media_content_id - { \“playlist_name\” : \“The Best of Disco\” \“shuffle\”: \“0\” }
  • media_content_type - PLAYLIST

However even though I don’t have errors nothing happens.

I also tried with a logitech media server and home assistant doesn’t reports error but looking at the logs for the logitech media server it show request not dispatch-able.

1 Like

Here’s how I just solved the same problem.

First, create a rest.yaml file containing:

  lms_play_playlist:
    url: "http://10.10.1.1:9000/status.html?p0=playlist&p1=play&p2={{ playlist_name }}"

(change the IP address of your server)

and include it in your configuration.yaml:

...
rest_command: !include rest.yaml
...

Then, restart home assistant, and test it using developer tools like so:

image


…and call it from a script like so:

service: rest_command.lms_play_playlist
data:
  playlist_name: bfm

or, of course, using the UI editor:
image

Note that the playlist name seems to be case-sensitive, and don’t include the .m3u filename extension.

Hope that helps! It might also be possible using the media_player.play_media command too, I haven’t experimented.

1 Like