Skip to content

Commit

Permalink
Added GPU sensors to output (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
neuralyze committed Oct 20, 2023
1 parent 9fab51c commit a01ad9d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions glances_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,14 @@ async def get_ha_sensor_data(self) -> dict[str, Any]:
sensor_data["raid"] = data
if data := self.data.get("uptime"):
sensor_data["uptime"] = data
if data := self.data.get("gpu"):
sensor_data["gpu"] = {}
for sensor in data:
sensor_data["gpu"][f"GPU_{sensor['gpu_id']}__{sensor['name']}"] = {
"name": sensor["name"],
"temperature": sensor["temperature"],
"mem": sensor["mem"],
"proc": sensor["proc"],
"fan_speed": sensor["fan_speed"] if "fan_speed" in sensor else 0,
}
return sensor_data

0 comments on commit a01ad9d

Please sign in to comment.