One of the key principles of home automation is being able to control things quickly and easily. I don’t want to have to unlock my phone, open an app, wait for it to load, and then finally find the device I want to control.
I like that SmartThings supports the Today screen widgets in iOS. They let me swipe dow on my locked phone and trigger a routine. For example, I have a button set up to run “Good Night” when I get to bed, which turns off lights, locks the door, and sets the thermostat.
I wanted the same in Home Assistant. It turns out that Workflow is perfect for this.
If you have the Workflow app installed, here’s an example workflow you can customize.
To make this, I created a new “Today Widget” workflow in the app. Basically we are going to create a call to the Home Assistant RESTful API, so to start you need to add a URL action. This should be in the form of https://your-home-assistant-site/api/services/domain/service
. For example, if we want to toggle the bedroom lights of the Home Assistant demo site we would put in the URL https://home-assistant.io/demo/api/services/light/toggle
Next, add the “Get Contents of URL” action. Set the Method to POST, under headers add “x-ha-access” as the key and your Home Assistant password as the value. Set the Request Body to JSON and add any service parameters in the Request body. In our example we send a text value for “entity_id” as “group.bedroom”.
At this point you should be all ready to try it out! Here’s what it looks like:
(note that is not my real passphrase)
Workflow is a great way to build easy-access buttons to run things in Home Assistant. Along with the Home Assistant native app, I think Workflow is a must-have for any iOS user.
One response to “iOS Widgets for Home Assistant with Workflow”
Thanks for sharing this. You can also add in the ability to check the state when you are finished.
https://workflow.is/workflows/3f44378a36464260ae4c2750e02bd263