Skip to content

Commit

Permalink
feat: add input power
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Jan 6, 2024
1 parent 9d8ff95 commit c129b3a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions collector/solarman.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type currentCollector struct {

ratedPower *prometheus.Desc // Pr1 W
outputPower *prometheus.Desc // APo_t1 W
inputPower *prometheus.Desc // DPi_t1 W
cumulativeProduction *prometheus.Desc // Et_ge0 kWh
dailyProduction *prometheus.Desc // Etdy_ge1 kWh
temperature *prometheus.Desc // T_AC_RDT1 C
Expand Down Expand Up @@ -52,6 +53,10 @@ func CurrentCollector(client *solarman.Client, inverterSN string) prometheus.Col
prometheus.BuildFQName(namespace, subsystem, "output_power_watts"),
"Total AC Output Power (Active)", nil, nil,
),
inputPower: prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "input_power_watts"),
"Total DC Input Power (Active)", nil, nil,
),
cumulativeProduction: prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "cumulative_production_kwh_total"),
"Cumulative Production (Active)", nil, nil,
Expand Down Expand Up @@ -95,6 +100,7 @@ func (c *currentCollector) Collect(ch chan<- prometheus.Metric) {

ch <- prometheus.MustNewConstMetric(c.ratedPower, prometheus.GaugeValue, get(data, "Pr1"))
ch <- prometheus.MustNewConstMetric(c.outputPower, prometheus.GaugeValue, get(data, "APo_t1"))
ch <- prometheus.MustNewConstMetric(c.inputPower, prometheus.GaugeValue, get(data, "DPi_t1"))
ch <- prometheus.MustNewConstMetric(c.cumulativeProduction, prometheus.CounterValue, get(data, "Et_ge0"))
ch <- prometheus.MustNewConstMetric(c.dailyProduction, prometheus.CounterValue, get(data, "Etdy_ge1"))
ch <- prometheus.MustNewConstMetric(c.temperature, prometheus.GaugeValue, get(data, "T_AC_RDT1"))
Expand Down

0 comments on commit c129b3a

Please # to comment.