Virtual Switch

What is a Virtual/Dummy Switch?

You may hear about people using "virtual" or "dummy" switches in their HomeKit setup and wonder, what is a "virtual" switch? A virtual switch is when you use a HomeKit device as a kind of switch or "toggle control" to enable or disable an automation (or a group of automations).

A virtual/dummy switch can be either software-based, or hardware-based:

  • A software-based virtual switch is implemented using a third party application like HomeBridge to create a virtual switch that will appear in HomeKit.

  • A hardware-based virtual switch is implemented by using a hardware device (like a smart plug) as your virtual switch.

If you wanted to be technical about it, a "virtual" switch would be a switch that doesn't exist in the real world, only in the virtual world, and in the case of HomeKit, it would be created in HomeBridge or some other similar application that can be integrated into HomeKit. A "dummy" switch would be using an actual physical HomeKit device to act as a toggle to control an automation instead of using it for its intended purpose. For the purposes of this article, I am going to use the term "virtual" switch to refer to either a "virtual" or "dummy" switch.

When/Why would I want to use a Virtual Switch?

There are generally two types of instances where using a virtual switch would be useful:

  • For Controlling an Automation or Groups of Automations: You may have created a number of related automations that you want to turn on/off all at once. Some common examples would be a series of automations related to holiday lighting or a group of automations that you want to enable when going on vacation.

  • For Getting Around Security Prompts: Security-related HomeKit automations, such as opening the garage door, or disabling your home automation system require user interaction to run. For example, if you create an automation that opens your garage door, when the automation runs, you will see a prompt on your iPhone asking for permission to open the door. If you don't accept the prompt, the door will not open. Apple does this for security reasons. If you want to work around that restriction, you can use an automation that has your virtual switch open the garage door. Using the virtual switch to open the garage door will suppress the security prompt.

How do I use a Virtual Switch?

Assuming you aren't using HomeBridge to create a software-based virtual switch, you will first need to select a HomeKit device that will act as your virtual switch. Generally speaking, it is usually best to use a HomeKit device dedicated to this function, it can be a light or a plug, but you don't want somebody using that light or plug for anything besides your virtual switch. Then add the state of this device/virtual switch as a condition of your automation(s).

Here is an example using a virtual switch to enable a group of vacation mode automations:

  1. Name your virtual switch "Vacation Mode".

  2. Create all of the automations you want to enable when going on vacation: you might have a series of timed-automations to turn lights on and off to simulate somebody in the house, you might have a couple of automations to change your HVAC system settings. Maybe you need to turn off some of the automations that you normally run.

  3. In each of your vacation automations, add a condition that checks that the Vacation Mode switch is on before running (see the screenshot at the left).

Now whenever you turn the Vacation Mode virtual switch On, all of your vacation-related automations will run, and when you turn the Vacation Mode virtual switch Off, the vacation-related automations will not run. With the flick of one "virtual switch" you can turn dozens of automations on or off.

The screenshot from the Home+ app at the left shows how to add the conditional rule of the Vacation Mode (virtual switch) = On. This indicates that your Vacation Mode virtual switch has to be On in order to turn the light on at 9:11 AM.

HomeBridge Virtual Switch vs HomeKit Device Dummy Switch:

As I indicated above, there are two ways to implement a virtual/dummy switch: using software or using hardware. Here are the pros and cons of each:

Software-based:

  • Con: A software-based virtual switch requires you to implement and maintain an additional home automation system like HomeBridge. This will typically require running the software on some type of "server", which could be a computer that is always running or a Raspberry Pi.

  • Pro: Once you have your HomeBridge system running, it becomes simple to add as many virtual switches as you want to HomeKit, at no cost.

  • Pro: HomeBridge provides other benefits, such as allowing you to add smart devices that don't have HomeKit support into HomeKit.

Hardware-based:

  • Pro: A hardware-based switch does not require you to setup, configure, or maintain an additional home automation system like HomeBridge.

  • Con: Using hardware for your virtual switch requires you to dedicate an actual HomeKit piece of hardware like a smartplug to function as a virtual switch, which can cost anywhere from $10 - $30. (And you practically can't use that device for its intended purpose.)