How do I automate other apps from a HomeKit (or other) trigger?

Hello!

I want to run the following actions on an iPhone (iOS 13) when an external trigger occurs:

  • Open the BBC Sounds app to play BBC Radio 3
  • Set the playback destination to an AirPlay speaker

The external trigger could be a HomeKit button, a web request that I could generate from another device, or even something physically connected to the iPhone - anything within reason that would enable running these actions from a single trigger.

I can successfully create a Shortcut on the iPhone to do these things, but not a HomeKit automation - I try creating an automation and tap the ‘Convert to Shortcut’ button but the BBC Sounds app doesn’t appear in the available apps and actions.

I have an iPad set up as the HomeKit hub and I have a Raspberry Pi running Home Assistant with the HomeKit and HomeKit Controller integrations, if those are any help.

Am I missing something or can this not be done? Is there any third-party app that would help? I’ve looked at Pushcut but the best that can do seems to be pop up a notification that then needs two taps to actually run the shortcut.

For Pushcut to be able to run this automatically you will need to use it’s Automation Server:
https://www.pushcut.io/support_automation_server.html

Should do exactly what you want, but will require a separate, dedicated iOS device…

Thanks for the replies. I read up on the Pushcut automation server but if I understand it correctly, the Shortcut that is triggered would run on the dedicated server device, but the server device has to have the automation server app constantly open? That wouldn’t be ideal as after running the shortcut I want the device where it runs to be available for interaction - e.g. to change the radio station or select other AirPlay destinations.

I’m looking into whether I can use Switch Control from iOS’s accessibility features to trigger my shortcut from a Bluetooth keyboard - I’ll report back if that works!

OK, I’ve found a way of doing this although it needs a bit of hardware and software hacking. It doesn’t use Switch Control but rather Full Keyboard Access in the accessibility settings.

I used the guide here to set up an Adafruit board to emulate a Bluetooth keyboard - I actually used their ItsyBitsy nRF52840 Express - and pair it with the iPad. In the Full Keyboard Access settings I configured a keyboard shortcut (command-3) to run my iOS Shortcut, and then got the board to respond to the hardware button by ‘typing’ command-H, command-H, command-3, down-arrow, spacebar. That unlocks the iPad (command-H is the default keyboard combo for the Home button - passcode is turned off), starts the shortcut, and accepts the confirmation dialogue.

I haven’t tested but as far as I know this will also work on an iPhone, as long as it’s on iOS 13.

The use case is that I want to replace a conventional radio with an iPhone with the Sounds app, so that it can do multi-room via Airplay 2 - unfortunately due to some sort of data rights dispute the BBC stations aren’t available on internet radio platforms like Tunein - and in order for this to be acceptable to other family members it needs to switch on with one button like the radio does, no faffing about with waking up a phone and launching an app by hand.

Since it’s BBC radio, the appropriate reference would be Heath Robinson