I’m trying to trigger a shortcut on iOS using a HA automation.
The shortcut is triggered by clicking on the following line in Notes:
shortcuts://run-shortcut?name=Hik_connect
So I think it’s feasible.
I’ve tried including this as a shell command in config.yaml:
shell_command:
hc_open: shortcuts://run-shortcut?name=Hik_connect
but it returns (in Developer Tools / Services):
stdout: “”
stderr: “/bin/sh: shortcuts://run-shortcut?name=Calculator: not found”
returncode: 127
Is my syntax wrong or is “shortcuts” not a recognised command line found in any of the paths defined by PATH system?
Alternatively, is there a way for HA to activate the magic line (shortcuts://run-shortcut?name=Hik_connect) in an automation and thus initiate the shortcut?
As far as I know, this is not possible. The iOS companion app cannot initiate shortcuts on your iPhone or iPad and Home Assistant, running on another server, wouldn’t have any concept about Shortcuts as well.
What are you trying to accomplish? There might be another way to do it.
Thanks.
I am using the Hikvision iOS app for front door two-way conversation through a security camera. It takes around 10 seconds to start up, connect to their server and enable two way audio.
What I was hoping to achieve was when the camera detects the presence of someone approaching the front door (in this instance HA already receives a webhook payload and initiates a light automation) it would open the Hikvision app so that it was ready for two-way conversation by the time the individual reaches the door. I know there is no direct method to open a secondary app on iOS so I thought I might achieve this through shortcuts which works well. I can trigger this by simply clicking on this line: shortcuts://run-shortcut?name=Hik_connect
I was hoping that there was a way that an automation in HA could in effect “click on the line” of text above. [This can be done with Pushcut but it’s a subscription service]
Thanks again.
This is exactly what I was going to suggest as Pushcut has webhook support. Outside of that, there are two ways I can think of that can possibly work: Email and SMS. Both are available triggers in Shortcuts. You can use the SMTP integration in HA to send an email to your phone. Create an automation in Shortcuts to read the email and launch your shortcut. Same for SMS. What I don’t think this will solve is the latency (email is definitely take more than 10 seconds to get delivered.
What might work better is to setup an account with Twillo and use that to send yourself a SMS from HA. It’s not free (I think it’s like $0.08 per txt in the US), but if you only send a few texts, it’s way cheaper than Pushcut is. You could then trigger an automation in Shortcuts from that SMS and launch your shortcut.