Skip to content

Commit

Permalink
Fix code consistency for value reading
Browse files Browse the repository at this point in the history
  • Loading branch information
daenney committed Jun 30, 2022
1 parent e336fc1 commit c6a0453
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions collectors/environmental.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func (c *EnvironmentalCollector) Collect(ch chan<- prometheus.Metric) {
temperature := map[string]float64{}

for _, s := range devices {
if s.Feature(feature.CurrentRelativeHumidity.String()).Exists() {
v := s.Feature(feature.CurrentRelativeHumidity.String()).Value()
if ft := s.Feature(feature.CurrentRelativeHumidity.String()); ft.Exists() {
v := ft.Value()
if v == "" {
continue
}
Expand All @@ -154,8 +154,8 @@ func (c *EnvironmentalCollector) Collect(ch chan<- prometheus.Metric) {
ch <- prometheus.MustNewConstMetric(c.relativeHumidity,
prometheus.GaugeValue, vf, s.Info().Topic)
}
if s.Feature(feature.CurrentTemperature.String()).Exists() {
v := s.Feature(feature.CurrentTemperature.String()).Value()
if ft := s.Feature(feature.CurrentTemperature.String()); ft.Exists() {
v := ft.Value()
if v == "" {
continue
}
Expand Down

0 comments on commit c6a0453

Please sign in to comment.