Note that there are some explanatory texts on larger screens.

plurals
  1. POGet hardware temp from OpenHardwareMonitor
    primarykey
    data
    text
    <p>I'm trying to use OpenHardwareMonitor to get a reading on the diagnostics of my hardware. If you've ever tried using OHM you know that there is very little documentation on it yet to my knowledge there is no other open source library that is as accurate and robust. </p> <p>I've been able to get load and clock speed from the CPU but not the temperature. I also don't receive any information about the hard drive (temp concerns me most).</p> <p>Here's my implementation, it should return everything it has but so far I only get limited information about the RAM (no temp), CPU (no temp) and the GPU.</p> <p>CPU Temperature is my most important stat to track.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using OpenHardwareMonitor.Hardware; namespace OHMWrapper { public class MySettings : ISettings { private IDictionary&lt;string, string&gt; settings = new Dictionary&lt;string, string&gt;(); public MySettings(IDictionary&lt;string, string&gt; settings) { this.settings = settings; } public bool Contains(string name) { return settings.ContainsKey(name); } public string GetValue(string name, string value) { string result; if (settings.TryGetValue(name, out result)) return result; else return value; } public void Remove(string name) { settings.Remove(name); } public void SetValue(string name, string value) { settings[name] = value; } } public class OHW { private static OHW m_Instance; public static OHW Instance { get { if (m_Instance == null) m_Instance = new OHW(); return m_Instance; } } private OHW() { m_Instance = this; } public void GetCPUTemp() { MySettings settings = new MySettings(new Dictionary&lt;string, string&gt; { { "/intelcpu/0/temperature/0/values", "H4sIAAAAAAAEAOy9B2AcSZYlJi9tynt/SvVK1+B0oQiAYBMk2JBAEOzBiM3mkuwdaUcjKasqgcplVmVdZhZAzO2dvPfee++999577733ujudTif33/8/XGZkAWz2zkrayZ4hgKrIHz9+fB8/Iu6//MH37x79i9/+NX6N3/TJm9/5f/01fw1+fosnv+A/+OlfS37/jZ/s/Lpv9fff6Ml/NTef/yZPnozc5679b+i193//TQZ+/w2Dd+P9/sZeX/67v/GTf/b3iP3u4/ObBL//73+i+f039+D8Zk/+xz/e/P6beu2TQZju8yH8f6OgzcvPv/U3/Rb8+z/0f/9b/+yfaOn8079X6fr6Cws7ln/iHzNwflPv99/wyS/+xY4+v/evcJ+733+jJ5//Cw7/4ndy9Im3+U2e/Fbnrk31C93vrt/fyPvdb+N//hsF7/4/AQAA//9NLZZ8WAIAAA==" }, { "/intelcpu/0/load/0/values", "H4sIAAAAAAAEAOy9B2AcSZYlJi9tynt/SvVK1+B0oQiAYBMk2JBAEOzBiM3mkuwdaUcjKasqgcplVmVdZhZAzO2dvPfee++999577733ujudTif33/8/XGZkAWz2zkrayZ4hgKrIHz9+fB8/Iu6//MH37x79i9++mpwcv/md/9df89egZ/xX/ym/5y/4D37618Lv7ya//u+58+u+5d9/z7/5t/w9/6u5fP5bH/6av+eTkXyefXxp26ONaf/v/dG/sf39D/rvnv4e5vc/0IP56/waK/vuHzf5I38P8/tv+mv8Rbb9f0pwTF9/zr/1X9vP/8I//+/6Pf7Z30N+/zdf/HX29zd/859q4aCNP5b//U+U3/+7f+zXOjZwfqvDX/V7/o9/vPz+a1G/pv0f+fGlhfk7eZ//N3/0v28//5X0u/n8Cxq7+f1X/tHft20A5x8a/W5/02+BP36Nf+j/nv8XfzrT+c2//Ob4p3+vktvUhNs/+xcWikP6e/4T/5jS5M8/sL8vP/5ff49f/Ivl9//sHzv6PX/vXyG//9R/94/9HuZ34P/5vyC//3W/5e/1exa/k+Bw4bUBnU2bP4Xg/1bn0uafeTH6PatfKL//N3/0t2y/gG9+/8+IzqYNxmU+/+jwX7afY67/nwAAAP//GYSA31gCAAA=" }, }); Computer myComputer = new Computer(settings) { MainboardEnabled = true, CPUEnabled = true, RAMEnabled = true, GPUEnabled = true, FanControllerEnabled = true, HDDEnabled = true }; myComputer.Open(); foreach (var hardwareItem in myComputer.Hardware) { hardwareItem.Update(); if (hardwareItem.SubHardware.Length &gt; 0) { foreach (IHardware subHardware in hardwareItem.SubHardware) { subHardware.Update(); foreach (var sensor in subHardware.Sensors) { Console.WriteLine(String.Format("{0} {1} = {2}", sensor.Name, sensor.Hardware, sensor.Value.HasValue ? sensor.Value.Value.ToString() : "no value")); } } } else { foreach (var sensor in hardwareItem.Sensors) { Console.WriteLine(String.Format("{0} {1} = {2}", sensor.Identifier, sensor.Hardware, sensor.Value.HasValue ? sensor.Value.Value.ToString() : "no value")); } } } } } } </code></pre> <p>I've been looking at the source code since it's the only way to get any info on it. It's been a slow process but I'd really appreciate any help.</p> <p>OpenHardwareMonitor Source Code: <a href="http://code.google.com/p/open-hardware-monitor/source/browse/" rel="nofollow">http://code.google.com/p/open-hardware-monitor/source/browse/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload