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.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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

Posted on Jan 6, 2023 4:59 PM

Reply
18 replies
Sort By: 

Feb 10, 2023 10:58 AM in response to Michael Paine

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?



Reply

Feb 10, 2023 1:32 PM in response to Michael Paine

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.

Reply

Feb 9, 2023 1:54 PM in response to nebulousman

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.

Reply

Feb 10, 2023 1:12 PM in response to kylieo

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.


Reply

Feb 12, 2023 3:29 PM in response to Michael Paine

We could demonstrate the limitations of Homekit by this mock-up:


  1. build a spring-loaded mechanical arm powered by a Homekit power outlet
  2. stick an NFC tag to the end of the arm
  3. Place an iPhone at the end of the arm's travel so that it can be triggered by the NFC tag when the arm swings down
  4. create a shortcut that is activated by the NFC tag (shortcut could send an SMS message etc)
  5. create an automation in Home.app that activates the power outlet when another accessory changes state (light comes on/off, motion detected etc)
  6. test the system!


🤨

Reply

Jan 7, 2023 11:48 AM in response to nebulousman

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.

Reply

Feb 9, 2023 2:04 PM in response to Michael Paine

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.

Reply

Jan 7, 2023 9:15 AM in response to Michael Paine

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.

Reply

Feb 9, 2023 5:08 AM in response to Michael Paine

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?

Reply

Feb 11, 2023 3:35 AM in response to kylieo

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.

Reply

Feb 11, 2023 1:57 PM in response to kylieo

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.

Reply

can I trigger a shortcut with a homekit light switch?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.