⛩️ Automatic Gate : don't ever use your remote again

For the driving binary sensor do i copy the code exactly how it is or is there parts i edit? first time using template so kinda new?

{{ '00:00:00:00:00:00 (BT-Device)' in state_attr('sensor.user0_bluetooth_connection', 'connected_paired_devices') }}

You need to change BT-Device with your real car Bluetooth name, and also adapt the MAC address to fit yours.
You should be able to get it by going into dev tools > states > searching “bluetooth_connections” > selecting your sensor

And finally, don’t forget to change “user0_bluetooth_connection” with your real sensor name

I’ll add these precisions to the wiki later, thanks for reporting :+1:

Any chance you can add the time to delay closing the gate after you enter?

Would this be correct:

{{ Mac_address (BT-Device)’ in state_attr(‘sensor.onepiece_bluetooth_connection’, ‘MY-CA’) }}

Thanks for the suggestion, however I don’t really see in which situation this could be useful
Could you elaborate more on why you would need it so I can add this feature if I don’t find another solution ?

You’re not far, but it seems it might not work correctly.
I’ll share mine so you can see what to fill :

'A8:42:E3:A9:4F:D6 (Berlingo)' in state_attr('sensor.m2007j20cg_bluetooth_connection', 'connected_paired_devices')
  • A8:42:E3:A9:4F:D6 needs to be replaced by your real car bluetooth mac adress (but it seems you just decided to hide it in your post)
  • Berlingo needs to be replaced with your own car name, so ‘MY-CA’ for you ?
  • sensor.m2007j20cg_bluetooth_connection needs to be replaced with your own companion bluetooth sensor (which seems to be right on your post)
  • connected_paired_devices needs to be kept untouched, as this is an attribute key

I hope this will help :+1:

‘48:F0:7B:2F:6B:3E (MY-CA)’ in state_attr(‘sensor.onepiece_bluetooth_connection’, ‘connected_paired_devices’)

Like this?

Looks good to me !
Give it a try

I have tried the automation, and nothing happened. even checked trace and nothing opened or closed.

alias: Automatic Gate
description: Gate Opens/Close
use_blueprint:
  path: etiennec78/automatic-gate.yaml
  input:
    gate: cover.garage_door
    persons:
      - person.luffy
      - person.precioussakura
    driving_sensors:
      - binary_sensor.robert_driving
    proximity_sensors:
      - sensor.home_luffy_distance
      - sensor.home_precioussakura_distance
    travel_time_sensors:
      - sensor.our_travel_time
    itinerary_sensors:
      - input_text.robert_itinerary
      - input_text.precious_itinerary
    gate_closing_title: Garage closing 🔒
    gate_opening_title: Garage opening 🔓
    automatic_opening_message: Automatic opening of the Garage
    automatic_closing_message: Automatic closing of the Garage
    awaiting_title: Garage awaiting {{ awaiting_persons }} 💤
    eta_sensor: input_datetime.automatic_gate_planned_opening
    notify_devices:
      - onepiece
      - peaches

Could you share your automation logs by going into :
Settings > Automations & scenes > Automatic Gate > Traces (top right) > Three dots (top right) > Download trace

By simply looking at your settings, I can see that you only have one travel time sensor set, but you have two different users…
Could you try adding another travel time sensor for your second driver and see if this works ?

No trace found

I have updated the travel time sensors for both of us. Also iPhone does not have blutooth sensors as I cant find any sensors on my wife iPhone 14

If no trace was found, it means that the template sensor you have set is wrong.
Maybe you should try entering your template into : Developer tools > Template (tab) to see how the template reacts when your phone connects to your car.

Concerning your wife, I’m sorry but since I only have android devices at home, I’m not really aware of the limitations of iPhones.
After reading the documentation, it seems that there is no way for now to detect which bluetooth devices are connected.
I don’t know if this is an Apple limitation or if this is just a feature not yet developed, but I would suggest asking for information in the forum

After reading your message again, I think I have found what is wrong with your sensor.
I forgot to mention that every template should be put inside braces for HA to understand that the code relies on jinja2.
So the template you’ll need to enter for your sensor is :

{{ ‘48:F0:7B:2F:6B:3E (MY-CA)’ in state_attr(‘sensor.onepiece_bluetooth_connection’, ‘connected_paired_devices’) }}

It’s quite weird that HA accepted your template without braces…

getting an error from it

{{ '48:F0:7B:2F:6B:3E (MY-CA)' in state_attr('sensor.onepiece_bluetooth_connection', 'connected_paired_devices') }}
The quotation mark characters were replaced by nicer ones by the forum.
Try copying this raw text, it should work better

Ok I have updated everything on the blueprint except my wife Bluetooth for her iPhone obviously

alias: Automatic Garage
description: Gate Opens/Close
use_blueprint:
  path: etiennec78/automatic-gate.yaml
  input:
    gate: cover.garage_door
    persons:
      - person.luffy
      - person.precioussakura
    driving_sensors:
      - binary_sensor.robert_driving
    proximity_sensors:
      - sensor.home_luffy_distance
      - sensor.home_precioussakura_distance
    travel_time_sensors:
      - sensor.precious_travel_time
      - sensor.robert_travel_time
    itinerary_sensors:
      - input_text.robert_itinerary
      - input_text.precious_itinerary
    gate_closing_title: Garage closing 🔒
    gate_opening_title: Garage opening 🔓
    automatic_opening_message: Automatic opening of the Garage
    automatic_closing_message: Automatic closing of the Garage
    awaiting_title: Garage awaiting {{ awaiting_persons }} 💤
    eta_sensor: input_datetime.automatic_gate_planned_opening
    notify_devices:
      - onepiece
      - peaches
1 Like

It seems that some of your sensors are not in the same order. Please try to always put you and your wife sensors in the same indexes.

Plus, I would suggest removing your wife’s sensors for now, since she doesn’t have a driving sensor.
My blueprint needs to have the same amount of sensors for each user or it could try to access one that does not exist

By the way, what kind of car is your wife driving ?
If it is connected to internet, maybe there is an integration for HA which could monitor when your wife starts to drive

nissan pathfinder. it only has Bluetooth ability.
I have removed all my wife’s sensors to test mine.

1 Like

the question, I have tried the automation and it worked but I want to tweak it. how do I tweak the distance it takes to open the garage while I’m arriving home or tweak the distance to close the garage after I leave? Also, the garage tried to close while we were unloading groceries. is there a way to fix that also?