Skip to content

Comments

[unifiaccess] Unifi access binding initial contribution #19412

Draft
digitaldan wants to merge 11 commits intoopenhab:mainfrom
digitaldan:unifi-access
Draft

[unifiaccess] Unifi access binding initial contribution #19412
digitaldan wants to merge 11 commits intoopenhab:mainfrom
digitaldan:unifi-access

Conversation

@digitaldan
Copy link
Contributor

This binding integrates Ubiquiti UniFi Access with openHAB. It connects to your UniFi Access controller over HTTPS and listens for live door events while exposing channels to monitor and control door locks.

This is very WIP as i only have a door hub right now to test with, i'm waiting for the G6 Pro Entry to be released in the next couple months to get a full working access system.

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
@digitaldan digitaldan requested a review from a team as a code owner September 30, 2025 15:27
@digitaldan digitaldan changed the title Unifi access [unifiaccess] Unifi access binding initial contribution Sep 30, 2025
@digitaldan digitaldan marked this pull request as draft September 30, 2025 15:27
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
@wborn wborn requested a review from Copilot October 1, 2025 06:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Initial contribution of a new UniFi Access binding integrating Ubiquiti UniFi Access controllers, doors and devices into openHAB, including discovery, channel definitions, handlers, API client, and documentation.

  • Adds new bundle org.openhab.binding.unifiaccess with thing types, handlers, DTOs, API client, discovery, i18n, feature, README, and BOM / aggregator references.
  • Introduces WebSocket-based live event handling (doorbell, access attempts, logs) and REST interactions (lock control, device access method configuration).
  • Provides i18n resources and documentation, though some naming/branding and translation duplication issues are present.

Reviewed Changes

Copilot reviewed 45 out of 48 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
bundles/pom.xml Adds unifiaccess module and formatting change to root POM (one-line collapse).
org.openhab.binding.unifiaccess/.../thing-types.xml Defines bridge, door, and device thing and channel types.
unifiaccess.properties Adds i18n labels (some duplication & branding inconsistencies).
addon.xml Declares addon metadata (branding inconsistency).
Multiple handler Java classes Implements bridge, door, and device handlers; several silent exception swallows and incomplete state updates.
UniFiAccessApiClient.java Implements REST/WebSocket client (potential NPE in media type logging).
DTO classes Data models for API (mostly straightforward POJOs).
Binding constants / factory / discovery Wiring for thing creation and discovery.
feature.xml Karaf feature for new binding.
BOM & CODEOWNERS Registers new binding in build and ownership.
README.md User documentation (branding mismatches & incorrect product name in examples).

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lolodomo lolodomo added the new binding If someone has started to work on a binding. For a new binding PR. label Oct 4, 2025
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
@digitaldan digitaldan requested a review from Copilot November 1, 2025 17:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 46 out of 49 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Picked up the review of this binding. Will continue when these are fixed. Looked at all files except the handlers and apiclient.

Comment on lines +3 to +4
![logo](doc/logo.png)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logo can be added afterwards. Please remove from the docs here.

Comment on lines +10 to +13
- `unifiaccess:bridge` (Bridge): The UniFi Access controller instance.
Required to discover and manage door things.
- `unifiaccess:door`: A UniFi Access door with status and control channels.
- `unifiaccess:device`: A UniFi Access device (reader, hub, or camera) with device-level status and controls.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to add the binding id.

Suggested change
- `unifiaccess:bridge` (Bridge): The UniFi Access controller instance.
Required to discover and manage door things.
- `unifiaccess:door`: A UniFi Access door with status and control channels.
- `unifiaccess:device`: A UniFi Access device (reader, hub, or camera) with device-level status and controls.
- `bridge` (Bridge): The UniFi Access controller instance.
Required to discover and manage door things.
- `door`: A UniFi Access door with status and control channels.
- `device`: A UniFi Access device (reader, hub, or camera) with device-level status and controls.

## Discovery

- Add the `Bridge` by entering the controller Hostname or IP and an API Token.
- Once the Bridge is ONLINE, Doors are discovered automatically and appear in the Inbox.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Once the Bridge is ONLINE, Doors are discovered automatically and appear in the Inbox.
- Once the `bridge` is ONLINE, `door`s are discovered automatically and appear in the Inbox.


## Thing Configuration

### Bridge `unifiaccess:bridge`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also check other places

Suggested change
### Bridge `unifiaccess:bridge`
### Bridge `bridge`

| door-sensor | Contact | R | Door position sensor. |
| doorbell-contact | Contact | R | Doorbell contact. |


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

<channel-type id="face-detect-distance">
<item-type>String</item-type>
<label>Face Detect Distance</label>
<description>Face Detect Distance</description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applies to all channel type descriptions. Either make the description a good description (add value) or remove it. It should not be a copy of the label.

<label>Emergency Status</label>
<description>Emergency Status</description>
<category>Alarm</category>
<state>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applies to all channel types, consider marking them readOnly="true" where appropiate.

<item-type>DateTime</item-type>
<label>Last Unlock</label>
<category>Time</category>
<state readOnly="true"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide a pattern?

<type>binding</type>
<name>UnifiAccess Binding</name>
<description>This is the binding for UnifiAccess.</description>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the connection tag ?

Does the controller announce itself on mDNS? Or any other mechanism that can be used for the binding suggestion finder ?


<type>binding</type>
<name>UnifiAccess Binding</name>
<description>This is the binding for UnifiAccess.</description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not wrong, but can use a better description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new binding If someone has started to work on a binding. For a new binding PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants