Iw3m temperature differs from sensors output by ~15-20 degrees

Hi all.

I installed EOS with i3 window management. Included with it is i3blocks which has a (cpu) temperature script [relevant code below]. The temperature reported on my i3 status bar is generally 15-20C higher than what the output of sensors is.

I wrote a short script that saved the output from sensors to a text file every 15 seconds and let it run in the background for a couple of hours. None of the temperature measurements in the text file were in the neighborhood of what the i3 status bar had displayed at similar times (which updates every 30 seconds).

This isn’t really a cause for concern to me but I wanted to understand why this is happening. Reading through /.config/i3/scripts/temperature doesn’t reveal anything out of the ordinary.

Any ideas?

Edit: as an example: i3 temp: 57C; sensors 41C.

### c/p from /.config/i3/scripts/temperature
# Get chip temperature
open (SENSORS, "sensors -u $chip |") or die;
while (<SENSORS>) {
    if (/^\s+temp1_input:\s+[\+]*([\-]*\d+\.\d)/) {
        $temperature = $1;
        last;
    }
}
close(SENSORS);
### Relevant part from /.config/i3/i3blocks.conf
[CPU-temperature]
label=
command=~/.config/i3/scripts/temperature 
interval=30
#T_WARN=70
#T_CRIT=90
#SENSOR_CHIP=""

you can set the chip it uses for the output…
command=~/.config/i3/scripts/temperature --chip acpitz-acpi-0
per example… chips you can take from sensors output …

I changed #SENSOR_CHIP="" to SENSOR_CHIP="coretemp-isa-0000" without any effect (after restarting i3). This makes sense as the regex expression in the script above fetches the correct line from sensors -u irrespective of chip setting (at least on my machine).

I did download i7z and the temperature displayed there is in agreement with sensors.

this will highly depend on the used hardware… for me I have a lot of sensors it never shows the right one and for me the only was to know what exactly temp it shows is to set the chop id :wink:

https://archlinux.org/packages/community/x86_64/i7z/

This seems legit… i had to install it87-dkms-git to get all sensors working here.

So the problem is solved … and I do not need to review i3 configs ?