Don't sensor with a temp of 0

This commit is contained in:
Caleb Bassi 2018-11-29 17:37:41 -08:00
parent 7da570d782
commit ce5342cfc9
3 changed files with 7 additions and 3 deletions

View File

@ -52,6 +52,8 @@ func SensorsTemperatures() ([]TemperatureStat, error) {
func (self *Temp) update() {
sensors, _ := SensorsTemperatures()
for _, sensor := range sensors {
if sensor.Temperature != 0 {
self.Data[sensor.SensorKey] = int(sensor.Temperature)
}
}
}

View File

@ -10,7 +10,7 @@ func (self *Temp) update() {
sensors, _ := psHost.SensorsTemperatures()
for _, sensor := range sensors {
// only sensors with input in their name are giving us live temp info
if strings.Contains(sensor.SensorKey, "input") {
if strings.Contains(sensor.SensorKey, "input") && sensor.Temperature != 0 {
// removes '_input' from the end of the sensor name
label := sensor.SensorKey[:strings.Index(sensor.SensorKey, "_input")]
self.Data[label] = int(sensor.Temperature)

View File

@ -7,6 +7,8 @@ import (
func (self *Temp) update() {
sensors, _ := psHost.SensorsTemperatures()
for _, sensor := range sensors {
if sensor.Temperature != 0 {
self.Data[sensor.SensorKey] = int(sensor.Temperature)
}
}
}