This turned out pretty nice.
I’ve been using Apple Home for a long time.
To control Apple Music on my homepod I’ve configured a couple of Aqara switches, 6 buttons, to play certain playslists.
Two weeks ago I made the switch over to Home Assistant, and didn’t know how to integrate the Homepod or if I had to replace it.
What I did was setting up ssh from my HA/Synology NAS to an iMac that is always on.
Configured a couple of services on HA for running a ssh-script. These scripts run an applescript on my iMac.
Connected those services to the Aqara switch using automations in HA.
On my iMac I created corresponding Applescripts that starts playing a playlist in Apple Music and forwards the audio using Airplay.
Besides scripts for playing a playlist I also create a “Pause-script”, which is configured to double-clicking a button.
This works better than expected. It’s pretty fast.
I also added this functionality to my mobile dashboard so I can control the music, including the volume, from my phone.