Overview

Last updated: April 11, 2026

UniFi Module Overview (unifi)

The unifi package provides integration with Ubiquiti UniFi network controllers, primarily used for network telemetry and physical presence detection.

Key Features

  • API Client: Connects to the UniFi OS controller to query client devices and network health.
  • Presence Detection: Tracks specific MAC addresses to determine if users (Dan, Liz) are physically "Home" or "Away".
  • Network Analytics: Feeds data to the sysadmin agent for network troubleshooting.

Key Files

  • unifi/unifi_client.go: The raw HTTP API client for authentication and data retrieval.
  • unifi/unifi.go: High-level logic for parsing client data and determining presence.

Integration Flow

  1. Authentication: Logs into the UniFi controller and retrieves a session cookie.
  2. Polling: Periodically fetches the list of active Wi-Fi and wired clients.
  3. Presence State: Compares active MAC addresses against known user devices.
  4. Wakeup Trigger: If a known device transitions from disconnected to connected, it triggers an event via the wakeup.go API in the assistant module.

Guidance for AI Agents

  • Network Diagnostics: Use the Unifi tools to check if a specific device is connected to the network or to review overall Wi-Fi health scores.
  • Privacy: Be discreet with MAC addresses and exact connection times when summarizing network data in public or semi-public channels.

Cross-References