Run Home Assistant Actions From Your Apple Watch
February 8, 2024It's actually quite simple to run specific Home Assistant actions from your Apple Watch. For me, this feature has been quite the game changer and I created all kinds of shortcut routines that I can trigger that way. I use an action e.g. to open my garage door when driving home. With a single tap on my watch, I can have the door opening while I'm still 100 meters or so away. Love it!
Setting up an action like this is fortunately really straight-forward. So let's have a look at the steps required to create a basic "notification action". This will do nothing more than sending a notification to your iPhone but it can serve as a template for more interesting use cases later.
Defining the Action in the iPhone App
Open the iOS Home Assistant app, navigate to Settings
and from there to Companion app
.
You will find the item Actions
there.
In there, we can add and configure our new Action.
I chose the creative name "Test" and selected an icon and color (both optional, of course).
If you save now, the newly created action will already be available on your Apple Watch.
Only ... it's not doing anything useful yet. Let's fix that in the next step.
Creating a Home Assistant Automation for the Action
Let's go back into the app again, where we defined our new action. Did you notice the sample Trigger code that was provided here?
We can use this as a starting point for our action. Conveniently, the
app provides a Share
button so we can export this code e.g. via Email.
Let's create a new Home Assistant Automation and switch to the YAML
view.
This will give us a new empty automation.
description: ""
mode: single
trigger: []
condition: []
action: []
Into the trigger
section we can now paste the code that was generated by the app.
alias: Action - Test Message
description: ""
mode: single
trigger:
- platform: event
event_type: ios.action_fired
event_data:
actionID: C1110D98-84FB-4F26-BFF0-DDE5F53FC411
action: []
Note that I removed most of the generated code. The essential information is actionID
which uniquely identifies this action when triggered (be careful when duplicating such an automation ⚠️).
If you prefer working with YAML
(does anyone 🤔?) you can add your action here, but I'd rather switch
back to the visual editor and add it there.
And that should be all that's necessary. If you activate the action on your Apple Watch now, you should receive an iOS notification like this.
Using this simple notification as a template, you can create all kind of cool and useful shortcuts that can be triggered from your Apple Watch.
Let me know what you came up with!