protect_subscribe_devices
Monitor UniFi Protect device state changes by subscribing to the update WebSocket. Collect messages for 1-30 seconds to detect adds, updates, and removals of cameras, lights, and sensors.
Instructions
Connect to the device update WebSocket and collect messages for a specified duration (1-30s). Returns {messages, duration, error?}; each message has {type: 'add'|'update'|'remove', modelKey: 'camera'|'light'|'sensor'|..., id, payload: partial device fields that changed}. Use to detect state changes like isRecording flipping, battery drops, or new devices being adopted — fields delivered are only those that changed, not the full device object.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| duration | No | Seconds to listen (1-30, default 5) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| messages | No | Captured WebSocket messages (add/update/remove or event envelopes) | |
| duration | No | Actual listen duration in seconds (number) | |
| error | No | Connection error, if any |