Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for "used energy" #46

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions luxws-exporter/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type collector struct {
outputDesc *prometheus.Desc
opModeDesc *prometheus.Desc
heatQuantityDesc *prometheus.Desc
usedEnergyDesc *prometheus.Desc
suppliedHeatDesc *prometheus.Desc
latestErrorDesc *prometheus.Desc
switchOffDesc *prometheus.Desc
Expand Down Expand Up @@ -93,6 +94,7 @@ func newCollector(opts collectorOpts) *collector {
opModeDesc: prometheus.NewDesc("luxws_operational_mode", "Operational mode", []string{"mode"}, nil),
heatQuantityDesc: prometheus.NewDesc("luxws_heat_quantity", "Heat quantity", []string{"unit"}, nil),
suppliedHeatDesc: prometheus.NewDesc("luxws_supplied_heat", "Supplied heat", []string{"name", "unit"}, nil),
usedEnergyDesc: prometheus.NewDesc("luxws_energy_used", "Energy used", []string{"name", "unit"}, nil),
latestErrorDesc: prometheus.NewDesc("luxws_latest_error", "Latest error", []string{"reason"}, nil),
switchOffDesc: prometheus.NewDesc("luxws_latest_switchoff", "Latest switch-off", []string{"reason"}, nil),
nodeTimeDesc: prometheus.NewDesc("luxws_node_time_seconds", "System time in seconds since epoch (1970)", nil, nil),
Expand All @@ -110,6 +112,7 @@ func (c *collector) Describe(ch chan<- *prometheus.Desc) {
ch <- c.opModeDesc
ch <- c.heatQuantityDesc
ch <- c.suppliedHeatDesc
ch <- c.usedEnergyDesc
ch <- c.latestErrorDesc
ch <- c.switchOffDesc
ch <- c.nodeTimeDesc
Expand Down Expand Up @@ -309,6 +312,10 @@ func (c *collector) collectSuppliedHeat(ch chan<- prometheus.Metric, content *lu
return c.collectMeasurements(ch, c.suppliedHeatDesc, content, c.terms.NavHeatQuantity)
}

func (c *collector) collectUsedEnergy(ch chan<- prometheus.Metric, content *luxwsclient.ContentRoot, q *quirks) error {
return c.collectMeasurements(ch, c.usedEnergyDesc, content, c.terms.NavEnergyUsed)
}

func (c *collector) collectLatestError(ch chan<- prometheus.Metric, content *luxwsclient.ContentRoot, _ *quirks) error {
return c.collectTimetable(ch, c.latestErrorDesc, content, c.terms.NavErrorMemory)
}
Expand All @@ -329,6 +336,7 @@ func (c *collector) collectAll(ch chan<- prometheus.Metric, content *luxwsclient
c.collectInputs,
c.collectOutputs,
c.collectSuppliedHeat,
c.collectUsedEnergy,
c.collectLatestError,
c.collectLatestSwitchOff,
} {
Expand Down
1 change: 1 addition & 0 deletions luxwslang/german.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var German = &Terminology{
NavInputs: "Eingänge",
NavOutputs: "Ausgänge",
NavHeatQuantity: "Wärmemenge",
NavEnergyUsed: "Eingesetzte Energie",
NavErrorMemory: "Fehlerspeicher",
NavSwitchOffs: "Abschaltungen",

Expand Down
1 change: 1 addition & 0 deletions luxwslang/terminology.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Terminology struct {
NavInputs string
NavOutputs string
NavHeatQuantity string
NavEnergyUsed string
NavErrorMemory string
NavSwitchOffs string

Expand Down