From d2d18e747da6faf9f055fff095ca62d176cb199f Mon Sep 17 00:00:00 2001 From: davidnewhall2 Date: Mon, 15 Jul 2019 00:06:16 -0700 Subject: [PATCH] fix again --- core/unifi/usg_influx.go | 4 ++++ core/unifi/usw_influx.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/core/unifi/usg_influx.go b/core/unifi/usg_influx.go index 5f766539..c1f90319 100644 --- a/core/unifi/usg_influx.go +++ b/core/unifi/usg_influx.go @@ -17,6 +17,10 @@ func (u *USG) Points() ([]*influx.Point, error) { // These points can be passed directly to influx. // This is just like Points(), but specify when points were created. func (u *USG) PointsAt(now time.Time) ([]*influx.Point, error) { + if u.Stat.gw == nil { + // Disabled devices lack stats. + u.Stat.gw = &gw{} + } tags := map[string]string{ "id": u.ID, "mac": u.Mac, diff --git a/core/unifi/usw_influx.go b/core/unifi/usw_influx.go index 8a745d26..f02e195b 100644 --- a/core/unifi/usw_influx.go +++ b/core/unifi/usw_influx.go @@ -16,6 +16,10 @@ func (u *USW) Points() ([]*influx.Point, error) { // These points can be passed directly to influx. // This is just like Points(), but specify when points were created. func (u *USW) PointsAt(now time.Time) ([]*influx.Point, error) { + if u.Stat.sw == nil { + // Disabled devices lack stats. + u.Stat.sw = &sw{} + } tags := map[string]string{ "id": u.ID, "mac": u.Mac,