Possible to trigger multiple actions with a single tap on the button card?

I want to run a Home Assistant script AND run an iOS shortcut when this button is pressed. I’ve searched the forums and it looks like this was something someone was working on but never finished. One often suggested solution is to run it as a script, but I don’t think a HA script car trigger an iOS shortcut.

Here is what I want to do:

  1. Run the HA script.
  2. Run the iOS shortcut, which is on the device that tapped the button.

Any way I can do both? Or some clever workaround? I’m trying to improve the Wife Approval Factor here, so I really want this to work!

type: custom:button-card
tap_action:
  action: call-service
  service: script.turn_on_tv_to_paramount
  action: url
  url_path: shortcuts://run-shortcut?name=Roku
entity_picture: /local/challenge.png
show_entity_picture: true
size: 82%

Service.trigger_automation

Use an automation to start the two actions from the press

But how can a Home Assistant automation trigger an iOS shortcut? I think that’s the main problem I’m dealing with, I’m wanting to trigger two different systems, in one sense. Unless an automation can open an URL on a Home Assistant device?

Actually, I should probably look into making the iOS shortcut trigger the script in Home Assistant.

Just thinking through that helped. Here is the solution, if anyone finds this later:

  1. Make an iOS shortcut that looks like the following. Important note: the data after action can’t have spaces and may need to be all caps. The spaces screwed me up for awhile.

  2. Trigger the Automation with the following to match your iOS shortcut"

  3. Make sure the iOS shortcut is on every device you are going to use this button on.

  4. Call the iOS shortcut as a the tap-action with your UI button and you should be good to go.

  5. Wait for the wife not to even notice…

1 Like

Can you expand on point 4?
I battled with that yesterday and I feel I overkilled it since the HA UI can’t fire events but iOS Shortcuts can…

Like the YAML? Here is mine, I have it has part of a vertical and horizontal stack with some speakers for the whole-house audio. This is only the first horizontal stack of buttons.

type: vertical-stack
title: Speakers
cards:
  - type: horizontal-stack
    cards:
      - type: custom:button-card
        tap_action:
          action: url
          url_path: shortcuts://run-shortcut?name=AirPlay to Speakers
        entity_picture: /local/applemusic.jpeg
        show_entity_picture: true
        size: 35%
      - type: custom:button-card
        tap_action:
          action: url
          url_path: shortcuts://run-shortcut?name=AirPlay to Speakers Amazon Music
        entity_picture: /local/amazonmusic.png
        show_entity_picture: true
        size: 59%
      - type: custom:button-card
        tap_action:
          action: url
          url_path: shortcuts://run-shortcut?name=AirPlay to Speakers Hoopla
        entity_picture: /local/hoopla.png
        show_entity_picture: true
        size: 35%
      - type: custom:button-card
        tap_action:
          action: url
          url_path: shortcuts://run-shortcut?name=Turn on Treadmill TV to Paramount
        entity_picture: /local/challenge.png
        show_entity_picture: true
        size: 82%

Ah I see. You’re actually triggering the iOS Shortcut.

I had no idea that could be done. Interesting, although I don’t like that it opens the Shortcuts app.

Thank you for the code and clarification!!

Yeah, I agree I wish it didn’t open the shortcuts app. But the last step of the shortcut is to open another app, so it doesn’t stay there for long.