Bug: GPU Sensors causing Agent to crash
If I have GpuLoad or GpuTemperature activated as sensors the Agent crashes.
Checked the agent logs which are here: [2022-07-06] HASS.Agent_20220706.log
The GPU is a AMD 6800 XT - Driver version 22.4.1
#edit - Checked the MQTT logs and it never recived GPU info
Hey @nthulke, yep that happen sometimes, that's because of the library I use (LibreHardwareMonitor). Unfortunately there's not much I can do about it, and haven't yet received a response from the devs.
What you can do, is just run the LibreHardwareMonitor tool, have it start on boot, and then create the sensors through WMI. You can find examples here in the docs.
Hopefully that fixes it for you, if not, feel free to reopen this ticket!
i a crash when i try to get gpu load sensor.... i have a GPU AMD Vega 64 (with ryzen 5 2600)... but when i try to test with your test bed: https://github.com/LAB02-Admin/LibreHardwareMonitorTester it's not crash...
it's possible to have more trace on the hass agent ?
Nice find @mcarbonneaux, I'll look into it and let you know!
you've tryed the performance counter ?
- https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.performancecounter?view=dotnet-plat-ext-7.0
- https://stackoverflow.com/questions/56830434/c-sharp-get-total-usage-of-gpu-in-percentage
- https://social.msdn.microsoft.com/Forums/azure/en-US/daadf673-d691-43ad-9284-bf3bbcaf4ae6/showing-gpu-usage-with-performance-counter?forum=vsdebug
I had the same issues with GPU sensor. I went to LibreHardwareMonitor github (https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/releases) and downloaded the zip file and extracted. Copy all extracted DLL files to Hass.Agent and it works.
I hope this will help you. 👍
i'confirm ! it's work for me.
I came here to report the service crashing when trying to add a gpu sensor. Looks like this is already known.
But following the comments, the fix should be as easy as updating the packaged version of LibreHardwareMonitor with the next update of Hass.Agent? Should be an easy fix then?
I would've added a PR, but I really don't understand how/where the LIbrary is implemented... 0 experience with C#
Unforunately still an issue, and simply copying the dll's from LibreHardwareMonitor into Hass.Agent install location didn't solve it.