This is an automated archive made by the Lemmit Bot.
The original was posted on /r/homeassistant by /u/Electronic_Tap_3625 on 2025-03-01 15:01:42+00:00.
Hey everyone, I have been fighting with the RATGDO and UNFI access, and I finally got it to work, so I wanted to share the knowledge with a simple how-to.
The issue I ran into was the RATGDO has 2 inputs. One to close the door and one to open it. The UniFi access one has one output to unlock a door. Sure I could come up with some relay logic to make this all work but with home assistant, I can make it open the door if closed, close the door if open and stop the door if moving any time a door unlock signal is received by UniFi access. This is all done without having to pull any wires from the UniFi access controller to the RATGDO.
Here is how to make it work:
- Generate an API key in unifi access. Make sure you set webhooks to edit. When you click Create, the API key is displayed. Make sure you copy the key now, as it will not be shown again.
-
In open HomeAssistant, create an automation where the When is set to WebHook
-
Configure the webhook to allow GET access. I found it would not work unless I unchecked the only accessible from the local network option. Then, click the copy button next to the ID. Paste that somewhere, as you will need it later. In my example, the URL looks like:
Now, save your Automation, as we will be making changes to it later.
- Instruct the Unifi Access controller to send the webhook to HomeAssistant when door access is triggered. I used Postman in my example, but you can use whatever you want to send the request to the Unifi Controller. For Postman, install the Postman agent since we will need the request to go to the local network.
For the request, set the type to POST and the URL to: https://{your Unifi Controller IP}:12445/api/v1/developer/webhooks/endpoints for authentication, set the type to bearer token and paste the API key generated in step 1 into the box.
- Construct the body of the request as follows:
{
"name": "subscription events",
"endpoint": "The URL you copyied from home assistant in step 3",
"events": [
"access.door.unlock"
],
"headers": {
"key": "value"
}
}
-
Send the request and look at the reply. It should look like the following:
-
Every time a UniFi access door event occurs, it will trigger the event we created in HomeAssistant. Next, we must configure the event to only respond to access-granted events and restrict the event to only the doors you have if you have more than one reader. Here is an example JSON payload sent by the UDM that we can parse:
#access.door.unlock { "event": "access.door.unlock", "event_object_id": "4a98adf6-dbb8-4312-9b8b-593f6eba8c8e", "data": { "location": { "id": "d2b87427-7efa-43c1-aa52-b00d40d99ecf", "location_type": "door", "name": "Door 3855", "up_id": "62ff3aa1-ae96-4b6b-8eb5-44aadfd4aabd", "extras": { "door_thumbnail": "/preview/reader_0418d6a2bb7a_d2b87427-7efa43c1-aa52-b00d40d99ecf_1722913291.jpg", "door_thumbnail_last_update": 1722913291, "uah-input_state_dps": "on", "uah-wiring_state_dps-neg": "on", "uah-wiring_state_dps-pos": "on" }, "device_ids": null }, "device": { "name": "UA-HUB-3855", "alias": "Door 3855", "id": "7483c2773855", "ip": "192.168.1.132", "mac": "", "online": false, "device_type": "UAH", "connected_hub_id": "", "location_id": "d2b87427-7efa-43c1-aa52-b00d40d99ecf", "firmware": "v4.6.1.0", "version": "v4.6.129", "guid": "4a5e238f-4bae-48d5-84d7-dd2b0e919ab5", "start_time": 1721988528, "hw_type": "", "revision": "1722912520784126005", "cap": null }, "actor": { "id": "d62e92fd-91aa-44c2-9b36-6d674a4b74d0", "name": "Hon***", "type": "user" }, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 "object": { "authentication_type": "CALL", //Door opening method, NFC/PIN_CODE/Call For a DoorBell "authentication_value": "", "policy_id": "", "policy_name": "", "reader_id": "", "result": "Access Granted" } } }
In my example, I only have one reader so all that I care about right now is if access was granted. We could add a AND option to also check to see if other attributes match for example, device.name and match it to the hub name.
Next, we want to instruct the RATGDO to operate the door depending on the current state.
If the door is closed or closing, we want to open it:
If the door is open, we want to close it:
If the door is opening, we want to stop it.
Let me know if you have any questions and I will be happy to help!