export: merge inspur psu sensor groups
This commit is contained in:
@@ -1071,11 +1071,18 @@ func convertSensors(sensors []models.SensorReading) *ReanimatorSensors {
|
||||
func groupedPowerSensorName(name string) string {
|
||||
trimmed := strings.TrimSpace(name)
|
||||
lower := strings.ToLower(trimmed)
|
||||
for _, suffix := range []string{"_inputpower", "_inputvoltage", "_inputcurrent"} {
|
||||
inputSuffixes := []string{"_inputpower", "_inputvoltage", "_inputcurrent", "_pin", "_vin", "_iin"}
|
||||
for _, suffix := range inputSuffixes {
|
||||
if strings.HasSuffix(lower, suffix) {
|
||||
return strings.TrimSpace(trimmed[:len(trimmed)-len(suffix)])
|
||||
}
|
||||
}
|
||||
outputSuffixes := []string{"_outputpower", "_outputvoltage", "_outputcurrent", "_pout", "_vout", "_iout"}
|
||||
for _, suffix := range outputSuffixes {
|
||||
if strings.HasSuffix(lower, suffix) {
|
||||
return strings.TrimSpace(trimmed[:len(trimmed)-len(suffix)]) + "_Output"
|
||||
}
|
||||
}
|
||||
return trimmed
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user