Handle dev.pchtherm temperatures in the thermal dashboard widget (#8062)

This commit is contained in:
Joe Roback 2025-02-13 03:32:51 -07:00 committed by GitHub
parent cc16ba7b33
commit e511d52e95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -240,13 +240,15 @@ class SystemController extends ApiControllerBase
$tempItem['temperature'] = trim(str_replace('C', '', $value));
$tempItem['type_translated'] = gettext('CPU');
$tempItem['type'] = 'cpu';
if (strpos($tempItem['device'], 'hw.acpi') !== false) {
if (str_starts_with($tempItem['device'], 'hw.acpi.')) {
$tempItem['type_translated'] = gettext('Zone');
$tempItem['type'] = 'zone';
/* XXX may or may not be a good idea */
} elseif (strpos($tempItem['device'], 'dev.amdtemp') !== false) {
} elseif (str_starts_with($tempItem['device'], 'dev.amdtemp.')) {
$tempItem['type_translated'] = gettext('AMD');
$tempItem['type'] = 'amd';
} else if (str_starts_with($tempItem['device'], 'dev.pchtherm.')) {
$tempItem['type'] = 'platform';
$tempItem['type_translated'] = gettext('Platform');
}
$result[] = $tempItem;
}