Motion sensor on patio. When it detects motion, check if your phone joined the network in the last minute and that a few minutes ago you were not in the gps area of your house. Send command to unlock the lock. Send a push notification that it unlocked so you know if it triggered on accident (incredibly unlikely when using motion + gps + wifi).
The motion sensor isn't strictly necessary, you can use the phone joining the network as a trigger. It's just an extra filter to ensure there are no accidental unlocks. It will also prevent unlocks if you come home, park, and then leave without attempting to enter.
That's how I would do it, all easily doable in home assistant.
Id want another authentication level like fingerprint in the action so if I drop my phone its not still a key. I like the general plan, but two levels of identification if possible.
More secure than keys—you can't remote-wipe keys. (And, presuming the network requires a password, remote-wiping the phone would make it not join the network any more.)
kevinsundar below is entirely correct, that's how I have mine set up as well. However, instead of network detection, there are multiple GPS-based device tracker methods for proximity.
The motion sensor isn't strictly necessary, you can use the phone joining the network as a trigger. It's just an extra filter to ensure there are no accidental unlocks. It will also prevent unlocks if you come home, park, and then leave without attempting to enter.
That's how I would do it, all easily doable in home assistant.