1

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'root\wmi')

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?

Samir Ahmane
  • 830
  • 7
  • 22
  • Not sure why you think it's wrong. I executed the same sequence on my laptop and received nearly identical results: Fahrenheit 87.54 – user590028 Mar 15 '20 at 16:30
  • I have looked upon wmi documentation, and it seems that I'm not actually getting the temperature of the CPU but rather from another sensor. It's as if, for example, it represents the temperature of the kitchen as 85 Fahrenheit, but the oven is at 200 Fahrenheit. Moreover, it is not in real time. – Samir Ahmane Mar 16 '20 at 21:02

2 Answers2

1

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.

Samir Ahmane
  • 830
  • 7
  • 22
1

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.

not2qubit
  • 14,531
  • 8
  • 95
  • 135