Unifi Access API

Hello everyone,

I know I revive an old topic but it seems exactly relevant to this discussion. In case it is not the right way, let me know and I’ll post a new topic.

Unifi Access now has an API. It is available in a document from the Unifi Access application.

It does support webhooks, and the description of the payload that will be passed is like below (using one example associated to the door unlock event).

I was wondering what was the best way to catch this and process this in openHab? Is it the “webhook” addon as per this topic : [webhook] New, very simple binding for listening incomming http requests

Or is it the HTTP Binding? But I had the impression that this binding was more for outgoing requests than for incoming events…

And yes, there is the possibility of starting from Seaside’s Unifi Protect Binding and see what needs to be adapted, but I have the impression that this is a longer path.

Thanks for your views.

Note that I’m mostly interested in “object” and “actor” sections at the end of the example of the payload… I’d “decode” the actor and update a LastSeen item for each of the actors.

#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-7efa
43c1-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"
        },
        "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"
        }
    }
 }