Open garage when I arrive home, but only when driving

Hi,

I’m thinking on the following scenario for a while and I can’t figure out how to configure an automation for this. Maybe someone with more experience can help me with this.

I have Meross smart garage opener and it is working perfectly both from raw Homekit and from Homeassistant. I would like to improve it by adding the following

The garage door is opening when I arriving home, BUT ONLY IF I’M With Car. The obvious choice would be to detect if my iPhone is connected to Carplay, but I can’t find any sensor for this. Is there any other smart idea how to detect if I’m driving?

So, the full workflow should look like this

  • if I’m driving and arriving home
  • open garage door

Thanks
L:

I do this by checking if my phone is connected to my car through bluetooth.
For Android there is an attribute in the bluetooth connection sensor, that lists all connected devices. I would assume there is something similar with iPhones.

What integration did you use for this? Is this the companion app/ HA app? I’ve checked iOS version, but there is no sensor for any bluetooth related entities.

Thx
L:

Yes, companion app. You are right, it seems iOS is very limited in regards of sensors.

Another idea could be to combine the battery state of your phone (charging), if you always charge your phone while driving, with the proximity integration. Charging + moving = in the car.

Or an iBeacon in the car?

iBeacon sounds promising, but I never used this and a quick search did not give useful results. Do you have any links for product/usecase? Because I’m using Wireless Carplay, my phone is not always charged, but maybe a combination of beacon which will identify the car and an arrival event can do the trick.

L:

Just an idea, put an esp with esphome into the car ?

  1. esp should be powered only when engine is ON.
  2. having a way to know if the esp is inside or outside the garage.

For pt2,
if device is wake up for les then 2min, open the garage (to go out) and check that garage door is closed when the esp is no more connected.
if device was wake up since long time and arrive at home, then open the garage because you want to enter.
Possible to use a kind of wifi range based on the signal (like for BT presence detection to know if device is inside or outside) …

Great idea! Any specific esp component to use? I’m also thinking to send signal through my existing MQTT broker and initiate opening/closing by this

Android had a ‘detected activity’ sensor. I’m guessing the answer is no, but does iOS have this? I use it for the exact same thing, but only if I’m riding my bike.

The companion app for Android has a sensor specifically for AA. Is there not one for iOS?

Edit: according to the docs, that’s a no, but there should be an activity sensor that will show “automotive” when in a car. I’d enable that sensor and give it a test run.

You could always use the life360 integration.

the life360 account is free and the integration gives you a “speed” attribute value. So you could use that (say, more than 15 miles per hour) and that means you’re driving.

Yes, there is a sensor for this but it seems not very reliable. I was driving today several times and only shows one of them

image

To work with iOS check the companion docs:

I suppose there should also be built in ways for iOS devices to detect iBeacons?!

It seems I can put together one with Life360 :slight_smile: Some privacy concerns though, but let’s try at least

1 Like

In this day of always on trackers for our phones etc I think having only one more app/device tracking us is not really a big deal. And it gives us more benefit than google or apple tracking us for pure ad revenue.

ESP8266 is having only wifi where ESP32 can have WIFI & BT.
But as soon as the ESP is getting connected to your network, you can ask HA to do something.
And this connection can talk to HA with the native encryted api. It’s safe and you can also combine this solution with other proposed solution. But I like to manage myself and not depend on cloud system or phone etc. It’s your car that need to enter or leave the garage, not you :slight_smile: but you can add you then someone that would have key can start engine but not open the garage :wink:

You can imagine using assist to ask open / close garage door and small speaker as response. I think it’s possible with the new voice stuff :wink:

Why not to use the most reliable method; to sense if car is in the garage at the time of approaching home?
I use for this Sharp IR distance sensor located above the parking spot in garage + Fibaro Smart Implant, that can sense output voltage of IR distance sensor (but any module with capability to easure voltage can and integrates with HA can be used). As output voltage of sensor changes depending on car presence below sensor (distance to the floor is different that distance to car roof) it is 100% reliable and gives instant info about status. The only case when it does not work (for automation like you described) is when I dropped my car in service shop and my wife was driving me home :-).

So, it is a bit reverse thinking :slight_smile: When I arrive home AND Car NOT in the garage, open door. Clever :slight_smile: Do you have a link for this sensor?

Actually I think pure Homekit should have a sensor like this (when carplay is connected), but unfortunately Apple does not want us to make real scripting/automatisation only very basic things which is a shame…

I started researching this option and I have been thinking about the solution and the following came in to my mind

  • I will need some esp32 board powered my car (either through USB or directly)
  • it should have sim card (for LTE), wifi, BT and GPS

With this I can accomplish all the above plus some GPS tracking of the car. What do you think? Is this a viable alternative?

Thx
L:

Sensor that I used is 1PCS GP2Y0A02YK0F 2Y0A02 Infrared Proximity Sensor Detect 20-150cm Distance Long Range with 8 inch Cable: Amazon.com: Industrial & Scientific (be carefull, there are various versions of this sensor with different working ranges, so the right one for specific application need to be selected).
And Smart Implant: FIBARO Smart Implant Z-Wave Plus Plugin Universal DIY Tool, FGBS-222, doesn’t Work with HomeKit - Amazon.com

“When I arrive home AND Car NOT in the garage, open door.”

That would be strange but depends of your home and habit. Example: If you walk with dog and come back to home with the car park in the front of the garage, then door is opening which is not wanted.

About distance sensor, it’s the same, depends on your habit. By having something in the car which is running only when car engine is on (and it’s link with your initial subject / when driving), it looks to me more safer to avoid such false positive cases.

If you want to try with esp32, you just need an esp32 and a power bank for simulation.

Basic idea may already work and you can add more sensors and logic on top afterwards :wink:

In fact, I’m doing it to put outside lights ON of the house but with some triggers link to companion app
or proximity integration. In my car, there is the HA app running (or link to google home, I don’t remember what I did), so it’s easy there to just press something.