Apple’s Home is my go-to app for control of my HomeKit devices, and generally, for basic automations and scenes, it’s also my preferred option. It does have a few limitations, for which many 3rd party HomeKit apps help fill in the gaps, but I just like the layout and the ease of use. That said, one really seemingly simple feature does seem to have alluded Home, which is a simple toggle feature. Currently, you can program a smart switch to turn something on, but you can’t program it to turn on when it’s off and off when it’s on, which for a traditional switch is a fundamental function. Why this hasn’t been created is anyone’s guess, and in fact, the Mi Home app is already capable of such a task. It is achievable via third-party apps, using conditions, but it’d be really nice to do it all in one place. Thankfully, with Shortcuts integration into the Home app this is now a possibility, although it’s still not as easy as it is in the aforementioned Mi Home app, but still.
For this example, I’m going to use two Vocolinc L2 (tunable white) smart bulbs, that have been grouped under the name ‘Prayer Lights’ (don’t ask…), and an Aqara Double Rocker Switch. I’ve also set up two scenes that I’ll be using in this automation – Prayer Lights ON and Prayer Lights OFF.
The overview of this automation is actually very simple, but I’ve gone into it step-by-step, so you can easily create this automation yourself. The automation works like this;
- When the rocker switch is pressed…
- IF the Prayer Lights are OFF, then turn them ON…
- otherwise, turn the Prayer Lights OFF.
So it’s essentially checking the status of the lights connected to the switch and turn them off or on, depending on the state they are in.
- Long-press the rocker switch* tile to get to the settings page
- In the settings page, you will see your buttons, waiting for a scene or device added to them
- Click Add, then instead of selecting a device or scene, scroll to the bottom and select ‘Convert to Shortcut’
* In this case, this double rocker switch is the older type, so it doesn’t have double or long-press options, merely single press.
- You will then see the Shortcut screen with ‘set – scenes and accessories’ by default
- Click on the + icon, and select ‘scripting’, then ‘If’ (If might be a ready selectable option).
- You then need to reorder these tiles so that the Scripting tile is above the current Set tile
- In the Scripting tile, press ‘Input’ then choose ‘Select a Home Accessory’ from the pop-up menu.
- Your list of accessories will appear, so in this case, I’m selecting the Prayer Lights I initially mentioned.
- As Prayer Lights is actually two bulbs, it just shows one of the bulbs for this automation, which is ok
- Next, select ‘Name’, and select ‘Is off’ **
** in the case of these bulbs there are more options than normal, that reference special light effects in Vocolinc’s LinkWise app
- Select the Set tile and drag it up, so that it’s below the If tile
- Click on Scenes and Accessories
- Select the scene created for these lights – in this case, Prayer Lights ON. Click Next
The first part of your automation is now set, which is simply – IF Prayer Lights are OFF, set Prayer Lights ON. Now to the second part.
- Click on the + icon again
- Select Control New Taipei (this is the name of my HomeKit Home, so whatever the name of your Home is will appear here)
- Another tile is created. Click on Set – Scenes and Accessories once again
- Your scenes and accessories will show up, so in my case, I’m choosing Prayer Lights OFF, having chosen Prayer Lights ON previously
- I now need to move this tile up so that it’s below the Otherwise tile
- The complete automation is in place which is;
- When I press the Aqara Rocker Switch
- If Prayer Lights (Vocolinc L2 2) is off
- Set (Scene) – Prayer Light ON
- Otherwise Set (scene) – Prayer Lights OFF
- End If (meaning automation has completed)
- Click Next, then click Done to save your automation.
That’s it. Whilst it may seem complex due to my step by step instructions, it should literally take you a minute to create this automation, if not less. It definitely helps to create a couple of scenes (if you can spare them, with the current 100 scene limit) that have the lights off and on, but it’s not necessary. It’s important to note that in some cases, whilst you may be controlling a set of lights (grouped in Home) when it comes to the automation checking the status of them to determine whether to turn them on or off, it only needs to check one bulb in the group, so it’s good practice to make sure that same bulb is chosen as the designated bulb in all automations for the most part.
Big thanks to Mariusz Szwed for help in figuring this all out!