Full home music automation with HomePod & Apple Music

TLDR
After some tinkering I’ve achieved full home audio powered by a HomePod with music streaming from Apple Music that automatically starts playing as anyone comes home!

Note: This is hacky. I don’t know if anyone else has a setup similar to mine, so unless someone asks, I won’t be posting a full tutorial (but will be happy to do so if anyone wants this).

Skip to result if you just want to see the end result.

So basic rundown:

I’m running supervised HA on a Pi4 4GB running Raspbian.
I have a HomePod as well as an IKEA Symfonisk speaker (great for the price, with Airplay 2 and Sonos-capabilities).
Both me and my SO use iPhones, I use Apple Music and she uses Spotify.

Goal: Being able to come home to some pleasant music :slight_smile:

Journey:
So I realised that there’s no real way to control HomePod playback / send commands to the HomePod. So after some checking out different solutions I tried Forked-DAAPD and while installation was quite easy, actually getting control of playback was harder - When music is playing on the HomePod, even from another person airplaying you’re able to control playback from any iOS device as well as the HomePod, not so with Forked-DAAPD which can also cause some sort of conflict in what is playing… Also I couldn’t figure out how to control it from Home Assistant. So while it didn’t seem to solve my problem, it was neat enough to keep around…

Next I toyed around with getting the Pi as a Spotify receiver but I wasn’t able to a) set audio output to Forked-DAAPD or b) Get it to play specific playlists.

So I added the Spotify integration to Home Assistant. I was now able to play music from Home Assistant, but still I wasn’t able to figure out how to get it to send the output to Forked-DAAPD. Even if resolved, the playback control issue would remain unresolved, so I didn’t really put much thought into it because I had another idea…

Somewhere along these steps I had stumbled across this reddit post outlining whole house announcements through Forked-DAAPD and Home Assistant, so I had added Forked-DAAPD as a media player in Home Assistant and tested out some text to speech stuff (fun, but wasn’t useful in any meaningful way)… But that made me think, couldn’t TTS be used to control HomePod? And yes, yes it can.
So: I run a TTS command from HA to Forked-DAAPD that plays a TTS message on the non HomePod speaker on high volume (they’re within shouting distance of each other) “Hey Siri, play some music everywhere”, the HomePod responds by playing music on all available speakers. lol. Whatever works right?

So I took that proof of concept and made a script that takes a long list of possible phrases and randomises what is “sent” to the HomePod e.g. Hey Siri, play [randomised music] everywhere

Now I’ve also added the HomeKit integration to HA and added the script as a switch and made a whole home automation in HomeKit (because of superior presence detection) that turns on the “switch” as the first person in the household arrives at home.

Result:
As the first person in the household approaches our home, a HomeKit automation is triggered and turns on a switch which triggers a script in HomeAssistant. The script runs the HA TTS service with a randomised Siri music command and sends it through Forked-DAAPD to play on an IKEA Symfonisk speaker which triggers a HomePod to play some music, and as the person opens the front door, the home is already lit and lit.

3 Likes

Clever solution! But Homekit already supports automations with HomePod.

Home app > Automation > + > People Arrive > Next > choose Homepod and select media and volume

1 Like

Thanks @lautaro! I haven’t found a way to make it play a random playlist / genre / artist though, or am I missing something?

My goal was to make some more “unsupervised” automations through HA eventually though (most personal automations through shortcuts require user input) :slight_smile:

Great work!

@hessius I don’t think random music selection is possible at the moment, you could choose your personal radio station.

This kind of automation does not require confirmation from your phone to run :smiley: I have one just like this working at home.

Yeah I know, the problem is the classification of user action which seems to be the reasoning behind the shortcuts rule set, any automation not triggered by something that can be classified as user action needs confirmation (with some home, ie not personal, automation they seem to make an exception though). That’s why I got home assistant :slight_smile:

1 Like

i stumbled across your post, i was curious, can you have other room’s be turned off when your not in there?

1 Like

what you could do now is to buy a HomePod mini and place it somewhere in an empty room or a storage room so that you don’t hear the TTS.

i plan on it

Hi, wow that a great solution! How did you manage to install Forked-DAAPD? I have HA (HASSIO) on a Pi4. And AirPlay spekars. But I cant find the speakers as AirPlay is not really supported in any way in Home Assistant.
A detailed step to step how you manage to get it installed would be the best christmas gift I could ever dream for! :slight_smile:

1 Like

I have tried to setup Forked-DAAPD together with HA without success. Would you be able to share the detailed step?

Sorry @amizam135 & @paisitw I’ve been out of the HA loop for a while. Maybe this isn’t something you need anymore or something you’ve solved yourselves, but let me know what your issues are with the installation and I might be able to help :slight_smile: