Permalink
Browse files

support: illuminance

  • Loading branch information...
papix committed Jun 30, 2018
1 parent cec1cbe commit 6a2bf21ab132a4edd0e760c81543cf6f4d3a23ea
Showing with 12 additions and 1 deletion.
  1. +1 −1 Gopkg.lock
  2. +11 −0 lib/nature-remo.go

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -24,6 +24,7 @@ func (nr NatureRemoPlugin) GraphDefinition() map[string]mp.Graphs {
ret := map[string]mp.Graphs{}
temperature := make([]mp.Metrics, len(devices))
humidity := make([]mp.Metrics, len(devices))
illuminance := make([]mp.Metrics, len(devices))

for i, device := range devices {
temperature[i] = mp.Metrics{
@@ -34,6 +35,10 @@ func (nr NatureRemoPlugin) GraphDefinition() map[string]mp.Graphs {
Name: fmt.Sprintf("humidity.%s", device.Name),
Label: "humidity",
}
illuminance[i] = mp.Metrics{
Name: fmt.Sprintf("illuminance.%s", device.Name),
Label: "illuminance",
}
}
ret["temperature"] = mp.Graphs{
Label: "temperature",
@@ -45,6 +50,11 @@ func (nr NatureRemoPlugin) GraphDefinition() map[string]mp.Graphs {
Unit: mp.UnitInteger,
Metrics: humidity,
}
ret["illuminance"] = mp.Graphs{
Label: "illuminance",
Unit: mp.UnitFloat,
Metrics: illuminance,
}

return ret
}
@@ -60,6 +70,7 @@ func (nr NatureRemoPlugin) FetchMetrics() (map[string]float64, error) {
for _, device := range devices {
ret[fmt.Sprintf("temperature.%s", device.Name)] = float64(device.NewestEvents.Temperature.Value)
ret[fmt.Sprintf("humidity.%s", device.Name)] = float64(device.NewestEvents.Humidity.Value)
ret[fmt.Sprintf("illuminance.%s", device.Name)] = float64(device.NewestEvents.Illuminance.Value)
}

return ret, nil

0 comments on commit 6a2bf21

Please sign in to comment.