Use Siri Shortcuts in HomeKit automations

While HomeKit offers a good selection of common home automation capabilities, sometimes you want a little more logic complexity than you can achieve with just triggers and conditions.

There are third party options to drive some of this automation behavior, but with iOS 13 Apple quietly added the ability to forgoe the normal rule creation and instead convert automations to Shortcuts.

This is a bit of a mixed blessing because the available Shortcuts commands are limited to what can be run from a home hub, which negates anything to do with third party apps, user input, or displaying results. It would be nice to generate custom notifications using this feature, but for some reason even sending a standard iOS notification is not available.

Even so, you can use the full scripting set and various other useful tools, and can access your HomeKit accessory state and send commands to them. This means you can essentially create a host of automation rules not normally possible in a HomeKit client app.

How to convert an automation to a shortcut

Accessing Shortcut functionality in your automations is quite simple, but not obvious. When creating a new automation (you need to do this in the Home app, not a third party one), create a trigger as normal, be it People, Time, or Accessory/Sensor state.

Next, on the screen where you would normally select scenes and accessories to control, scroll all the way to the bottom where you’ll see a section called ‘Advanced’. There will be a button called Convert to Shortcut.

Tap that and you’ll be taken to a version of the Shortcut editor, which then works the same way as the Shortcuts app, with the limitations noted above. Here’s a capture of the full list of available shortcut actions:

Shorcut actions available in HomeKit

Shorcut actions available in HomeKit

You’ll see from the list some items of particular interest, such as If, Wait, and Repeat. These overcome the lack of complex rules in normal HomeKit automations to a significant extend. With this you can create more complex conditional behaviors, and delayed actions.

The ability to extract data returned from web queries, and perform numeric calculations also stand out as very useful for creating more deterministic rules instead of static values.

In particular, the ability to run a script over SSH opens up some very interesting possibilities for more advanced users that want to interface with their own server based solutions.

If you’re a HomeKit power user, this added layer of control is well worth exploring.