Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions bundles/org.openhab.binding.unifi/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# UniFi Binding

This binding integrates with [Ubiquiti UniFi Networks](https://www.ubnt.com/products/#unifi) allowing for presence detection of network clients.
This binding integrates with [Ubiquiti UniFi Networks](https://www.ubnt.com/products/#unifi), allowing presence detection of network clients.

## Supported Things

- `controller` - An instance of the UniFi controller software
- `site` - A site thing with connection statistics
- `wlan` - A wireless network thing. Control Wi-Fi network and easy access to access.
- `site` - A site with connection statistics
- `wlan` - A wireless network. Control the Wi‑Fi network and provide easy access via QR code.
- `wirelessClient` - Any wireless client connected to a UniFi wireless network
- `wiredClient` - A wired client connected to the UniFi network
- `poePort` - A PoE (Power over Ethernet) port on a UniFi switch
Expand All @@ -15,29 +15,29 @@ This binding integrates with [Ubiquiti UniFi Networks](https://www.ubnt.com/prod

## Discovery

The binding supports discovery of things connected to a UniFi controller (Bridge).
To discover things start the discovery process manually.
The binding supports discovery of Things connected to a UniFi controller (bridge).
To discover Things, start the discovery process manually.

## Binding Configuration

The binding has no configuration options, all configuration is done at the Bridge and Thing levels.
The binding has no global configuration options; all configuration is done at the bridge and Thing levels.

## Bridge Configuration

You need at least one UniFi Controller (Bridge) for this binding to work.
You need at least one UniFi Controller (bridge) for this binding to work.
It requires a network accessible instance of the [Ubiquiti Networks Controller Software](https://www.ubnt.com/download/unifi).

The following table describes the Bridge configuration parameters:

| Parameter | Description | Config | Default |
|----------------|-----------------------------------------------------------------------------|--------- |---------|
| host | Hostname of IP address of the UniFi Controller | Required | - |
| port | Port of the UniFi Controller. For UniFi OS, the default port is usually 443 | Required | - |
| unifios | If the UniFi Controller is running on UniFi OS | Required | false |
| username | The username to access the UniFi Controller | Required | - |
| password | The password to access the UniFi Controller | Required | - |
| refresh | Refresh interval in seconds | Optional | 10 |
| timeoutSeconds | Request timeout in seconds. Increase if you experience TimeoutExceptions | Optional | 5 |
| Parameter | Description | Config | Default |
|----------------|------------------------------------------------------------------------------|--------- |---------|
| host | Hostname or IP address of the UniFi Controller | Required | unifi |
| port | Port of the UniFi Controller. On UniFi OS, the default port is typically 443 | Optional | 8443 |
| unifios | Whether the UniFi Controller is running on UniFi OS | Required | false |
| username | The username to access the UniFi Controller | Required | - |
| password | The password to access the UniFi Controller | Required | - |
| refresh | Refresh interval in seconds | Optional | 10 |
| timeoutSeconds | Request timeout in seconds. Increase if you experience timeout exceptions | Optional | 5 |

## Thing Configuration

Expand All @@ -49,15 +49,15 @@ The following table describes the `site` configuration parameters:

| Parameter | Description | Config | Default |
| ------------ | -------------------------------------------------------------|--------- | ------- |
| sid | The name, description or id of the site | Required | - |
| sid | The ID, name, or description of the site | Required | - |

### `wlan`

The following table describes the `wlan` configuration parameters:

| Parameter | Description | Config | Default |
| ------------ | -------------------------------------------------------------|--------- | ------- |
| wid | The name or id of the WLAN | Required | - |
| Parameter | Description | Config | Default |
| ------------ |----------------------------|--------- | ------- |
| wid | The name or ID of the WLAN | Required | - |

### `wirelessClient` & `wiredClient`

Expand All @@ -69,24 +69,24 @@ The following table describes the `wirelessClient` & `wiredClient` configuration
| site | The site where the client should be found | Optional | - |
| considerHome | The interval in seconds to consider the client as home | Optional | 180 |

Here's some additional notes regarding the thing configuration parameters:
Here's some additional notes regarding the Thing configuration parameters:

#### `cid`

The `cid` parameter is a universal "client identifier". It accepts the following values:

1. MAC address [highest priority]
1. IP address
1. Hostname (as show by the controller)
1. Hostname (as shown by the controller)
1. Alias (as defined by you in the controller UI) [lowest priority]

The priority essentially means the binding attempts to lookup by MAC address, then by IP address, then by hostname and finally by alias.
Once it finds a matching client, it short circuits and stops searching.
Most of the time, you will simply use the MAC address.
The priority essentially means the binding attempts to look up by MAC address, then by IP address, then by hostname, and finally by alias.
Once it finds a matching client, it short-circuits and stops searching.
Most of the time, you will simply use the MAC address.

#### `site`

The `site` parameter is optional. If you leave it blank, the client will appear `ONLINE` if found in _any_ site defined on the controller.
The `site` parameter is optional. If you leave it blank, the client will appear `ONLINE` if found in any site defined on the controller.

You may use the `site` parameter as a filter if you only want the client to appear home if it is found in the site defined in the `site` parameter.

Expand All @@ -95,7 +95,7 @@ Additionally, you may use friendly site names as they appear in the controller U
#### `considerHome`

The `considerHome` parameter allows you to control how quickly the binding marks a client as away.
For example, using the default of `180` (seconds), the binding will report a client away as soon as `lastSeen` + `180` (seconds) < `now`.
For example, using the default of `180` (seconds), the binding will report a client as away as soon as `lastSeen` + `180` (seconds) < `now`.

### `poePort`

Expand Down Expand Up @@ -160,22 +160,22 @@ The `wlan` information that is retrieved is available as these channels:
| wirelessClients | Number | Number of wireless clients connected | Read |
| guestClients | Number | Number of guest clients connected | Read |
| essid | String | Wireless Network (ESSID) | Read |
| site | String | UniFi Site the client is associated with | Read |
| site | String | UniFi site the WLAN is associated with | Read |
| security | String | Security protocol of the Wi-Fi network | Read |
| wlanBand | String | Wireless LAN band of the Wi-Fi network | Read |
| wpaEnc | String | WPA Encoding of the Wi-Fi network | Read |
| wpaMode | String | WPA Mode of the Wi-Fi network | Read |
| passphrase | String | Passphrase of the Wi-Fi network | Read |
| qrcodeEncoding | String | MECARD like encoding to generate a QR Code for easy access to the Wi-Fi network | Read |
| qrcodeEncoding | String | MECARD-like encoding to generate a QR code for easy access to the WiFi network | Read |

::: warning Attention
If you link an item to the `passphrase` or `qrcodeEncoding` channel your Wi-Fi password will be exposed in openHAB.
The password will also be visible in openHAB event log.
If you link an item to the `passphrase` or `qrcodeEncoding` channel, your WiFi password will be exposed in openHAB.
The password will also be visible in the openHAB event log.
:::

The `qrcodeEncoding` channel can be used to easily create a QR Code to access, for example, a guest network.
It contains a MECARD like representation of the access.
This is the notation used in QR Codes that can be scanned by mobile phones.
The `qrcodeEncoding` channel can be used to easily create a QR code to access, for example, a guest network.
It contains a MECARD-like representation of the access.
This is the notation used in QR codes that can be scanned by mobile phones.

### `wirelessClient`

Expand Down Expand Up @@ -274,7 +274,7 @@ The `network` information that is retrieved is available as these channels:

## Rule Actions

As an alternative to using the `guestVoucher` and `guestVouchersGenerate` channels on the `site` thing, it is possible to use rule actions on the thing to generate, revoke and list guest vouchers.
As an alternative to using the `guestVoucher` and `guestVouchersGenerate` channels on the `site` Thing, it is possible to use rule actions on the Thing to generate, revoke and list guest vouchers.
The following actions are available:

- `boolean success = generateVoucher(Integer expire, Integer users, Integer upLimit, Integer downLimit, Integer dataQuota)`
Expand All @@ -284,7 +284,7 @@ The following actions are available:
- `boolean success = revokeAllVouchers()`
- `String vouchers = listVouchers()`

Since there is a separate rule action instance for each `site` thing, this needs to be retrieved through `getActions(scope, thingUID)`.
Since there is a separate rule action instance for each `site` Thing, this needs to be retrieved through `getActions(scope, thingUID)`.
The first parameter always has to be `unifi` and the second is the full Thing UID of the site that should be used.
Once this action instance is retrieved, you can invoke the action method on it.

Expand Down Expand Up @@ -351,10 +351,10 @@ Bridge unifi:controller:home "UniFi Controller" [ host="unifi", port=8443, unifi
```

:::tip Note
Usually on Unifi OS, the default port is 443
On UniFi OS, the default port is typically 443.
:::

Replace `$user`, `$password`, `$cid` and `$sid` accordingly.
Replace `$username`, `$password`, `$cid`, and `$sid` accordingly.

### `items/unifi.items`

Expand All @@ -366,7 +366,7 @@ String MatthewsPhoneIP "Matthew's iPhone: IP [%s]"
String MatthewsPhoneAP "Matthew's iPhone: AP [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:ap" }
String MatthewsPhoneESSID "Matthew's iPhone: ESSID [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:essid" }
Number:Power MatthewsPhoneRSSI "Matthew's iPhone: RSSI [%d dBm]" { channel="unifi:wirelessClient:home:matthewsPhone:rssi" }
Number:Time MatthewsPhoneUptime "Matthew's iPhone: Uptime [%1$tR]" { channel="unifi:wirelessClient:home:matthewsPhone:uptime" }
Number:Time MatthewsPhoneUptime "Matthew's iPhone: Uptime [%d %unit%]" { channel="unifi:wirelessClient:home:matthewsPhone:uptime" }
DateTime MatthewsPhoneLastSeen "Matthew's iPhone: Last Seen [%1$tH:%1$tM:%1$tS]" { channel="unifi:wirelessClient:home:matthewsPhone:lastSeen" }
Switch MatthewsPhoneBlocked "Matthew's iPhone: Blocked" { channel="unifi:wirelessClient:home:matthewsPhone:blocked" }
Switch MatthewsPhoneReconnect "Matthew's iPhone: Reconnect" { channel="unifi:wirelessClient:home:matthewsPhone:reconnect" }
Expand Down Expand Up @@ -400,7 +400,7 @@ sitemap unifi label="UniFi Binding"
}
```

### `rule actions` for `site` thing
### `rule actions` for `site` Thing

```java
val uniFiActions = getActions("unifi","unifi:site:home:mysite")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<config-description uri="thing-type:unifi:controller">
<parameter name="host" type="text" required="true">
<label>Hostname</label>
<description>Hostname of IP address of the UniFi Controller</description>
<description>Hostname or IP address of the UniFi Controller</description>
<default>unifi</default>
<context>network-address</context>
</parameter>
Expand Down Expand Up @@ -60,14 +60,14 @@
<config-description uri="thing-type:unifi:wlan">
<parameter name="wid" type="text" required="true">
<label>WLAN Id</label>
<description>The id or name of the wlan</description>
<description>The ID or name of the WLAN</description>
</parameter>
</config-description>

<config-description uri="thing-type:unifi:client">
<parameter name="cid" type="text" required="true">
<label>Client ID</label>
<description>The MAC address, IP address, hostname or name of the client</description>
<description>The MAC address, IP address, hostname or alias of the client</description>
</parameter>
<parameter name="site" type="text" required="false">
<label>Site</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ thing-type.config.unifi.accessPoint.macAddress.description = The MAC address of
thing-type.config.unifi.accessPoint.site.label = Site
thing-type.config.unifi.accessPoint.site.description = The site where the access point should be found (optional)
thing-type.config.unifi.client.cid.label = Client ID
thing-type.config.unifi.client.cid.description = The MAC address, IP address, hostname or name of the client
thing-type.config.unifi.client.cid.description = The MAC address, IP address, hostname or alias of the client
thing-type.config.unifi.client.considerHome.label = Consider Home Interval
thing-type.config.unifi.client.considerHome.description = The interval in seconds to consider the client as home
thing-type.config.unifi.client.site.label = Site
thing-type.config.unifi.client.site.description = The site where the client should be found (optional)
thing-type.config.unifi.controller.host.label = Hostname
thing-type.config.unifi.controller.host.description = Hostname of IP address of the UniFi Controller
thing-type.config.unifi.controller.host.description = Hostname or IP address of the UniFi Controller
thing-type.config.unifi.controller.password.label = Password
thing-type.config.unifi.controller.password.description = The password to access the UniFi Controller.
thing-type.config.unifi.controller.port.label = Port
Expand All @@ -66,7 +66,7 @@ thing-type.config.unifi.poePort.portNumber.description = The number of the port
thing-type.config.unifi.site.sid.label = Site Id
thing-type.config.unifi.site.sid.description = The id, name or description of the site
thing-type.config.unifi.wlan.wid.label = WLAN Id
thing-type.config.unifi.wlan.wid.description = The id or name of the wlan
thing-type.config.unifi.wlan.wid.description = The ID or name of the WLAN

# channel types

Expand All @@ -75,7 +75,7 @@ channel-type.unifi.ap.description = Access Point the wireless client is connecte
channel-type.unifi.apEnable.label = Enabled
channel-type.unifi.apEnable.description = If the access point is enabled
channel-type.unifi.blocked.label = Blocked
channel-type.unifi.blocked.description = Is device blocked
channel-type.unifi.blocked.description = Whether the device is blocked
channel-type.unifi.devState.label = Device State
channel-type.unifi.devState.description = The state of the device
channel-type.unifi.devState.state.option.0 = Offline
Expand All @@ -93,7 +93,7 @@ channel-type.unifi.essid.description = Wireless Network (ESSID) the wireless cli
channel-type.unifi.experience.label = Experience
channel-type.unifi.experience.description = The wired/wireless experience of the client
channel-type.unifi.guest.label = Guest
channel-type.unifi.guest.description = Is the client connected a guest
channel-type.unifi.guest.description = Whether the client is a guest
channel-type.unifi.guestClients.label = Guest Clients
channel-type.unifi.guestClients.description = Number of guest clients connected
channel-type.unifi.guestVoucher.label = Guest Voucher
Expand Down Expand Up @@ -144,7 +144,7 @@ channel-type.unifi.purpose.state.option.remote-user-vpn = VPN
channel-type.unifi.purpose.state.option.wan = WAN
channel-type.unifi.purpose.state.option.vlan-only = VLAN Only
channel-type.unifi.qrcodeEncoding.label = QR Code Encoding
channel-type.unifi.qrcodeEncoding.description = MECARD like encoding to generate a QRCode for easy access to the Wi-Fi network
channel-type.unifi.qrcodeEncoding.description = MECARD-like encoding to generate a QR code for easy access to the Wi-Fi network
channel-type.unifi.reconnect.label = Reconnect
channel-type.unifi.reconnect.description = Forces a client to reconnect
channel-type.unifi.rssi.label = Received Signal Strength Indicator
Expand All @@ -167,7 +167,7 @@ channel-type.unifi.wirelessCmd.command.option.reconnect = Reconnect
channel-type.unifi.wlanBand.label = WLAN Band
channel-type.unifi.wlanBand.description = Wireless LAN band of the Wi-Fi network
channel-type.unifi.wlanEnable.label = Enable
channel-type.unifi.wlanEnable.description = Enable status of the wLAN
channel-type.unifi.wlanEnable.description = Enable status of the WLAN
channel-type.unifi.wlanEssid.label = Wireless Network
channel-type.unifi.wlanEssid.description = Wireless Network (ESSID)
channel-type.unifi.wpaEnc.label = WPA Encoding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
<channel-type id="wlanEnable">
<item-type>Switch</item-type>
<label>Enable</label>
<description>Enable status of the wLAN</description>
<description>Enable status of the WLAN</description>
</channel-type>

<channel-type id="wlanEssid">
Expand Down Expand Up @@ -304,7 +304,7 @@
<channel-type id="qrcodeEncoding">
<item-type>String</item-type>
<label>QR Code Encoding</label>
<description>MECARD like encoding to generate a QRCode for easy access to the Wi-Fi network</description>
<description>MECARD-like encoding to generate a QR code for easy access to the Wi-Fi network</description>
<state readOnly="true"></state>
</channel-type>

Expand Down Expand Up @@ -395,13 +395,13 @@
<channel-type id="blocked">
<item-type>Switch</item-type>
<label>Blocked</label>
<description>Is device blocked</description>
<description>Whether the device is blocked</description>
</channel-type>

<channel-type id="guest">
<item-type>Switch</item-type>
<label>Guest</label>
<description>Is the client connected a guest</description>
<description>Whether the client is a guest</description>
</channel-type>

<channel-type id="experience">
Expand Down
Loading