From 4d0456dcf06008d7cb8621cd4a054424f4f9e4c2 Mon Sep 17 00:00:00 2001 From: tigattack <10629864+tigattack@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:14:38 +0000 Subject: [PATCH 1/3] Add Hailo temperature retrieval --- frigate/stats/util.py | 4 ++++ frigate/util/services.py | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/frigate/stats/util.py b/frigate/stats/util.py index 17b45d1d4..287cd23ba 100644 --- a/frigate/stats/util.py +++ b/frigate/stats/util.py @@ -22,6 +22,7 @@ from frigate.util.services import ( get_bandwidth_stats, get_cpu_stats, get_fs_type, + get_hailo_temps, get_intel_gpu_stats, get_jetson_stats, get_nvidia_gpu_stats, @@ -91,6 +92,9 @@ def get_temperatures() -> dict[str, float]: if temp is not None: temps[apex] = temp + # Get temperatures for Hailo devices + temps.update(get_hailo_temps()) + return temps diff --git a/frigate/util/services.py b/frigate/util/services.py index c51fe923a..fcbef836d 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -18,6 +18,7 @@ import cv2 import psutil import py3nvml.py3nvml as nvml import requests +from hailo_platform import Device from frigate.const import ( DRIVER_AMD, @@ -549,6 +550,48 @@ def get_jetson_stats() -> Optional[dict[int, dict]]: return results +def get_hailo_temps() -> dict[str, float]: + """Get temperatures for Hailo devices.""" + temps = {} + + try: + device_ids = Device.scan() + for i, device_id in enumerate(device_ids): + try: + device = Device(device_id) + temp_info = device.control.get_chip_temperature() + + # Get board name and normalise it + try: + identity = device.control.identify() + # Extract board name from identity string (e.g., "Hailo-8" -> "hailo8") + board_name = None + for line in str(identity).split("\n"): + if line.startswith("Board Name:"): + board_name = ( + line.split(":", 1)[1].strip().lower().replace("-", "") + ) + break + + if not board_name: + board_name = f"hailo{i}" + except Exception: + board_name = f"hailo{i}" + + # Use indexed name if multiple devices, otherwise just the board name + device_name = f"{board_name}-{i}" if len(device_ids) > 1 else board_name + + # ts1_temperature is also available, but appeared to be the same as ts0 in testing. + temps[device_name] = round(temp_info.ts0_temperature, 1) + device.release() + except Exception: + continue + except Exception: + pass + + return temps + + def ffprobe_stream(ffmpeg, path: str, detailed: bool = False) -> sp.CompletedProcess: """Run ffprobe on stream.""" clean_path = escape_special_characters(path) From f85a1fe3e88a2e5139f985fa94e7ceaa49b92ff4 Mon Sep 17 00:00:00 2001 From: tigattack <10629864+tigattack@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:14:57 +0000 Subject: [PATCH 2/3] Refactor `get_hailo_temps()` to use ctxmanager --- frigate/util/services.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/frigate/util/services.py b/frigate/util/services.py index fcbef836d..67fc44c21 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -558,13 +558,11 @@ def get_hailo_temps() -> dict[str, float]: device_ids = Device.scan() for i, device_id in enumerate(device_ids): try: - device = Device(device_id) - temp_info = device.control.get_chip_temperature() + with Device(device_id) as device: + temp_info = device.control.get_chip_temperature() - # Get board name and normalise it - try: + # Get board name and normalise it identity = device.control.identify() - # Extract board name from identity string (e.g., "Hailo-8" -> "hailo8") board_name = None for line in str(identity).split("\n"): if line.startswith("Board Name:"): @@ -575,19 +573,21 @@ def get_hailo_temps() -> dict[str, float]: if not board_name: board_name = f"hailo{i}" - except Exception: - board_name = f"hailo{i}" - # Use indexed name if multiple devices, otherwise just the board name - device_name = f"{board_name}-{i}" if len(device_ids) > 1 else board_name + # Use indexed name if multiple devices, otherwise just the board name + device_name = ( + f"{board_name}-{i}" if len(device_ids) > 1 else board_name + ) - # ts1_temperature is also available, but appeared to be the same as ts0 in testing. - temps[device_name] = round(temp_info.ts0_temperature, 1) - device.release() - except Exception: + # ts1_temperature is also available, but appeared to be the same as ts0 in testing. + temps[device_name] = round(temp_info.ts0_temperature, 1) + except Exception as e: + logger.debug( + f"Failed to get temperature for Hailo device {device_id}: {e}" + ) continue - except Exception: - pass + except Exception as e: + logger.debug(f"Failed to scan for Hailo devices: {e}") return temps From 7d5317959dec00d6423db99192545d4518cf8753 Mon Sep 17 00:00:00 2001 From: tigattack <10629864+tigattack@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:16:28 +0000 Subject: [PATCH 3/3] Show Hailo temps in system UI --- web/src/views/system/GeneralMetrics.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/views/system/GeneralMetrics.tsx b/web/src/views/system/GeneralMetrics.tsx index a05b1b82a..073bf58df 100644 --- a/web/src/views/system/GeneralMetrics.tsx +++ b/web/src/views/system/GeneralMetrics.tsx @@ -144,7 +144,7 @@ export default function GeneralMetrics({ } Object.entries(stats.detectors).forEach(([key], cIdx) => { - if (!key.includes("coral")) { + if (!key.includes("coral") && !key.includes("hailo")) { return; }