PowerShell scripts to read sensors from Open Hardware Monitor
and return to HASS.Agent
.
- Open Hardware Monitor
- HASS.Agent
- Windows 11
- PowerShell
- CPU Temperature
- CPU Frequency
- CPU Load
- Memory Usage
- GPU Temperature
- GPU Frequency
- GPU Load
- GPU VRAM Usage
-
Download
Open Hardware Monitor
and unzip it: https://openhardwaremonitor.org/ -
Run
OpenHardwareMonitor.exe
as Administrator. -
If you want, configure it to startup with Windows. Click on
Options
menu and then:- Start minimized
- Minimize to Tray
- Run on Windows startup
-
Download
HASS.Agent
and install it: https://lab02-research.org/hassagent/ -
Follow the instructions to connect
HASS.Agent
to your Home Assistant and MQTT servers (required to send sensors data from PC to Home Assistant). -
(Optional) Configure the
Satellite Service
to allow theHASS.Agent
to work when the user is not logged on Windows. -
Add
Sensors
following theScript usage
instructions below.
-
Make sure that
Open Hardware Monitor
is running in background. -
Copy or create the
.ps1
script as you want.In the script content you need to:
- Import the
read-sensor.ps1
script: - Call the
Read-Sensor
function setting theSensorType
andName
respectively.
Don't forget to copy the read-sensor.ps1 to the same folder
- Import the
-
Test your script pasting the
path
to the.ps1
file on the PowerShell terminal, ex:C:\scripts\gpu-temperature.ps1
-
On
HASS.Agent
add a newLocal Sensor
-> selectPowerShellSensor
-> and paste the path to the.ps1
file (ex.C:\scripts\gpu-temperature.ps1
) in thepowershell command or script
field. -
Save and you are done! 🎉
Some SensorType
and Name
are not always the same in Open Hardware Monitor
GUI and on PowerShell script.
So, to find the correct sensors available in PowerShell, run the script list-sensors.ps1 on Terminal.
Example:
SensorType | Name | Value (example) |
---|---|---|
Clock | Bus Speed | 100,44 |
Clock | CPU Core #1 | 4017,42 |
Clock | CPU Core #2 | 4017,42 |
Clock | CPU Core #3 | 4017,42 |
Clock | CPU Core #4 | 4017,42 |
Clock | CPU Core #5 | 4017,42 |
Clock | CPU Core #6 | 4017,42 |
Clock | CPU Core #7 | 4017,42 |
Clock | CPU Core #8 | 4017,42 |
Clock | GPU Core | 1410,00 |
Clock | GPU Memory | 7200,98 |
Clock | GPU Shader | 0,00 |
Control | GPU Fan | 47,00 |
Data | Available Memory | 19,79 |
Data | Total Bytes Written | 2760,48 |
Data | Total Bytes Written | 1393,42 |
Data | Used Memory | 12,13 |
Factor | Write Amplification | 3,10 |
Factor | Write Amplification | 4,44 |
Fan | GPU | 1644,00 |
Level | Remaining Life | 99,00 |
Level | Remaining Life | 99,00 |
Load | CPU Core #1 | 7,03 |
Load | CPU Core #2 | 4,69 |
Load | CPU Core #3 | 7,81 |
Load | CPU Core #4 | 7,03 |
Load | CPU Core #5 | 6,25 |
Load | CPU Core #6 | 7,81 |
Load | CPU Core #7 | 0,00 |
Load | CPU Core #8 | 7,81 |
Load | CPU Total | 6,05 |
Load | GPU Bus Interface | 0,00 |
Load | GPU Core | 0,00 |
Load | GPU Frame Buffer | 0,00 |
Load | GPU Memory | 12,65 |
Load | GPU Video Engine | 0,00 |
Load | Memory | 38,00 |
Load | Used Space | 48,20 |
Load | Used Space | 37,87 |
Load | Used Space | 36,21 |
Power | CPU Core #1 | 7,10 |
Power | CPU Core #2 | 6,11 |
Power | CPU Core #3 | 6,76 |
Power | CPU Core #4 | 6,07 |
Power | CPU Core #5 | 5,85 |
Power | CPU Core #6 | 6,92 |
Power | CPU Core #7 | 4,23 |
Power | CPU Core #8 | 4,56 |
Power | CPU Cores | 47,60 |
Power | CPU Package | 59,39 |
Power | GPU Power | 43,00 |
SmallData | GPU Memory Free | 7155,68 |
SmallData | GPU Memory Total | 8192,00 |
SmallData | GPU Memory Used | 1036,32 |
Temperature | CPU Package | 57,12 |
Temperature | CPU Tctl | 67,12 |
Temperature | GPU Core | 42,00 |
Temperature | Temperature | 26,00 |
Temperature | Temperature | 27,00 |
Throughput | GPU PCIE Rx | 0,00 |
Throughput | GPU PCIE Tx | 0,00 |