7a89225d72
Finishes device refactoring: temps Refactoring to allow updating maps. Simpler, and optimizable.
25 lines
430 B
Go
25 lines
430 B
Go
// +build windows
|
|
|
|
package devices
|
|
|
|
import (
|
|
psHost "github.com/shirou/gopsutil/host"
|
|
)
|
|
|
|
func init() {
|
|
RegisterTemp(update)
|
|
}
|
|
|
|
func update(temps map[string]int) map[string]error {
|
|
sensors, err := psHost.SensorsTemperatures()
|
|
if err != nil {
|
|
return map[string]error{"gopsutil": err}
|
|
}
|
|
for _, sensor := range sensors {
|
|
if sensor.Temperature != 0 {
|
|
temps[sensor.SensorKey] = int(sensor.Temperature)
|
|
}
|
|
}
|
|
return nil
|
|
}
|