Set up HomeKit smart, motion-activated bulbs with Homebridge

Cupertino, July 31, 2023

Since I had recently moved into a new house, I wanted to install HomeKit lights in the kitchen that would turn on and off automatically. Ideal. So I bought some Philips Hue bulbs, an Eve motion sensor, and did the obvious with automations in HomeKit. The result was unsatisfactory. Here's why, and how I finally made my smart home vision a reality, using Homebridge... The first step was getting lights that worked with HomeKit. My kitchen had recessed spotlights, so the best option was Philips Hue GU10 bulbs, which would be controlled via a Hue bridge. I managed to find a good package deal on eBay, so while the outlay was still significant, it was much better than paying full retail price. If I was based in the United States, I would have considered a smart light switch option like Lutron Caseta instead of smart bulbs. However, the availability of smart switches in the UK is almost non-existent as our homes lack the necessary neutral wiring. Placing the Hue bulbs was a breeze, and the initial setup experience of adding them to HomeKit was relatively painless. (An ongoing frustration is that the Hue app tends to change the room assignments of all your Hue-bridged HomeKit accessories, so I try to open the Hue app as little as possible.) This gave me the basis to set the lights from all my devices using the Home app or Siri. The status of the lamps responds quickly to command, certainly helped by the more efficient iOS 16 HomeKit architecture. To make the motion part work, my original plan was to use the Thread-enabled Eve motion sensor and create an automation in the Home app that would turn the lights on when motion was detected and turn them off when motion was no longer detected. detected. This was easy to make, but resulted in way too many false fires. Any pause in motion in the kitchen caused the lights to go out, and sometimes the sensor would simply miss a motion event and hit that case as well. The Eve app allows you to extend the duration of detected motion events, so I set it to a much longer timeout. This mitigated the initial problem, but now it meant the lights were on for much longer than they needed to. I also had a user experience complaint where I turned the lights off manually using the Home app (or a voice request to the HomePod), but any motion event immediately triggered the motion sensor to turn the lights back on. A natural human behavior is to turn off the light at the purse switch when you walk out, but the motion automation would actively fight against that. What I really wanted was a way to tell the system to ignore the automatic motion events, if the light has been manually controlled recently. Another problem with the current setup was that one motion sensor didn't have enough range to cover the entire room; my kitchen is a long but thin room. So I bought a second sensor to put on the other side of the kitchen cabinets. Coordinating the combination of events using the Home app's automation options alone is essentially impossible. So I needed something smarter beyond what the Home app has to offer. The answer to my problems came in the form of the Magic Occupancy plugin, via Homebridge. What this plugin does is expose special switches to the Home app's configuration that have special behaviors, putting layers of logic on top of the HomeKit platform. A variety of 'dummy' switches provided by the Magic Occupancy plugin It simulates room occupancy. You can then link the on or off of lights to the occupied state of the room. The plugin offers a variety of stateful and stateless switches that you can use to control exactly when a room is marked as occupied. The power comes from the fact that you can have several of each type of switch per room and combine them. You can also configure a delay so that occupancy does not end until all switches are inactive and a certain amount of time has passed. So for my kitchen situation I have two child switches, one for each motion sensor. When one of these switches is activated, the kitchen is considered 'occupied' and the lights come on. When both sensors no longer detect motion, a one-minute timeout is initiated. When this timeout expires, the lights go out. They have a special switch type for manual operation. This means that if you turn the lights on manually, the sensor status and normal one-minute timeout will be ignored; occupancy is accepted. Therefore, the lights stay on permanently, just as you intended. Conversely, if the lights are on automatically, but I turn them off manually, the occupancy ends immediately - you don't have to wait for the motion to time out. I'm not going to pretend it was easy to get all this to work. You have to mess around with the Homebridge plugin configuration and then connect all the automations to those dummy switches in the Home app. But I can say, the pain was worth it. This arrangement finally delivered what I imagined at the beginning of this whole process. I now have smart lights. The extra depth that the Magic Occupancy plugin provides makes it work the way you intuitively want it to. But you can go even further. A 'stay on' switch has the property of suspending the motion timeout when enabled. This means that the lights will stay on when this switch is on, but only if the lights were on to begin with. I use this practically every week when I take out the trash. I have a HomeKit camera that looks over my front yard, which contains a motion sensor. This motion sensor is linked to a hold switch for the kitchen. So when I take out the trash, the kitchen lights don't go off abruptly just because I've left the room for more than a minute. Instead, they won't turn off until no more motion is detected in the kitchen or entryway (and crucially, motion in the entryway won't cause the kitchen lights to come on). You can find out how to achieve all of these scenarios - and more - by reading the plugin's documentation. It's a very powerful system. It's also a good demonstration of how Homebridge isn't just about bringing unofficial HomeKit support to accessories that don't support it. Remember, Philips Hue already works with HomeKit, only the normal set of HomeKit automations isn't rich enough to express advanced interconnected logic. Homebridge plugins can fill most of those gaps. FTC: We use auto affiliate links that generate revenue. More.

Best selling & Top trending HomeKit product in our shop at this moment

HomeKit.Blog is in no way affiliated with or endorsed by Apple Inc. or Apple related subsidiaries.

All images, videos and logos are the copyright of the respective rights holders, and this website does not claim ownership or copyright of the aforementioned.

All information about products mentioned on this site has been collected in good faith. However, the information relating to them, may not be 100% accurate, as we only rely on the information we are able to gather from the companies themselves or the resellers who stock these products, and therefore cannot be held responsible for any inaccuracies arising from the aforementioned sources, or any subsequent changes that are made that we have not been made aware of.

HomeKit.Blog Is A Participant In The Amazon Services LLC Associates Program, An Affiliate Advertising Program Designed To Provide A Means For Sites To Earn Advertising Fees By Advertising And Linking To Amazon Store (, Or,,, Or

The opinions expressed on this website by our contributors do not necessarily represent the views of the website owners. 

Copyright © 2022 HomeKit Blog
. All rights reserved
United States