Integrating HASS.Agent with Open Hardware Monitor

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.

Project: GitHub - douglasjunior/ohm-to-hass-agent: Here you will found my Power Shell scripts to read sensors from Open Hardware Monitor with HASS.Agent.

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

  1. Download Open Hardware Monitor and unzip it.
  2. Run OpenHardwareMonitor.exe as Administrator.
  3. 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

  1. Download HASS.Agent and install it.
  2. Follow the instructions to connect HASS.Agent to your Home Assistant and MQTT servers (required to send sensors data from PC to Home Assistant).
  3. (Optional) Configure the Satellite Service to allow the HASS.Agent to work when the user is not logged on Windows.
  4. Add Sensors following the Script usage instructions below.

Script usage

  1. Make sure that Open Hardware Monitor is running in background.

  2. 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 the SensorType and Name respectively.

    Don’t forget to copy the read-sensor.ps1 to the same folder

  3. Test your script pasting the path to the .ps1 file on the PowerShell terminal, ex:

    C:\scripts\gpu-temperature.ps1
    
  4. On HASS.Agent add a new Local Sensor → select PowerShellSensor → and paste the path to the .ps1 file (ex. C:\scripts\gpu-temperature.ps1) in the powershell command or script field.

  5. Save and you are done! :tada:

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.

1 Like