Actions is a generic system that allows you to easily integrate the Home Assistant automations system into multiple areas of iOS.
Actions are created from the Actions section of the App Configuration page within the companion App. Each action has six required fields:
Name: the name of the action, this will be returned in the Home Assistant event fired by the app.
Text: the descriptive text shown on the phone and watch. It is best to keep this relatively short as there is limited space on each action's button.
Text Color: the color of the text defined above
Background Color: the color of the button created for the action.
Icon: an icon to display to the left of the text on the action's button
Icon Color: the color of the icon on the action's button.
For the three color fields, the color is selected by tapping the color-picker circle in each field.
When an action button is pressed a
ios.action_fired event is fired on Home Assistant's event bus. The event data consists of a JSON-formatted dictionary of attributes relating to the action.
|Child dictionary relating the user that triggered the event and the ID of the event|
|Child dictionary containing key information about the action and its origin|
|Data and time the action was fired, formatted as an ISO timestamp , e.g. midnight on Christmas day in Lapland (Eastern European Time, UTC+2), would be |
The attributes contained within
|A unique identifier for the action.|
|The name of the action as given in the |
|The device ID set in the App Configuration page of the companion app.|
|The name of the iPhone or iPad from which the action was triggered. This is the Device Name set in iOS under Settings App>General>About.|
|A unique identifier of the iPhone or iPad through which the action was triggered|
|What part of iOS the action with fired from. Either: |
The attributes contained within
|A unique one-time ID for the event.|
|The Home Assistant user ID used to authorise the companion app with Home Assistant.|
Actions can be used to trigger automations within Home Assistant. An example
configuration.yaml entry might be:
automation: - alias: "Action Turn Lights Off" initial_state: true trigger: - platform: event event_type: ios.action_fired event_data: actionName: 'Bed Time' action: service: light.turn_off entity_id: group.all_lights
Note that attributes located in the
context are accessed through
event_context respectively within the automation.
You can use the Events page within Home Assistant's developer tools to show all information contained with the event for a particular event by subscribing to
ios.action_fired and triggering the action from you device.
Home Screen Quick Actions
Home Screen Quick Actions provides a convenient shortcut to your actions and is accessed by 3D Touching the Home Assistant companion app icon on your home screen.
Today View Widget
The Today View Widget is another route through which actions can be fired. To add the Home Assistant widget to your Today View:
- Swipe right while on the Home screen or Lock screen.
- Scroll to the very bottom and tap the Edit button.
- Find the "Home Assistant - Actions" widget in the "More Widgets" list and then tap the green + button to add it.
- Rearrange as you'd like and then tap Done.