mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-17 18:29:48 +00:00
Merge pull request #1705 from benphelps/fix/issue-1703
Fix: Handle cpu sensors without `warning` property
This commit is contained in:
commit
179512672a
1 changed files with 2 additions and 2 deletions
|
@ -50,7 +50,7 @@ export default function Widget({ options }) {
|
||||||
if (options.cputemp && cpuSensors) {
|
if (options.cputemp && cpuSensors) {
|
||||||
try {
|
try {
|
||||||
mainTemp = cpuSensors.reduce((acc, s) => acc + s.value, 0) / cpuSensors.length;
|
mainTemp = cpuSensors.reduce((acc, s) => acc + s.value, 0) / cpuSensors.length;
|
||||||
maxTemp = Math.max(cpuSensors.reduce((acc, s) => acc + s.warning, 0) / cpuSensors.length, maxTemp);
|
maxTemp = Math.max(cpuSensors.reduce((acc, s) => acc + (s.warning > 0 ? s.warning : 0), 0) / cpuSensors.length, maxTemp);
|
||||||
if (unit === "fahrenheit") {
|
if (unit === "fahrenheit") {
|
||||||
mainTemp = convertToFahrenheit(mainTemp);
|
mainTemp = convertToFahrenheit(mainTemp);
|
||||||
maxTemp = convertToFahrenheit(maxTemp);
|
maxTemp = convertToFahrenheit(maxTemp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue