AMG GPU Sensors (like System Monitor for AMD GPU's)

I wanted to share a custom component I have created to track the stats of AMD GPU’s.

Background

Who are you?
Hi, I’m DeadEnd :slight_smile: . I’ve been using Home Assistant for a few years now. I have been contributing back to the HA community in whatever ways I can (usually through helping others troubleshoot issues). This is my first (what I consider big) contribution to Home Assistant. I am not a developer or programmer, so this was also a fantastic learning experience for me!

What is this thing?
Simply put, this custom component creates a selection of sensors for the GPU similar to what the System Monitor does for the CPU/RAM/HDD.

Why track GPU on a server?
When I first decided to build a home server it was originally to be an NVR. Shortly after that I stumbled upon Home Assistant, and as many of you can related… became part of this community.

Well, I still am using the same server (with a Ryzen CPU that has integrated AMD graphics) and have found there is nothing available to monitor the GPU in Home Assistant. I am using Frigate as my NVR and it is capable of utilizing the GPU cores - so I’d like to track this just like the Home Assistant System Monitor does for other PC components.

How does this work?
This component uses the pyamdgpuinfo python package to pull GPU information. My first draft used YAML configuration and you can use the v0.1 tag for YAML configuration if you prefer to use that. The main branch has been converted over to use config-flow - so you should be able to add the component as a custom HACS repository. I will look to get it into HACS as a standard repo in the future. Once added, after a restart it should be in the list of Integrations to be added.

Soooo… for the 3 other people out there who have an AMD GPU in their server :smiley: and want to track temperature, load, memory, etc. I share with you, HA-pyamdgpuinfo.

As stated earlier - this is my first python project - I’m pretty proud of it, but also am aware that I am a novice :slight_smile: . I will do my best to fix bugs that are found and make improvements!

I hope some other people out there find this useful!

Thanks, and Cheers!
DeadEnd

2 Likes

Can this monitor an AMD GPU in another computer on the network? I use an RX570 for folding@home and would be interested in seeing some usage stats at the hardware level (I know there is already a f@h component)

Btw, great job making a custom component!!

1 Like

Thanks!
Currently it only looks at local devices - and grabs the first one… if you had multiple GPU’s installed you wouldn’t be able to select a second one - I thought about this, but decided that is it very unlikely people would have more than one GPU on a home server.

So - the ability to select a GPU is not present - tracking a GPU from another computer would be even more complicated… your best option would be to install HA on the box running folding@home and track it there… if you want the stats on another computer there are ways to send data from one HA instance to another - so you could try that as well.

I hope this helps!
DeadEnd

One other option would be to install pyamdgpuinfo and an mqtt client on the F@H box and push the stats to MQTT - then you could create MQTT sensors on your HA box to display those values. This could be installed on the base os or in a container next to F@H… Pushing the data this way wouldn’t be too complicated as you would just pipe the pyamdgpuinfo output to the mqtt client and have it poll every x seconds…

2 Likes

Thanks for the detailed response. Let me think about it some more