I’ve had Philips Hue for what seems like forever – I certainly paid the price for being an early adopter and if someone like Paul Hibbert is reading, I have sold my soul and made a pact with the devil (I love your stuff though Paul, so I forgive you.)
In some respect, I’m in too deep to get out of now and I am very Apple-centric user, rightly or wrongly. Through Facebook groups like Apple Homekit Pros and r/Homekit it’s been possible to come up with some great automations, but I always see this question pop up time and time again and I’d like to post this somewhere in the hope that someone finds the answer quickly!
So the question: How do you get your lights to turn off automatically in Homekit, but not so that they turn off while you’re still in the room?
Apple Homekit automations include some options like ‘Turn off after two minutes’ – this might be great for somethings, but as far as lights are concerned, the minute the motion detector senses no detection, the two minutes start and essentially can’t be stopped, therefore we need a condition added to the flow.
The Answer
Outside of my house I have the Outdoor Philips Hue Motion sensor, which I use to control a standard porch light which is operated by a LightwaveRF two gang switch.
Essentially, when it’s dark, I want the light to come on if there’s motion, but I want it to stay on as well for a short period of time if there isn’t – example, I’m bringing shopping in to the house or arsing about in the garage.
Steps
- Create a new automation, set the Event as ‘A Sensor Detects Something’ and select the sensor, the press next and select ‘Stops Detecting Motion’. I’ve set my time for this as ‘Any’, just in case someone turns the light on in the day for example.
- In the next screen you can either select scenes or devices… don’t do that. Scroll right to the bottom of the page and select ‘Convert to Shortcut.’
- This is where we can create conditions – see the screenshots below.
- Finish the condition with the device you want to control and set to ‘Off’
Some examples of how to set this up.
I have an ‘If’ condition looking at the status of the motion detector. If motion is not detected, we wait six seconds and repeat 20 times. Why six and 20? Well, it’s two minutes essentially and that was the easiest way for my brain to calculate this. You could change that a repeat of 120 and a wait of 1 second, it’s whatever works best for you.
The kicker here is the sub-flow ‘If’ condition; and this is what helps the flow work well – the second If condition says that If motion IS detected, stop the flow. This kills the flow dead until motion is not detected again and then the flow starts all over. This is the bit you need if you are walking in and out of rooms and don’t want your lights to go off on you randomly.
Outside of the sub flow though, we have a Control condition, which in my case sets the Porch lights to ‘Off’ – if the repeat/wait flow has completed without interruption, the light will go off.
It’s fairly simple, but it’s something that isn’t there out of the box and causes people to struggle. The issue with the motion sensors is that they rely on ‘big’ movement, even when sensitivity is set to high; if you want a more reliable solution, this is where something like the Aqara FP2 Presence sensor would be more useful, however that has it’s own set of issues I’ll cover off another time.
If you’ve found this helpful or need help with it, please leave me a comment and I’ll get back to you.