upgrades supporting modules and corrects type mismatch
This commit is contained in:
@@ -4,8 +4,7 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"tplink/internal/tplink"
|
||||
|
||||
"github.com/TheSp1der/tplink"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
@@ -29,8 +28,8 @@ func (cfg *config) gatherMetrics() {
|
||||
cfg.Prometheus.CurrentMa.With(prometheus.Labels{"device": host}).Set(float64(m.Emeter.GetRealtime.CurrentMa / 1000.0))
|
||||
cfg.Prometheus.VoltageMv.With(prometheus.Labels{"device": host}).Set(float64(m.Emeter.GetRealtime.VoltageMv / 1000.0))
|
||||
cfg.Prometheus.PowerMw.With(prometheus.Labels{"device": host}).Set(float64(m.Emeter.GetRealtime.PowerMw / 1000.0))
|
||||
cfg.Prometheus.TotalWh.With(prometheus.Labels{"device": host}).Add(float64(m.Emeter.GetRealtime.TotalWh - tracker[host]))
|
||||
tracker[host] = m.Emeter.GetRealtime.TotalWh
|
||||
cfg.Prometheus.TotalWh.With(prometheus.Labels{"device": host}).Add(float64(float64(m.Emeter.GetRealtime.TotalWh) - tracker[host]))
|
||||
tracker[host] = float64(m.Emeter.GetRealtime.TotalWh)
|
||||
}
|
||||
time.Sleep(time.Duration(time.Second * 15))
|
||||
}
|
||||
|
Reference in New Issue
Block a user