Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which python module is used to read CPU temperature and processor fan speed in Windows?

Tags:

python

wmi

Which python module is used to read CPU temperature and processor Fan speed in Windows?

I explored the WMI python module, however I am unable to find the correct option or function to capture the above mentioned info.

Actually I tried the following code snip, but it returns 'nothing'.

import wmi
w = wmi.WMI()
print w.Win32_TemperatureProbe()[0].CurrentReading

Is there a way to get this information?

like image 982
msgsrk Avatar asked Sep 20 '25 15:09

msgsrk


1 Answers

As per Microsoft's MSDN:

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. The CurrentReading property's presence is reserved for future use.

You can use MSAcpi_ThermalZoneTemperature instead:

import wmi

w = wmi.WMI(namespace="root\\wmi")
print (w.MSAcpi_ThermalZoneTemperature()[0].CurrentTemperature/10.0)-273.15
like image 174
Zeugma Avatar answered Sep 22 '25 05:09

Zeugma