From d2519412c4f2d761c40b7a2de1a15e231373363d Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Wed, 5 Jun 2019 17:46:31 -0700 Subject: [PATCH] add more site names. --- core/unifi/Gopkg.lock | 2 +- core/unifi/uap_type.go | 1 + core/unifi/unifi.go | 6 ++++++ core/unifi/usg_type.go | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/unifi/Gopkg.lock b/core/unifi/Gopkg.lock index 92114921..0ee3eca3 100644 --- a/core/unifi/Gopkg.lock +++ b/core/unifi/Gopkg.lock @@ -19,7 +19,7 @@ "v2", ] pruneopts = "UT" - revision = "16c852ea613fa2d42fcdccc9a8b0802a8bdc6140" + revision = "8ff2fc3824fcb533795f9a2f233275f0bb18d6c5" [[projects]] digest = "1:cf31692c14422fa27c83a05292eb5cbe0fb2775972e8f1f8446a71549bd8980b" diff --git a/core/unifi/uap_type.go b/core/unifi/uap_type.go index 2250f4e5..3b804501 100644 --- a/core/unifi/uap_type.go +++ b/core/unifi/uap_type.go @@ -333,6 +333,7 @@ type UAP struct { RxNwids float64 `json:"rx_nwids"` RxPackets float64 `json:"rx_packets"` SiteID string `json:"site_id"` + SiteName string `json:"-"` State string `json:"state"` T string `json:"t"` TxBytes float64 `json:"tx_bytes"` diff --git a/core/unifi/unifi.go b/core/unifi/unifi.go index 02ee58e6..4c3754fa 100644 --- a/core/unifi/unifi.go +++ b/core/unifi/unifi.go @@ -95,9 +95,15 @@ func (u *Unifi) GetDevices(sites []Site) (*Devices, error) { // Add SiteName to each device asset. for i := range loopDevices.UAPs { loopDevices.UAPs[i].SiteName = site.Name + for j := range loopDevices.UAPs[i].VapTable { + loopDevices.UAPs[i].VapTable[j].SiteName = site.Name + } } for i := range loopDevices.USGs { loopDevices.USGs[i].SiteName = site.Name + for j := range loopDevices.USGs[i].NetworkTable { + loopDevices.USGs[i].NetworkTable[j].SiteName = site.Name + } } for i := range loopDevices.USWs { loopDevices.USWs[i].SiteName = site.Name diff --git a/core/unifi/usg_type.go b/core/unifi/usg_type.go index b7762c73..2f95a552 100644 --- a/core/unifi/usg_type.go +++ b/core/unifi/usg_type.go @@ -68,6 +68,7 @@ type USG struct { RxBytes FlexInt `json:"rx_bytes"` RxPackets float64 `json:"rx_packets"` SiteID string `json:"site_id"` + SiteName string `json:"-"` TxBytes FlexInt `json:"tx_bytes"` TxPackets float64 `json:"tx_packets"` Up FlexBool `json:"up"`