refactor: harden diagnostics and consolidate runtime code
This commit is contained in:
@@ -293,6 +293,10 @@ func sampleLiveTempsViaIPMI() []TempReading {
|
||||
}
|
||||
|
||||
func firstTempInputValue(feature map[string]any) (float64, bool) {
|
||||
return firstSensorInputValue(feature, "temp")
|
||||
}
|
||||
|
||||
func firstSensorInputValue(feature map[string]any, kind string) (float64, bool) {
|
||||
keys := make([]string, 0, len(feature))
|
||||
for key := range feature {
|
||||
keys = append(keys, key)
|
||||
@@ -300,7 +304,7 @@ func firstTempInputValue(feature map[string]any) (float64, bool) {
|
||||
sort.Strings(keys)
|
||||
for _, key := range keys {
|
||||
lower := strings.ToLower(key)
|
||||
if !strings.Contains(lower, "temp") || !strings.HasSuffix(lower, "_input") {
|
||||
if !strings.Contains(lower, kind) || !strings.HasSuffix(lower, "_input") {
|
||||
continue
|
||||
}
|
||||
switch value := feature[key].(type) {
|
||||
|
||||
Reference in New Issue
Block a user