HASS.Agent icon indicating copy to clipboard operation
HASS.Agent copied to clipboard

Bug: GPU Sensors causing Agent to crash

Open nthulke opened this issue 3 years ago • 8 comments

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

nthulke avatar Jul 06 '22 07:07 nthulke

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!

LAB02-Admin avatar Jul 06 '22 08:07 LAB02-Admin

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 ?

mcarbonneaux avatar Dec 12 '22 22:12 mcarbonneaux

Nice find @mcarbonneaux, I'll look into it and let you know!

LAB02-Admin avatar Dec 16 '22 08:12 LAB02-Admin

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

mcarbonneaux avatar Feb 23 '23 23:02 mcarbonneaux

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. 👍

Samir-driod avatar May 18 '23 07:05 Samir-driod

i'confirm ! it's work for me.

mcarbonneaux avatar May 21 '23 18:05 mcarbonneaux

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#

mahoromax avatar Feb 07 '24 14:02 mahoromax

Unforunately still an issue, and simply copying the dll's from LibreHardwareMonitor into Hass.Agent install location didn't solve it.

rohanrichards avatar Apr 24 '24 22:04 rohanrichards