--- title: "UniFi Network: client presence, triggers and KNX addresses" description: Trigger a Link’nX scenario when a UniFi Network client connects, and map block, WLAN, PoE, presence and client count to KNX group addresses. canonical: https://wiki.can-nx.com/en/guides/link-unifi-network-presence-knx/ language: en product: Link’nX audience: - administrateur - installateur context: "Link’nX web: UniFi Network trigger and single KNX table of a declared controller" --- # UniFi Network: client presence, triggers and KNX addresses Context: Link’nX web: UniFi Network trigger and single KNX table of a declared controller In Link’nX, the connection or disconnection of a UniFi Network client can trigger a scenario. The controller’s KNX table also maps group addresses to network commands (block, WLAN, restart, PoE) and to states: client connected or blocked, WLAN enabled, number of active clients. Intended for administrators and installers. The presence of a client corresponds to a device associated with the network, not to an identified person. The number of clients may include phones, computers and connected devices. ## Before you start - The controller is [declared in Link’nX](https://wiki.can-nx.com/en/guides/link-unifi-devices/). - You know the MAC of the monitored clients, as shown by the console, and the group addresses planned in the ETS project. ## Trigger a scenario on connection or disconnection 1. In the right project and the right gateway, open **Triggers → Add → UniFi Network**. 2. Fill in **Name**, then **UniFi Network controller**. 3. Fill in **Client MAC address**, for example `02:00:00:00:00:01`, a fictitious value to replace with the MAC of the client as seen by the console. 4. In **Event**, choose **Client connected** or **Client disconnected**. 5. Click the floppy disk at the bottom right, wait for **Success!** and find the trigger in the list. 6. Associate it with the relevant [scenario](https://wiki.can-nx.com/en/guides/link-scenario-save/) and save that scenario. To edit an existing trigger, follow [trigger editing](https://wiki.can-nx.com/en/guides/link-trigger-edit/). These events correspond to observed changes: - The first reading establishes the initial state; it does not automatically count as a new connection. - A disconnection is confirmed over several readings: the reaction is therefore not instant, and no exact delay is guaranteed. - Controller unavailability does not indicate that the client has left, and a previously displayed state does not indicate its current presence. ## Fill in the controller’s KNX table From the **UniFi Network** list, click the controller’s two arrows, **Gateway mode configuration**. This gateway uses **a single table**: each row has **Target (client MAC / device ID)**, **Command / state**, **DPT**, **KNX group address** and **Active**. 1. Click **Add**. 2. Choose **Command / state**, in the **Commands** or **States** group. 3. Fill in the target corresponding to the point. **Active client count** concerns the whole site and accepts an empty target; the other points require a target. 4. Check the proposed **DPT**. It remains editable: keep the type planned with the installer. 5. Fill in **KNX group address**, for example `1/2/3`, a fictitious address to replace according to the ETS project. Check **Active** for the mapping to use. 6. Also complete the required fields of any inactive rows, or remove an unneeded row with its **Delete** trash can. 7. Click the floppy disk at the bottom right and wait for **Success! / Updated!**. Save before leaving: this table does not ask for confirmation when you leave. The trash can removes a row from the form; save to keep the deletion. To suspend a mapping while keeping its settings, uncheck **Active** and save. ## Map the KNX commands All the commands offered use **DPT 1.001**. Their targets are the same as in the [UniFi Network actions](https://wiki.can-nx.com/en/guides/link-unifi-network-actions/). | Command | Value `1` | Value `0` | | --- | --- | --- | | **Block client** | Request blocking of the MAC | Request its unblocking | | **Enable WLAN** | Request enabling of the named WLAN | Request its disabling | | **Reconnect (kick) client** | Request reconnection of the MAC | No reconnection command | | **Restart device** | Request a restart of the device MAC | No restart request | | **PoE power-cycle port** | Request the power cycle of the MAC_port target | No cycle requested | The KNX table does not offer a separate **Unblock client** or **Disable WLAN** row: send `0` on the corresponding command. Do not use restarts and PoE cycles simply to check a mapping. ## Read the states | State | Target | DPT | Reading and limit | | --- | --- | --- | --- | | **Client connected** | Client MAC | 1.001 | `1` associated, `0` absent from the known presence state; neither proof of human presence nor a guarantee of freshness if communication is lost | | **Client blocked** | Client MAC | 1.001 | `1` known block; for an offline client, `0` does not rule out a block decided elsewhere | | **WLAN enabled** | Exact WLAN name | 1.001 | `1` enabled, `0` disabled in the available state; do not replace a missing value with `0` | | **Active client count** | None needed | 7.001 | Number of devices on the site, without deducing a number of people from it | ## Check the result 1. Reopen the trigger to review the controller, the MAC and the event, then check that it is in the saved scenario. 2. Leave and reopen **Gateway mode configuration** to review all the mappings. 3. Send a command from the bus in the authorized context, then check its effect in the UniFi console. For a state, compare the value received on the bus with the console. ## Troubleshooting - The scenario does not react: check the controller, the site, the MAC, the event, the association with the scenario and its saving. - A feedback is missing: check the point, its target, the DPT, the address, **Active**, the saving and the controller context. - The WLAN target is not unique, or an offline block must be established with certainty: have the situation confirmed by the network manager or by support. If checking these fields has already failed, write to support@can-nx.com with the expected event or point, the observed result and a summary of the tests, instead of changing other settings at random. Do not send any password or named list of occupants. French labels: **Adresse MAC du client**, **Événement**, **Client connecté**, **Client déconnecté**, **Commande / état**, **Commandes**, **États**, **Client bloqué**, **WLAN activé** and **Nombre de clients actifs**.