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.
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 the HASS.Agent to work when the user is not logged on Windows.
Add Sensors following the Script 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 the SensorType and Name respectively.
Don’t forget to copy the read-sensor.ps1 to the same folder
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 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.
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.
Hey, Douglas!
I tried your project, but entering “C:\scripts\gpu-temperature.ps1” in powershell i get an error:
PS D:\OpenHardwareMonitor\scripts> cpu-load.ps1
cpu-load.ps1 : The term ‘cpu-load.ps1’ is not recognized as the name of a cmdlet, function, script file, or operable pr
ogram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
Suggestion [3,General]: The command cpu-load.ps1 was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: “.\cpu-load.ps1”. See “get-help about_Command_Precedence” for more details.
PS D:\OpenHardwareMonitor\scripts> .\cpu-load.ps1
I did execute “Set-ExecutionPolicy Unrestricted” , after that running script with “.\gpu-temperature.ps1” as suggested works in powershell, but i have to answer with “R” each time (twice!), but thing doesn’t run in Hass.Agent.
I bet it has something to do with some other permissions… any suggestions?
EDIT: to all those who’ll have the same problem: you must enter this in powershell:
Set-ExecutionPolicy Bypass -Force
** only then things work without confirmation. But note that enabling this can be a security risk!!! (this allows all scripts to be executed without you knowing it!)**
Thanks for reply! As i wrote above i figured it out - after some digging and searching i found out that these scripts are restricted by default, so they can’t be easily executed until i specifically tell windows that i allow them. After executing above shell command all works like a charm! Thanks for scripts and instructions!
Jesus… 121 entities
Thanks for this info, it works, i’ll test it and see which one is more convenient to me.
One thing i need hass.agent anyway is for it’s media player - i use it for all my announcements on my main wall screen (which runs on windows). And since all parametes i want aren’t available in hass.agent directly i used scripts.
sets the PowerShell execution policy to Unrestricted for the CurrentUser scope. Unrestricted - All scripts run, but warns about downloaded scripts. You could also set it to Bypass then the step below won’t be necessary.
Bypass Zone.Identifier that Windows adds to files downloaded from the internet. The command below unblocks all files in the folder. You could also unblock file by file:
Unfortunately Windows will block open hardware monitor. It’s an issue with winring. This has already been an issue with HASS Agent itself where it was fixed with the current beta version. Any idea how to resolve this?
Just add a new sensor in the Sensors Configuration in HASS.Agent and paste in the path of the script. No Windows issues like with OpenHardwareMonitor you’ll always have the latest software with Nvidia.
I guess there should be a cli command for AMD cards and other brands. Google/ChatGpt should help you with this.