Refactor temperature reporting for detectors and implement Hailo temp reading (#21395)

* Add Hailo temperature retrieval

* Refactor `get_hailo_temps()` to use ctxmanager

* Show Hailo temps in system UI

* Move hailo_platform import to get_hailo_temps

* Refactor temperatures calculations to use within detector block

* Adjust webUI to handle new location

---------

Co-authored-by: tigattack <10629864+tigattack@users.noreply.github.com>
This commit is contained in:
Nicolas Mowen
2025-12-22 08:25:38 -07:00
committed by GitHub
co-authored by tigattack
parent f9e06bb7b7
commit b8bc98a423
4 changed files with 129 additions and 33 deletions
+12 -19
View File
@@ -127,13 +127,6 @@ export default function GeneralMetrics({
return undefined;
}
if (
statsHistory.length > 0 &&
Object.keys(statsHistory[0].service.temperatures).length == 0
) {
return undefined;
}
const series: {
[key: string]: { name: string; data: { x: number; y: number }[] };
} = {};
@@ -143,22 +136,22 @@ export default function GeneralMetrics({
return;
}
Object.entries(stats.detectors).forEach(([key], cIdx) => {
if (!key.includes("coral")) {
Object.entries(stats.detectors).forEach(([key, detectorStats]) => {
if (detectorStats.temperature === undefined) {
return;
}
if (cIdx <= Object.keys(stats.service.temperatures).length) {
if (!(key in series)) {
series[key] = {
name: key,
data: [],
};
}
const temp = Object.values(stats.service.temperatures)[cIdx];
series[key].data.push({ x: statsIdx + 1, y: Math.round(temp) });
if (!(key in series)) {
series[key] = {
name: key,
data: [],
};
}
series[key].data.push({
x: statsIdx + 1,
y: Math.round(detectorStats.temperature),
});
});
});