Sometimes we want to trigger an action from our iPhone as fast as possible. To do so Shortcuts iOS app it’s a powerful option since it allows us to have shortcuts of some actions in our iOS widget screen.

Let’s try to setup and action.

iOS Setup

  • Install and connect Home Assistant iOS app
  • Add a new shortcut
  • Add a new action inside the shortcut
  • Search Home Assistant
  • Select Fire Event
  • Name event, i.e.: ios.action_fired with body: {"action_name": "arm_alarm"}
  • Edit the widget screen and add Shortcut widget selecting the folder where you have all the actions you want to see there

Home Assistant Setup

  • Check in Home Assistant that the event is received in Developer Tools section, you can add a listener to the new event so you know for sure that the event gets Home Assistant
  • Add a new trigger with the file editor like the following:
- alias: 'iOS Action: Arm Alarm'
  initial_state: 'true'
  trigger:
    - event_data:
        action_name: arm_alarm
      event_type: ios.action_fired
      platform: event
  condition: []
  action:
    - service: script.arm_alarm