Hello everyone, I hope you are all well.
I’m here to share some scripts I created to send information from Open Hardware Monitor
to HASS.Agent
and enable PC data telemetry via MQTT. I hope it’s useful.
Example:
Requirements
- Open Hardware Monitor
- HASS.Agent
- Windows 11
- PowerShell
Scripts available
- CPU Temperature
- CPU Frequency
- CPU Usage
- Memory Usage
- GPU Temperature
- GPU Frequency
- GPU Usage
- GPU VRAM Usage
Open Hardware Monitor
- Download
Open Hardware Monitor
and unzip it. - 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
HASS.Agent
- Download
HASS.Agent
and install it. - 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.
Script usage
-
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!
Notes
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.