Skip to content

Commit

Permalink
possible fix for cobia cputemp #102
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaae committed Apr 3, 2024
1 parent a6ec473 commit bbb16aa
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions custom_components/truenas/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,17 @@ def get_systemstats(self) -> None:
# CPU temperature
if tmp_graph[i]["name"] == "cputemp":
if "aggregations" in tmp_graph[i]:
self.ds["system_info"]["cpu_temperature"] = round(
max(list(filter(None, tmp_graph[i]["aggregations"]["mean"]))), 1
)
if self._is_scale and self._version_major >= 23:
self.ds["system_info"]["cpu_temperature"] = round(
max(tmp_graph[i]["aggregations"]["mean"].values()), 2
)
else:
self.ds["system_info"]["cpu_temperature"] = round(
max(
list(filter(None, tmp_graph[i]["aggregations"]["mean"]))
),
1,
)
else:
self.ds["system_info"]["cpu_temperature"] = 0.0

Expand Down

0 comments on commit bbb16aa

Please sign in to comment.