add more site names.

This commit is contained in:
David Newhall II 2019-06-05 17:46:31 -07:00
parent 381ad45f12
commit d2519412c4
4 changed files with 9 additions and 1 deletions

2
core/unifi/Gopkg.lock generated
View File

@ -19,7 +19,7 @@
"v2",
]
pruneopts = "UT"
revision = "16c852ea613fa2d42fcdccc9a8b0802a8bdc6140"
revision = "8ff2fc3824fcb533795f9a2f233275f0bb18d6c5"
[[projects]]
digest = "1:cf31692c14422fa27c83a05292eb5cbe0fb2775972e8f1f8446a71549bd8980b"

View File

@ -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"`

View File

@ -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

View File

@ -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"`