I’d like to have an automation that starts an Apple Music Playlist on my ATV. Does anyone here have this figured out?
In my latest attempt I used the apple remote commands in a script. But it’s very unreliable. This is the script.
The Apple Music app is the second app from the top left on my ATV (yours might be located in another spot).
I’m not an Apple Music user, but I can tell you what’s possible with the iTunes component. Point your browser to:
http://[Your Itunes Host Here]:8181/playlists
That will give you a JSON list of your playlists with a bunch of records like:
{“id”:“a-3-star-unrated”,“name”:“A: 3+ Star / Unrated”,“loved”:false,“duration_in_seconds”:3056627,“time”:“35:09:03:47”}
where the 2nd parameter is the name you can reference to play the playlist. If your apple music playlist will be usable, it will be listed somewhere in this list.
Once you have that, you can make a call to the play playlist function as follows to play it:
I used the lovelace custom button card to make buttons to call my playlists as follows:
- type: "custom:button-card"
name: Jazz
action: service
service:
domain: media_player
action: play_media
data:
entity_id: "media_player.itunes"
media_content_id: "best-jazz"
media_content_type: "playlist"
Just create one of those for each playlist you want to use, and iTunes will play it. You can control which AppleTV it plays on by using the custom mini-media-player component to make small speaker controls where you can turn each endpoint on and control it’s volume when streaming as an airPlay speaker as below (mine are grouped into entity cards). You can find the list of all your AirPlay devices in iTunes (AppleTV’s) by going to the url
Cool, hope it helps. The iTunes stuff is a bit tricky to figure out at first because for whatever reason, there’s not much info about it out there… But it works well once you get it going.
I’v decided not to test the setup that is described above. The iTunes component needs a Mac (or PC) running with iTunes. I don’t like that. I will wait and see if something better comes along that doesn’t need iTunes. But thanks for the tips and advice @scstraus
The only other thing I could think of it if you just use the Apple TV directly via remote commands to navigate to the playlist. Hopefully with enough scripting and testing you could get something to work reliably, but it would be much slower to respond than just telling itunes to play what you want. Unfortunately there are not many more Apple Music clients out there than the one in iTunes, the one on Apple TV, and the one on iOS (which I don’ t think there’s a way to control)… If you wanted Spotify or something, you’d probably have more options.
In order to play Apple Music playlist on Apple TV, I use the DRmare Apple Music Converter to help me. And it can keep the high audio quality of Apple Music.
What I do is that I have exposed an input_boolean to Homekit. Then in my Apple Home app, I have defined that when that input_boolean (it’s shown as a switch in the Home app) turns on, it should play My favorites-playlist from Apple Music on X Airplay speakers. The device set as Home hub will distribute to the defined speakers. Works as a treat.
You can play Apple Music on Apple TV directly if you use the Apple TV 4.
Open the Music app.
Select a song.
Press and hold the trackpad on the Siri Remote for one second while the song is playing to call up the options menu.
Select Go to Album.
And you can also convert Apple Music to MP3 with an Apple Music converter like TunesKit Audio Converter and you can play them on any model or device.
And you can follow this tutorial: How to play Apple Music on Apple TV