import "github.com/mdlayher/unifi"
Package unifi implements a client for the Ubiquiti UniFi Controller v4 and v5 API.
alarms.go client.go devices.go sites.go stations.go
InsecureHTTPClient creates a *http.Client which does not verify a UniFi Controller's certificate chain and hostname.
Please think carefully before using this client: it should only be used with self-hosted, internal UniFi Controllers.
type Alarm struct { ID string APMAC net.HardwareAddr APName string Archived bool DateTime time.Time Key string Message string SiteID string Subsystem string }
An Alarm is an alert which is triggered when a Device becomes unavailable.
UnmarshalJSON unmarshals the raw JSON representation of an Alarm.
A Client is a client for the Ubiquiti UniFi Controller v4 API.
Client.Login must be called and return a nil error before any additional actions can be performed with a Client.
NewClient creates a new Client, using the input API address and an optional HTTP client. If no HTTP client is specified, a default one will be used.
If working with a self-hosted UniFi Controller which does not have a valid TLS certificate, InsecureHTTPClient can be used.
Client.Login must be called and return a nil error before any additional actions can be performed with a Client.
Alarms returns all of the Alarms for a specified site name.
Devices returns all of the Devices for a specified site name.
Login authenticates against the UniFi Controller using the specified username and password. Login must be called and return a nil error before any additional actions can be performed.
Sites returns all of the Sites managed by a UniFi Controller.
Stations returns all of the Stations for a specified site name.
type Device struct { ID string Adopted bool InformIP net.IP InformURL *url.URL Model string Name string NICs []*NIC Radios []*Radio Serial string SiteID string Stats *DeviceStats Uptime time.Duration Version string }
A Device is a Ubiquiti UniFi device, such as a UniFi access point.
UnmarshalJSON unmarshals the raw JSON representation of a Device.
type DeviceStats struct { TotalBytes float64 All *WirelessStats Guest *WirelessStats User *WirelessStats Uplink *WiredStats }
DeviceStats contains device network activity statistics.
func (s *DeviceStats) String() string
type NIC struct { MAC net.HardwareAddr Name string }
A NIC is a wired ethernet network interface, attached to a Device.
type Radio struct { BuiltInAntenna bool BuiltInAntennaGain int MaxTXPower int MinTXPower int Name string Radio string Stats *RadioStationsStats }
A Radio is a wireless radio, attached to a Device.
type RadioStationsStats struct { NumberStations int NumberGuestStations int NumberUserStations int }
RadioStationsStats contains Station statistics for a Radio.
type Site struct { ID string `json:"_id"` Description string `json:"desc"` Name string `json:"name"` NumAPs int `json:"num_ap"` NumStations int `json:"num_sta"` Role string `json:"role"` }
A Site is a physical location with UniFi devices managed by a UniFi Controller.
type Station struct { ID string APMAC net.HardwareAddr AssociationTime time.Time Channel int FirstSeen time.Time Hostname string // Device-provided name IdleTime time.Duration IP net.IP IsWired bool LastSeen time.Time MAC net.HardwareAddr RoamCount int Name string // Unifi-set name Noise int RSSI int SiteID string Stats *StationStats Uptime time.Duration UserID string }
A Station is a client connected to a UniFi access point.
UnmarshalJSON unmarshals the raw JSON representation of a Station.
type StationStats struct { ReceiveBytes int64 ReceivePackets int64 ReceiveRate int TransmitBytes int64 TransmitPackets int64 TransmitPower int TransmitRate int }
StationStats contains station network activity statistics.
type WiredStats struct { ReceiveBytes float64 ReceivePackets float64 TransmitBytes float64 TransmitPackets float64 }
WiredStats contains wired device network activity statistics.
func (s *WiredStats) String() string
type WirelessStats struct { ReceiveBytes float64 ReceivePackets float64 TransmitBytes float64 TransmitDropped float64 TransmitPackets float64 }
WirelessStats contains wireless device network activity statistics.
func (s *WirelessStats) String() string
Package unifi imports 10 packages (graph) and is imported by 3 packages. Updated 2018-06-07. Refresh now. Tools for package owners.