I am getting CPU temperature using wmi library in Windows 32-bit with Python but I think it's false when compared with the results of Core Temp

Question:

I keep getting the value 30.85° with the following code using the wmi library. Here is my code:

import wmi

w = wmi.WMI(namespace=r'rootwmi')

temp = w.MSAcpi_ThermalZoneTemperature()[0].CurrentTemperature

kelvin = temp / 10
celsius = kelvin - 273.15
fahrenheit = (9/5) * celsius + 32

print(f'Kalvin:{kelvin:^10.2f}tCelsius:{celsius:^10.2f}tFahrenheit:{fahrenheit:^10.2f}')

Here is the result:

Kalvin:  304.00     Celsius:  30.85     Fahrenheit:  87.53   

I also want to point out that this value won’t change unless I reboot my laptop, or after waiting around 30 minutes.

Finally, here are the results that are shown in Core Temp 1.15.1 which are changing constantly.

Core Temp Results in the temperature of all cores

Can you help me interprete this please?

Asked By: Samir Ahmane

||

Answers:

While reading wim documentation and on the following thread, I am not getting the current temperature of the CPU but rather somewhere else from the motherboard.

Answered By: Samir Ahmane

As stated here.

The Win32_TemperatureProbe WMI class represents the properties of a temperature sensor (electronic thermometer).

Most of the information that the Win32_TemperatureProbe WMI class provides comes from SMBIOS. Real-time readings for the CurrentReading property cannot be extracted from SMBIOS tables. For this reason, current implementations of WMI do not populate the CurrentReading property.

Answered By: not2qubit
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.