Search code examples
node.jsdllwmiget-wmiobjectopenhardwaremonitor

NodeJS get CPU temperature - Use OpenHardwareMonitorLib.dll in NodeJS


I'm trying to get the CPU and GPU temperatures of my computer that I connect via ssh. When I try wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature command I got this error ;

Node - ADMIN
ERROR:
Description = Not supported

Then I decided to use https://openhardwaremonitor.org/

But I don't know how to use OpenHardwareMonitorLib.dll in nodejs. I am currently working with VS Code for my NodeJS project. I am trying to follow http://www.lattepanda.com/topic-f11t3004.html directions. According to the direction here, I need to add the OpenHardwareMonitorLib.dll file to the project and display the CPU and GPU temperature like that. I don't know much about how to add the dll file to the nodejs project and how to use the functions. I would be glad if you help.


Solution

  • You won't be able to get the CPU temp through WMI or any other means accurately. The CPU Driver which keeps the temp is only available through the vendor. Most motherboards have access to the CPU disabled while others have them enabled.

    Long story short, the library you are asking about is not an accurate alternative. They have manually built in each motherboard and the available CPU device driver to gain the accuracy. The motherboards that do not allow access is pretty much inaccessible and not accurate.

    Most of the CPU temps are on a wing it basis. They use a math formula to simulate what it could be. Then it's still off by a factor of 2 to 3 degrees.

    The error you have is basically saying your motherboard doesn't have access to the temp.

    This is a motherboard vendor issue with is it available. I went through this 5 years ago and called ASUS Motherboard and found all this out.