Use UniFi G4 Doorbell Fingerprint to Unlock Home Assistant Lock
🗓️• ⏱️ 6 min read
Now that UniFi has finally enabled both the fingerprint scanner and NFC card readers in the G4 Pro Doorbell in Protect 5.1, we can integrate it with Home Assistant to unlock any lock and trigger other automations.
The setup is straightforward, but there are a few prerequisites you’ll need to check before starting:
UniFi G4 Doorbell Pro
Protect 5.1
Home Assistant
Any smart lock connected to Home Assistant
Register your fingerprint
Registering fingerprints is done via the UniFi Protect mobile app.
Open the app and select your G4 Doorbell Pro from the Devices list
Navigate to Settings > Fingerprints
Tap Add New Fingerprint
Follow the on-screen instructions to register your fingerprints
You can also register NFC cards if you prefer to use them.
The automation will be triggered by a state change of the G4 Doorbell with an event_type of either identified or not_identified. A condition template will check between these two event types and call the unlock action when an identified fingerprint is scanned.
Create a new automation
In Home Assistant, go to Settings > Automations & Scenes
Click Create Automation and choose Create New Automation
Add Automation Event Trigger
Under When, search for and select Manual Event
Enter state_changed in the Event type text box
In the Event data text box, enter the following where event.front_door_fingerprint is the entity_id for your G4 Doorbell Pro
Add Trigger Condition
Under And If, select Add Condition
Search for and select Template
Copy and paste the following into the text box
This template is taken directly from the official Home Assistant documentation and checks for new scans of identified fingerprints. An identified fingerprint refers to any fingerprint that has been registered in the Protect app.
Add Automation Action
Now that we have a way of triggering this automation we can setup the actions the webhook will take. In this case we want to unlock a lock but this could be setup to do anything that HA can do like sending a notification, turning on/off lights, opening a garage door, etc.
Under Then Do, click Add Action.
In the Search Action box, type “unlock” and select Lock: Unlock.
Click Choose Device, search for, and select the lock to unlock
If required, enter a code to unlock the lock
Click Save, name your automation, and click Save again.
Your automation should now be visible from the Automations screen.
HA 2024.11 or earlier (Webhooks)
If you’re using version 2024.12 or later and completed the steps above, you can skip these instructions and proceed to the Test section.
Create Home Assistant Automation
The automation will be triggered by a webhook from UniFi Protect, calling the unlock action on your desired lock.
Create a new automation
In Home Assistant, go to Settings > Automations & Scenes
Click Create Automation and choose Create New Automation
Add Automation Webhook Trigger
Under When, select Other Triggers
Scroll to bottom and select Webhook
Click the settings cog to the right of the Webhook ID box
Ensure POST and Only accessible from the local network are selected
The webhook trigger should now be setup. A random Webhook ID will be generated. You can leave it as is or customize it.
Add Automation Action
Now that we have a way of triggering this automation we can setup the actions the webhook will take. In this case we want to unlock a lock but this could be setup to do anything that HA can do like sending a notification, turning on/off lights, opening a garage door, etc.
Under Then Do, click Add Action.
In the Search Action box, type “unlock” and select Lock: Unlock.
Click Choose Device, search for, and select the lock to unlock
If required, enter a code to unlock the lock
Click Save, name your automation, and click Save again.
Your automation should now be visible from the Automations screen.
You can now trigger this automation by issuing a POST request to the following URL. Replace <haURL> with your Home Assistant URL or IP, and <webhookID> with your generated Webhook ID.
An example full URL would be
Call Webhook from UniFi Protect
Next, configure UniFi Protect to call the webhook when a recognized fingerprint is successfully scanned.
Open your UniFi Protect instance in a browser or the mobile app.
Click the Alarm Manager icon in the bottom-left corner.
Click Create Alarm
Under the Trigger section, select Activity
Choose Fingerprint Scan and specify the fingerprints to use, or select All Registered Fingerprints
Click Save
Under the Scope section, select your G4 Doorbell Pro where fingerprints were registered
Under the Action section, choose Webhook
Select Custom Webhook from the dropdown and enter your Home Assistant webhook URL in the Delivery URL box
Select Advanced Settings and set the method to POST
Name your alarm, e.g., Call HA Webhook on Fingerprint Scan
Click Save
Test
If everything is set up correctly, your lock should unlock. In my case, the time between scanning my fingerprint and unlocking the lock is about 1.5 seconds. However, your results may vary depending on your home network and setup.
Found the above useful? Have a question? Thought of something I didn't?
Consider leaving a comment below or send me an email at johnzanussi@gmail.com.
Comments