summaryrefslogtreecommitdiffstats
path: root/devices/temp.go
blob: 87f534f5f4f176734487cc721ea8da61f2717839 (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
package devices

import (
	"log"
)

// TODO add thermal history graph. Update when something changes?

var tempUpdates []func(map[string]int) map[string]error

func RegisterTemp(update func(map[string]int) map[string]error) {
	tempUpdates = append(tempUpdates, update)
}

func UpdateTemps(temps map[string]int) {
	for _, f := range tempUpdates {
		errs := f(temps)
		if errs != nil {
			for k, e := range errs {
				log.Printf(tr.Value("error.recovfetch", "temp", k, e.Error()))
			}
		}
	}
}