Trigger Action from Bluetooth connect in Car

Hi all

Just getting started with Node-Red to manage my HassIO integrations. I'm trying to trigger the gate automation

For entry I have OpenALPR daemon running with a python fuzzy script to sent a HTTP Post upon match to Node-Red which then can control the gate.

For exit I'm trying to think of the best way, I can do a stream in reverse for a lot of the time, but sometimes the car will be parked in the line of that camera and as such will open for it. So I'd like to be able to try a different method.

I want to TRIGGER when my iPhone connects to bluetooth in the car. Chances are this will only happen when I need the gate opening. I have a few proximity trackers which I could then use to query home/away.

Anyone know where to start? Couple of hours of googling doesn't seem to have found much. Happy to go through Post, MQTT or anything else to send the input. Or equally if they have a better way to think around the problem open to that too, although this trigger would then be useful for other things like notification someones returning home etc.

I’ think you a right to start by working out how you are going to trigger anything when your iphone connects to a bluetooth network as that will have to be on your iPhone.
Can workflow do that? If it can you could send a http request from workflow that could trigger a flow in Node-RED (I’m using this with some Siri workflows that trigger flows in Node-RED)

I did a similar thing a few years ago with an Android phone and App Inventor (from MIT).
(There's probably an equivalent App for iOS).

App Inventor is a block programming language like SCRATCH and includes quite a few pre-written routines to handle BlueTooth and WiFi connections.

As I said, it's a few years since I used App Inventor so its probably moved on quite a bit.

I'm not certain (definitely possible on Android) but perhaps you could try IFTTT and have it run a routine upon Bluetooth detection?

You will need a trigger from your iPhone, there is no way of detecting a connection, only manual connect or on/off. You could combine this with a shortcut, which can execute all kinds of commands, bluetooth cannot be triggered automatically. You could use location services instead ?

What about (a bit left field) - implement an ESP32 in the car - powered by USB - will only startup when the car is on, if it is close enough to your home network you can have it attach to the WIFI and when the phone attaches to the bluetooth hotspot it presents you could send a MQTT alert ?