diff --git a/pkg/collect/collector.go b/pkg/collect/collector.go index 510c422..8cf0aa9 100644 --- a/pkg/collect/collector.go +++ b/pkg/collect/collector.go @@ -19,6 +19,10 @@ func NewCollector(client shelly.Client, log *zap.Logger) *Collector { "Current real AC power being drawn, in Watts", []string{"device", "meter"}, nil, ), + TotalWattMinutes: prometheus.NewDesc("shelly_meter_total_wattminutes", + "Total energy consumed by the attached electrical appliance in Watt-minute", + []string{"device", "meter"}, nil, + ), RelayOn: prometheus.NewDesc("shelly_relay_on", "Whether the channel is turned ON or OFF", []string{"device", "relay"}, nil, @@ -107,6 +111,7 @@ type Collector struct { TargetTemperature *prometheus.Desc TargetEnabled *prometheus.Desc BatteryStatus *prometheus.Desc + TotalWattMinutes *prometheus.Desc } func (c *Collector) Describe(ch chan<- *prometheus.Desc) { @@ -171,6 +176,8 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) { meterID := strconv.Itoa(i) ch <- prometheus.MustNewConstMetric(c.MeterPower, prometheus.GaugeValue, meter.Power, status.MAC, meterID) + ch <- prometheus.MustNewConstMetric(c.TotalWattMinutes, prometheus.CounterValue, meter.Total, + status.MAC, meterID) } for i, relay := range status.Relays { diff --git a/pkg/shelly/model.go b/pkg/shelly/model.go index 254c964..bd8f934 100644 --- a/pkg/shelly/model.go +++ b/pkg/shelly/model.go @@ -22,6 +22,7 @@ type Status struct { type Meter struct { Power float64 + Total float64 } type Relay struct {