Im Downloadlink befindet sich die Pythondatei und die OpenHardwareLib.dll
Link zum Download:
"""
OpenHardwareMonitorLib(.dll) ... \n
1.) ... öffnen ... \n
2.) ... Hardwaredaten auslesen \n
3.) ... Daten parsen \n
4.) ... und Ausgeben ... \n
\n
Das "pythonnet" Module wird gebraucht, nicht das "clr": \n
pip install pythonnet \n
... oder ... \n
py -m pip install pythonnet \n
\n
OpenHardwareMonitorLib.dll findet Ihr hier: \n
Downloads
"""
import clr # package pythonnet, not clr
openhardwaremonitor_hwtypes = ['Mainboard', 'SuperIO', 'CPU', 'RAM', 'GpuNvidia', 'GpuAti', 'TBalancer', 'Heatmaster',
'HDD']
openhardwaremonitor_sensortypes = ['Voltage', 'Clock', 'Temperature', 'Load', 'Fan', 'Flow', 'Control', 'Level',
'Factor', 'Power', 'Data', 'SmallData']
def initialize_openhardwaremonitor():
file = "OpenHardwareMonitorLib"
clr.AddReference(file)
from OpenHardwareMonitor import Hardware
handle = Hardware.Computer()
handle.MainboardEnabled = True
handle.CPUEnabled = True
handle.RAMEnabled = True
handle.GPUEnabled = True
handle.HDDEnabled = True
handle.Open()
return handle
def fetch_stats(handle):
for i in handle.Hardware:
i.Update()
for sensor in i.Sensors:
parse_sensor(sensor)
for j in i.SubHardware:
j.Update()
for subsensor in j.Sensors:
parse_sensor(subsensor)
def parse_sensor(sensor):
hardwaretypes = openhardwaremonitor_hwtypes
if sensor.Value is not None:
# if str(sensor.SensorType) == "Temperature":
print(u"%s: '%s' Sensor: #%i %s - %s "
% (
hardwaretypes[sensor.Hardware.HardwareType],
sensor.Hardware.Name,
sensor.Index,
sensor.Name,
sensor.Value,
)
)
print("OpenHardwareMonitor: ", end='\n\n')
HardwareHandle = initialize_openhardwaremonitor()
fetch_stats(HardwareHandle)