pi-hole / PADD

PADD (formerly Chronometer2) is a more expansive version of the original chronometer.sh that is included with Pi-Hole. PADD provides in-depth information about your Pi-hole.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CPU temp not updating - RPi 4

shadowa4 opened this issue · comments

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.

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

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?

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.

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.

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.

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

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

Good catch @rdwebdesign.

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