can I trigger a shortcut with a homekit light switch?
I'd like my shortcut to trigger and run when a lightswitch in homekit is toggled on. The switch state change would trigger the shortcut.
iPad 2, iOS 9
You can make a difference in the Apple Support Community!
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
I'd like my shortcut to trigger and run when a lightswitch in homekit is toggled on. The switch state change would trigger the shortcut.
iPad 2, iOS 9
Thanks Michael. Do I understand right that the iffing needs to be written into the Shortcut itself?
For example, if I had a simple Shortcut to say “hello world” which I’d like to be triggered by a Homekit device state, the iffing about a Homekit device state would need to be added to that Shortcut, at the top?
Doesn’t that require the Shortcut app to be constantly aware and sensing the state of all Homekit devices?
I thought that a Personal Automation shortcut can be triggered by a Homekit event:
Create a new personal automation in Shortcuts on iPhone or iPad – Apple Support (AU)
but it turns out this is not the case 🙁
Only the Create Home Automation option gives access to Homekit events. This seems to be no different to creating the automation within the Home app so is of no use.
See this discussion:
home-kit motion sensor notification by te… - Apple Community
Shortcuts can have IF statements that are triggered by a Homekit state such as sensing motion or a light is switched on.
BTW Creating the code is very tedious. You have to create a line of code at the bottom of the list and then drag it up to the correct position.
i can't test it right now but apparently a Personal Automation shortcut can be triggered by a Homekit event:
Create a new personal automation in Shortcuts on iPhone or iPad – Apple Support (AU)
Create a new personal automation in Shortcuts on iPhone or iPad – Apple Support (AU)
So it must be monitoring in the background.
We could demonstrate the limitations of Homekit by this mock-up:
🤨
As far as I can tell you can only trigger an action withiin Homekit. For exampe, here is an automation thta turns on the humidifier power outlet if the kitchen fan is turned on.
However the Apple support (and other websites) for the Shortcuts app might give you some ideas.
Here is an explanation that I posted on a Tidbits.com discussion:
I think I have found a way using Shortcuts. I finally found how to control Homekit accessories with IF /OTHERWISE statements in Shortcuts. The trick is to add an action using the search field:
Choose Apps, scroll to the Home app and select the Accessory to be controlled.
This places the action (eg Set C7 Volvo [on] ) at the foot of the action list (below the END IF statement). You now need to drag it to the correct location in the list.
In my example I check if the C7 outlet (my EV charger) is on. If it is on then turn it off. Otherwise turn it on.
Cumbersome but it works. Holding my phone near the NFC tag toggles the outlet state.
Back to the timer issue… one of the Shortcut actions is “wait”. I should be able add this to the action list so that the outlet is turned on, wait for a specified time then turn it off.
You should be able to do this via the Shortcut app in iOS. It enables you to trigger actions in the Home app. Check the Apple Support website for advice on using the Shortcut app. I just tested using an NFC tag to trigger a Homekit action.
my question may not have been clear - I don't need a shortcut to trigger an action in the Home app - I'm interested in doing the reverse so an action in the Home app to trigger a shortcut. I can't figure this out and wondering if it is even possible.
for example when I turn on a light switch not only would the light go on but a shortcut is also triggered and runs.
I have the same
exact question, and from referring at least a dozen online sources and two AI powered large language models 😃, I have not found a definitive answer to the simple question “Can I trigger personal Shortcuts with a physical switch, like a Hue switch, connected to Homekit - yes or no?”
Is this a type of question that official Apple support responds to, even though it has nothing to do with devices and/or warranty?
While the above "code" uses Shortcuts to trigger a Homekit action any Shortcut action could be triggered. The key point is that the IF statement is controlled by a Homekit state - in the above example when Homekit power outlet C7 is "on".
Ah shoot. End of the story then. Would have been nice to turn off the tv, amp and all other entertainment with the same tap of the switch which I use to turn off the lights when going to bed. Guess not, have to do it all from the phone.
So the outcome really appears to be, that HomeKit events can only trigger other HomeKit events. No other events or actions are available in the menus apart from scripting, even if you convert it to a shortcut.
Since HomeKit really appears to be this limited, I wonder if there are any other third-party options like IFTT to initiate personal shortcuts from a compatible physical device.
What comes to NFC, I cannot even grasp the concept, how that would work here in practice.
NFC tags are a way to trigger a shortcut by waving an iPhone near the tag. You can buy a packet of tags for a few dollars it stick them around the house. The activated Shortcut can trigger Homekit actions. My example (link above) was to toggle a power outlet - if on turn it off otherwise turn it on.
As I lamented above, these are personal shortcuts that need an iPhone to work. They cannot be triggered by a Homekit change of state.
What is strange is that as a response to a homekit trigger, Shortcuts can be selected as the next action, but the menu contains no options.
can I trigger a shortcut with a homekit light switch?