How can I create a shortcut such that I can tell my HomePod
"Hey Siri, good morning"
and it will then play a certain tunein radio station
- on the HomePod
- and also on my Mac in the other room
- and have the playback in sync.
Currently, the only way for me is to go into the other room and start the tunein radio station on my Mac in the Music app and then select both the Mac and the HomePod as airplay output. But that's something my humble assistant should do for me … Thanks!
Best Answer
I guess, I'm just missing the obvious solution. But for now, this is working for me:
Summary
A Siri shortcut executes an Apple Script on the Mac that starts the radio stream with the Music app and adds the HomePod as airplay output.
1. Apple Script to start the radio stream
On the Mac, create a script using the
Script Editor
application and save it e.g. to~/play-radio.scpt
.In the Playlist "My Radio Playlist", I've added the radio stream I want to start. I suppose, one could also add the radio stream's url directly. But this way, I can modify the playlist without re-opening the script again later.
2. Create Shortcut to execute the script
With the device that has been paired with the HomePod, e.g. the iPhone or iPad, open the
Shortcuts
app and create a new shortcut that is named after the desired Siri command, here: "good morning"Add the workflow item Run Script Over SSH. Enter the hostname of the Mac and your Mac's user-account name. Choose "SSH Key" as authentication method. Add the command to execute the apple script:
3. Import the SSH Key
If you haven't done so already, export the public SSH Key of the Shortcuts app by clicking on the SSH Key entry, share, and then air-drop it onto your Mac.
On the Mac, add the key to the file
~/.ssh/authorized_keys
.Attention! This will allow the Shortcuts app on your iOS device to ssh into your Mac.
4. Activate SSH
If you haven't done so already, activate SSH remote login on your Mac:
Now the HomePod will understand "good morning" and execute the script, which will start Music on the Mac playing the radio station on the Mac and the selected AirPlay devices.