What problem does it solve?
UniFi controller APIs return inconsistent client data across endpoints and firmware versions, causing silent data corruption: lost user-assigned names, all clients misreported as offline, and transient endpoint errors making offline clients unfindable. This Skill encodes five verified correctness patterns that prevent these bugs when modifying client data retrieval code in the unifi-mcp monorepo.
Core Features & Use Cases
- Endpoint Selection Rules: Mandates /stat/sta as the primary source for live clients and /rest/user only for offline or historical records, with a comparison table of the 85-field coverage gap.
- Field Mapping Correctness: Preserves name and hostname as independent fields and derives online status via an _is_online() uptime-field fallback when is_online is absent from payloads.
- Resilient Fallback and Merge Logic: Requires try/except fallback chains that never re-raise transient read errors, and dual-source merging where live /stat/sta data wins on overlapping keys.
- Use Case: When fixing a bug where unifi_list_clients shows all devices offline, apply Procedure 3 to replace direct is_online checks with the _is_online() helper across all three model factories and the GraphQL layer, then verify with the live smoke test.
Quick Start
Apply this skill whenever modifying or debugging UniFi client data retrieval code in clients.py, client_manager.py, or the GraphQL client types.