Integration
Unifi
Native OpenClaw plugin for UniFi Site Manager and Network APIs, with Cloud Connector access and protected SecretRef credentials.
Install
npm install --no-save
Configuration Example
{
"enabled": true,
"config": {
"apiKey": {
"source": "store",
"provider": "default",
"id": "UNIFI_API_KEY"
},
"requestTimeoutMs": 30000,
"maxResponseBytes": 10485760
}
}
README
# UniFi for OpenClaw
Community OpenClaw plugin providing agent tools for the **official public UniFi APIs**. No MCP server or subprocess is required. Not affiliated with, endorsed by, or an official product of Ubiquiti.
Package: `@baumus/openclaw-unifi` · plugin ID: `unifi` · version: `0.1.0`
Tested host: **OpenClaw 2026.10.5 only** (experimental plugin SDK). Node 24.16+ or 26.1+.
## Coverage
| Pinned official specification | GET | POST | PUT | PATCH | DELETE | Total |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| Site Manager v1.0.0 | 9 | 2 | 1 | 1 | 1 | 14 |
| Network v10.6.106 | 41 | 12 | 9 | 1 | 10 | 73 |
| Protect v7.3.70 | 38 | 19 | 0 | 15 | 2 | 74 |
| InnerSpace v1.3.23 | 6 | 0 | 0 | 0 | 0 | 6 |
| Mobility v1.0.0 | 5 | 0 | 3 | 0 | 0 | 8 |
| Carrier Fabric v1.0.0 | 4 | 3 | 2 | 1 | 1 | 11 |
| Total | 103 | 36 | 15 | 18 | 14 | 186 |
**184 supported REST operations; two Protect WebSocket subscriptions are discoverable but upstream-unavailable.** All supported operations are executable, including network configuration writes, actions and deletes. Five Site Manager operations are generic **Cloud Connector GET, POST, PUT, PATCH and DELETE** forwarding. There are no plugin-side site, operation or read-only permission filters: your UniFi API key defines API rights, alongside OpenClaw's core tool policy.
Network uses the official cloud server:
`https://api.ui.com/v1/connector/consoles/{consoleId}/proxy/network/integration`.
Local controllers are not contacted.
Protect and InnerSpace use their official Cloud Connector servers with the same prefix and their application name. Mobility and Carrier Fabric use their source paths directly at api.ui.com. No local-controller fallback is implemented.
All six official portal services have complete pinned schema coverage. See [API_INVENTORY.md](API_INVENTORY.md) for exact sources, stable derived IDs, binary endpoints and explicit upstream exclusions. The original 87 IDs are preserved; added APIs use `<api>:<sourceOperationId>` or, for sources without IDs, `<api>:<lowercase-method>:<exact-path>`.
Generic connector forwarding also accepts documented JSON REST application paths. It validates the forwarding envelope, not an application's schema. It does not add guessed Access/Talk/Connect schemas, live media streaming, WebSockets, private controller APIs, cookies or arbitrary URLs.
Official Cloud Connector requirements include console firmware >=5.0.3, console ownership/organization rights, 100 requests/minute/console, a 25-second upstream deadline and a 10 MB upstream response limit. Upstream capabilities and availability still depend on the console, application version, API key and service.
## Install
Use the registry route once the version is published:
```sh
openclaw plugins install @baumus/openclaw-unifi@0.1.0
# Or the ClawHub package route:
openclaw plugins install clawhub:@baumus/openclaw-unifi
```
For a local source build use `npm pack`, then `openclaw plugins install npm-pack:/absolute/path/to/baumus-openclaw-unifi-0.1.0.tgz`. Installation and activation change your host; they are operator actions, not part of build/tests.
## Configure securely in Settings
1. Create a UniFi API key with the rights you actually need in UniFi Site Manager. Use a separate key for this integration when possible.
2. Open OpenClaw **Settings → Secrets**, add `UNIFI_API_KEY` as a **Protected secret**, and enter the key only in that masked form. The supported agent `secrets` tool can open the same protected prompt; the value does not enter chat.
3. In plugin Settings, set **UniFi API key reference** (`apiKey`) to the full returned SecretRef. Preserve the returned provider alias; `default` below is an example.
4. Enable the plugin through OpenClaw and call `unifi_status`. It checks local resolved credential availability, **not** authentication. A subsequent authorized GET verifies access.
Example plugin entry (reference only, never a plaintext key):
```json
{
"enabled": true,
"config": {
"apiKey": {
"source": "store",
"provider": "default",
"id": "UNIFI_API_KEY"
},
"requestTimeoutMs": 30000,
"maxResponseBytes": 10485760
}
}
```
Place the entry under `plugins.entries.unifi` if configuring manually. `apiKey` accepts structured `store`, `env`, `file` or `exec` SecretRefs only. The host validates provider/id grammars and resolves secrets into its runtime snapshot. The plugin neither reads stores/files/environment credentials itself nor implements a vault. No secret egress proxy is required for this plugin.
**Protected does not mean encrypted at rest.** OpenClaw's built-in store is unencrypted SQLite protected by file `0600` and directory `0700` permissions. Use an external `exec` SecretRef provider (for example a password manager) if encryption/isolation requirements demand it. Control UI saves refresh referenced runtime secrets automatically; after offline CLI changes use `openclaw secrets reload`.
An unavailable/removed current credential fails closed. Tools use the latest host-supplied runtime snapshot and do not fall back to a previous key.
## Agent workflow
| Tool | Purpose |
| --- | --- |
| `unifi_status` | Local availability and pinned coverage; no network |
| `unifi_discover` | Search/list operation IDs using `search`, `api`, `method`, `limit`, `cursor` |
| `unifi_describe` | Complete operation metadata, required fields, request schemas, all referenced schemas/discriminator variants, response metadata |
| `unifi_request` | Supported GET operations; JSON or opaque private image reference |
| `unifi_request_write` | POST/PUT/PATCH/DELETE operations; side-effecting and not replay-safe |
First **discover → describe → request**. Never guess operation IDs or request shapes.
```json
{"operationId":"listSites"}
```
Pass the above to `unifi_request` after describing it. A Network inventory request is:
```json
{
"operationId": "getAdoptedDeviceOverviewPage",
"consoleId": "<Site Manager console ID>",
"path": {"siteId": "<Network site UUID>"},
"query": {"offset": 0, "limit": 25}
}
```
Console IDs and Network site UUIDs are different identifiers. API pagination is manual: return Site Manager `nextToken` unchanged in the next query, or advance Network `offset`/`limit`. The local discovery cursor is catalog pagination only and must be reused with the same filters.
Values are typed: integer path parameters and pagination are numbers, booleans are booleans, arrays are arrays. Site Manager `pageSize` is a string in its published schema. `hostIds[]` arrays are repeated query keys. Unknown path/query keys are rejected for schema-backed operations. Validation preserves official open-object/allOf semantics and does not strip subtype fields. Published schema constraints are enforced; descriptions alone are not a complete server-side business-rule validator. JSON integers must be JavaScript-safe.
For generic forwarding, describe `ConnectorGet` or the corresponding write operation. Example:
```json
{
"operationId": "ConnectorGet",
"path": {
"id": "<console ID>",
"path": "protect/integration/v1/meta/info"
}
}
```
The connector normalizes an optional leading `/proxy/` and uses the canonical `/v1/connector/consoles/{id}/proxy/{applicationPath}` route. Additional query keys use OpenAPI form serialization; arrays repeat the key. POST/PUT/PATCH accept the official object-shaped JSON request body. DELETE also supports an optional JSON body as a documented plugin extension (not declared by the pinned Site Manager schema).
Form-style object query parameters support scalar property values; nested object form encoding is undefined by OpenAPI and is rejected. The Network `getDeviceTagPage.filter` schema is a structured FilterExpression, unlike other string filters. If an application actually requires its textual filter DSL, use the generic connector with the documented DSL; the plugin does not silently coerce/replace the published schema.
## Governed media
Describe the operation first. Image downloads return only `{media:{ref:"unifi:<host-store-id>",mime,size}}` in the normal result, with no bytes, base64, local path or provider URL. This is a plugin media-store reference, not an arbitrary URL or a globally resolvable filesystem path. JPEG and PNG are accepted only where declared by the source response. The plugin never follows returned stream/image URLs.
Example snapshot request to `unifi_request`:
```json
{"operationId":"protect:get:/v1/cameras/{id}/snapshot","consoleId":"<console ID>","path":{"id":"<camera ID>"}}
```
For an explicitly authorized upload, use `unifi_request_write` with a host-governed inbound media-store ID (or a previously returned `unifi:` reference):
```json
{"operationId":"protect:post:/v1/files/{fileType}","consoleId":"<console ID>","path":{"fileType":"animations"},"media":{"ref":"inbound:<host-store-id>","mime":"image/gif"}}
```
The host must first ingest the user's attachment through its governed media flow. Use the resulting store ID, not its local path; this plugin has no arbitrary file/URL ingest tool. Anonymous UUID IDs and safe filename-prefixed host IDs are accepted. Uploads accept only the seven MIME types listed in [API_INVENTORY.md](API_INVENTORY.md), independently sniff bytes, use one `file` multipart part and a generated filename/boundary. The exact multipart part convention is not specified upstream and remains unverified against a real console.
Media is limited to **5 MiB**, additionally bounded by `maxResponseBytes` for downloads. Upload preparation has a 30-second cap plus caller cancellation; the configured network deadline applies after preparation. The supported OpenClaw media-store SDK creates a private `media/unifi` directory and atomically saves downloads under random IDs; SDK read guards bind uploads to an opened store file and reject path/symlink escapes. Stored images persist under host media lifecycle/retention rules; the plugin does not independently delete them. Prot
... (truncated)
integration
Comments
Sign in to leave a comment