Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gruby33

macrumors newbie
Original poster
Mar 29, 2022
3
0
Hello,

I'm starting to play with Homekit devices. I currently have some Sonoff switches reprogrammed for HomeKit and added to My Home in Apple. I have set up the automation that if one of the household members returns home after dusk, certain lights are automatically turned on. I would like to set some of them (garage) to turn on as before, i.e. after returning home and after dusk, but additionally only if I am connected to a specific bluetooth (in the car).

How to do it because I have no idea.
 

DJLC

macrumors 6502a
Jul 17, 2005
959
404
North Carolina
Hmm. Y'know, I'm not sure you can do this with pure HomeKit. I wonder if you could cobble together some kind of Shortcut to do it? Or maybe consider using a sensor in the garage to say "if motion / lux change / door opens, turn on light for X minutes."

Definitely interested if you figure it out... right now I have my "if the house is empty and any member comes home, turn on main lights" automation. But then I also have an automation just for me that turns the garage light on for 30 minutes when I arrive any time of day. Works fine most of the time, but there are definitely situations where that light is turning on for no reason b/c I didn't take the car in the garage.
 

gruby33

macrumors newbie
Original poster
Mar 29, 2022
3
0
I'm just playing with shortcuts but so far I haven't been able to come up with anything.

I would like to do it without any additional sensors because if it works, I have an idea for the next smart switch :) - If I come home and I'm connected with bluetooth (CAR), open the garage door.
 

Powerbooky

macrumors demi-god
Mar 15, 2008
687
628
Europe
Currently there's no option for a Carplay or Bluetooth connection status as a condition. In fact Homekit can only see your location.

But there's a (complicated) workaround with Homebridge (needs to be installed on a Mac or other server like device at home). You can create a personal automation that sets a virtual switch whenever Carplay is (dis)connected on your iPhone. Then a regular Homekit automation can use the virtual switch as a condition for the lights in the garage when you arrive.

Or... you could try using a motion sensor. The ones from Eve or Philips Hue work fine.
 

BigBlur

macrumors 6502a
Jul 9, 2021
830
977
You could probably hack something together using Personal Automations in Shortcuts. Here's what I'm thinking:
  • Create a personal automation to set a flag when Bluetooth connects to a device (your car).
    • Use the app Data Jar to store this flag.
  • Create another personal automation to run when you arrive home.
    • Have this automation check the flag in the Data Jar to see if you've connected to your car.
      • If yes, do your stuff; if no, do nothing.
      • Also if yes, clear the flag in your Data Jar since you'll no longer be connected to your car.
You could also do something similar for CarPlay. When CarPlay is connected, set the flag; when CarPlay is disconnected, clear the flag. Or even when a certain Focus mode is turned on or off. (There is no "when bluetooth is disconnected" trigger, which is why we're clearing the flag when you arrive home.)

Having it run only after sunset and before sunrise would be a little more complicated, but still doable. You can get those times from the Weather actions. This part would need to be added in the "if yes" part above.

Since you can't check your bluetooth or CarPlay status in real-time when you arrive home, this isn't 100% fool proof. For example, maybe you connected to your car, but didn't leave home. The automation would run the next time you arrive home with a friend, or after a walk (unless you cleared out the flag manually).
 
Last edited:

gruby33

macrumors newbie
Original poster
Mar 29, 2022
3
0
Thanks all.

However, I can see that this is not easy in the original Apple apps.
I will try to install HomeAssistant and see how it will come out with its help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.