summaryrefslogtreecommitdiffstats
path: root/devices/temp_windows.go
blob: 230e902b0120014082dca9eef2bd5b473f1c9785 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// +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
}