Add full site name to sites.

This commit is contained in:
David Newhall II 2019-06-15 12:49:46 -07:00
parent 4e061b82f3
commit 633dbda4d3
3 changed files with 3 additions and 0 deletions

View File

@ -15,6 +15,7 @@ func (u Site) Points() ([]*influx.Point, error) {
tags := map[string]string{ tags := map[string]string{
"id": u.ID, "id": u.ID,
"name": u.Name, "name": u.Name,
"site_name": u.SiteName,
"desc": u.Desc, "desc": u.Desc,
"status": s.Status, "status": s.Status,
"subsystem": s.Subsystem, "subsystem": s.Subsystem,

View File

@ -8,6 +8,7 @@ type Site struct {
ID string `json:"_id"` ID string `json:"_id"`
Name string `json:"name"` Name string `json:"name"`
Desc string `json:"desc"` Desc string `json:"desc"`
SiteName string `json:"-"`
AttrHiddenID string `json:"attr_hidden_id"` AttrHiddenID string `json:"attr_hidden_id"`
AttrNoDelete FlexBool `json:"attr_no_delete"` AttrNoDelete FlexBool `json:"attr_no_delete"`
Health []struct { Health []struct {

View File

@ -132,6 +132,7 @@ func (u *Unifi) GetSites() (Sites, error) {
} }
sites := make([]string, 0) sites := make([]string, 0)
for i := range response.Data { for i := range response.Data {
response.Data[i].SiteName = response.Data[i].Desc + " (" + response.Data[i].Name + ")"
sites = append(sites, response.Data[i].Name) sites = append(sites, response.Data[i].Name)
} }
u.dLogf("Found %d site(s): %s", len(sites), strings.Join(sites, ",")) u.dLogf("Found %d site(s): %s", len(sites), strings.Join(sites, ","))