Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU temp not updating - RPi 4 #368

Closed
shadowa4 opened this issue Sep 21, 2023 · 9 comments · Fixed by #370
Closed

CPU temp not updating - RPi 4 #368

shadowa4 opened this issue Sep 21, 2023 · 9 comments · Fixed by #370

Comments

@shadowa4
Copy link

I recently did a fresh install of Raspberry Pi OS on a RPi 4b in order to install the 64bit version. While following the normal padd install guide, I reached the usual padd output screen on the CLI, with all fields updating. However, I also have an Adafruit screen mounted to the Pi displaying the PADD output 24/7.

It's in the external screen that only the CPU temp fails to update. It will display correctly at boot, and remain with the same value while all other stats update as usual.

Has anyone seen this? The screen displays all other CLI outputs just fine, and even the desktop when in desktop mode. This leads me to believe its a PADD config problem, but would like some input.

Thanks.

@EdmundGerber
Copy link

I'm just noticing that as well, on an older RPi2

@yubiuser
Copy link
Member

I'm not sure if this is a PADD issue. It reads the temperature correctly at boot, all subsequent reads use the same source.

We use the following sources

PADD/padd.sh

Lines 163 to 175 in 81aeac9

# CPU temperature
if [ -d "/sys/devices/platform/coretemp.0/hwmon/" ]; then
cpu=$(cat "$(find /sys/devices/platform/coretemp.0/hwmon/ -maxdepth 2 -name "temp1_input" 2>/dev/null | head -1)" 2>/dev/null)
fi
if [ -z "${cpu}" ] && [ -f /sys/class/thermal/thermal_zone0/temp ]; then
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
fi
if [ -z "${cpu}" ] && [ -f /sys/class/hwmon/hwmon0/temp1_input ]; then
cpu=$(cat /sys/class/hwmon/hwmon0/temp1_input)
fi
if [ -z "${cpu}" ]; then
cpu=0
fi

Please check which one exists on your system and if the OS is updating the temperature there. Also: does the Pi-hole web GUI updated the temperature?

@EdmundGerber
Copy link

EdmundGerber commented Sep 23, 2023

The Web GUI works as usual. I'm not sure when this stopped working, but it hasn't changed since the last Pihole restart. If I restart PADD, it shows the current temp, but then never changes until the next reboot.

I'm not sure how to determine what sensors this is using, but certainly the same ones they always have been. I'll see if anything needs updating, and report any change. On Raspbian Bullseye (5.15.84-v7+)

Edit - no change after updating Raspbian. Reboot RPi - start PADD - it displays a temperature, then never changes again.

@rdwebdesign
Copy link
Member

rdwebdesign commented Sep 23, 2023

I think I know what is the issue.

Raspberry Pi use this code to update the temperature:

PADD/padd.sh

Lines 167 to 169 in 81aeac9

if [ -z "${cpu}" ] && [ -f /sys/class/thermal/thermal_zone0/temp ]; then
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
fi

On the first iteration, the variable starts empty and the correct value is set.

On the subsequent iterations the variable is already set and the test [-z "${cpu}"] fails. As a result, the value is not updated and the old value is always displayed.

This is probably happening on almost every device, except those using the sensor tested on line 164.

To fix this, we need to unset the variable before every test.

@EdmundGerber
Copy link

Sounds like you are on the right path. As I had time to kill, I grabbed PADD 3.10.1, and it works as expected.

@rdwebdesign
Copy link
Member

PADD 3.10.1 temperature tests were changed because there were cases where some temp sensor files existed, but they were empty, causing errors.

@rdwebdesign
Copy link
Member

@EdmundGerber

Can you test this version?

It is fixed?

@EdmundGerber
Copy link

So far so good - temperature changing as it should, with the version linked. Thank you for looking into this.

@yubiuser
Copy link
Member

Good catch @rdwebdesign.

I think we could have a bug fix point release today...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants