1

I am trying to get all the sensors that OpenHardwareMonitor can give. But i get almost all load type sensors ando not many temperature sensors:

This is my code:

{
            Computer myComputer = new Computer();
            myComputer = new Computer()
            {
                CPUEnabled =

                    true
            };

            myComputer.Open();
            Trace.WriteLine("");
            foreach (var hardwareItem in myComputer.Hardware)
            {
                if (hardwareItem.HardwareType == HardwareType.CPU)
                {
                    hardwareItem.Update();
                    foreach (IHardware subHardware in hardwareItem.SubHardware)
                        subHardware.Update();

                    foreach (var sensor in hardwareItem.Sensors)
                    {
                        Debug.WriteLine(sensor.Name + " " + sensor.SensorType + " " + sensor.SensorType);
                    }
                }
            }
        }

This is the result i get:

CPU Core #1 Load Load
CPU Core #2 Load Load
CPU Core #3 Load Load
CPU Core #4 Load Load
CPU Core #5 Load Load
CPU Core #6 Load Load
CPU Core #7 Load Load
CPU Core #8 Load Load
CPU Core #9 Load Load
CPU Core #10 Load Load
CPU Core #11 Load Load
CPU Core #12 Load Load
CPU Core #13 Load Load
CPU Core #14 Load Load
CPU Core #15 Load Load
CPU Core #16 Load Load
CPU Total Load Load

But i would like to get the CPU Temp and Volt, but i cant figure out a way to get them, also just to mention that if i use open hardware monitor app i can see all the sensors correctly.

Thanks so much for the help!

I have tried lots of tutorials, done the same in a subhardware loop but nothing shows up

kiner_shah
  • 3,939
  • 7
  • 23
  • 37

2 Answers2

1

It might be that your hardware is not supported by OpenHardwareMonitor. There is a list of supported hardware on their page.

Also you might need to run your app as Administrator to get the required information. I was able to get the temperature sensors in the list, but without values. And I saw the values by running as administrator.

Mike Mozhaev
  • 2,367
  • 14
  • 13
  • Thanks a lot for your reply! OpenHardwareMonitor does support my hardware, as i can run the app and see all the sensors. Also yes, the app is running as Administrator – Michael Canseco Jan 30 '23 at 16:18
1

Ive managed to fix it.

I was not implementing Ivisitor and LibreHardwareMonitor seems to be the updated version of the dll (i had to got it via nuget as it has to update some independeces)

Here i found the example code with the Ivisitor implemented: https://github.com/LibreHardwareMonitor/LibreHardwareMonitor