The esp32 as a constant power and scan all the time (in BLE), if it is detecting the phone that advertising, then no need to connect, it just measure rssi and if it is more than -80dBm, it's open the portal.
The battery drain is very small with this approach.
But, (there is a but) if I'm near the portal with my phone (in my home or in the garden), it will open too
So I'd like to check if I'm in my car, and my idea is to simply check if my phone is connected with my car's Bluetooth system, and only at this condition the phone will BLE advertise.
As you can see, there is not need to connect at anytime, just to check if the phone is connected (easy) with my car (that's I can't do).
It is just for fun and personal use, and if not possible, the portal remote control does the job (but not easy with motorbike when coming back from a ride), i