Subscribe devices
protect_subscribe_devicesConnect to the UniFi Protect device update WebSocket and collect messages for 1-30 seconds to detect state changes or newly adopted devices.
Instructions
Connect to the device update WebSocket and collect messages for a specified duration (1-30s). Returns {messages, duration, error?, truncated?}; stops early with truncated=true after 200 messages or 100,000 characters of JSON, whichever comes first. A connection that fails before any message arrives returns an error. Each message is an envelope {type, item} where item is a device resource carrying id and modelKey (camera, light, sensor, nvr, …). The 7.3.70 docs show type 'add' with the full device object as item; other message types and whether updates carry only changed fields are not documented — inspect the captured messages. Use to detect device state changes or newly adopted devices. Not available over Cloud Connector (api.ui.com).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "protect_subscribe_devices"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| duration | No | Seconds to listen (1-30, default 5) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Connection error, if any | |
| duration | No | Seconds actually spent listening, to 0.1s (number); shorter than requested when the message cap or an error ends the listen early | |
| messages | No | Captured WebSocket messages (add/update/remove or event envelopes) | |
| truncated | No | true when listening stopped early at the message cap (boolean, absent otherwise) |