mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-04 13:47:37 +02:00
Add temperature of coral tpu to telemetry mqtt message
This commit is contained in:
parent
a2ddb12eb3
commit
8b2622a234
@ -4,6 +4,7 @@ import threading
|
|||||||
import time
|
import time
|
||||||
import psutil
|
import psutil
|
||||||
import shutil
|
import shutil
|
||||||
|
import os
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.const import RECORD_DIR, CLIPS_DIR, CACHE_DIR
|
from frigate.const import RECORD_DIR, CLIPS_DIR, CACHE_DIR
|
||||||
@ -30,6 +31,24 @@ def get_fs_type(path):
|
|||||||
bestMatch = part.mountpoint
|
bestMatch = part.mountpoint
|
||||||
return fsType
|
return fsType
|
||||||
|
|
||||||
|
def read_temperature(path):
|
||||||
|
if os.path.isfile(path):
|
||||||
|
with open(path) as f:
|
||||||
|
line=f.readline().strip()
|
||||||
|
return int(line)/1000
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_temperatures():
|
||||||
|
temps={}
|
||||||
|
|
||||||
|
# Get temperatures for all attached Corals
|
||||||
|
base="/sys/class/apex/"
|
||||||
|
for apex in os.listdir(base):
|
||||||
|
temp=read_temperature(os.path.join(base,apex,"temp"))
|
||||||
|
if temp is not None:
|
||||||
|
temps[apex]=temp
|
||||||
|
|
||||||
|
return temps
|
||||||
|
|
||||||
def stats_snapshot(stats_tracking):
|
def stats_snapshot(stats_tracking):
|
||||||
camera_metrics = stats_tracking["camera_metrics"]
|
camera_metrics = stats_tracking["camera_metrics"]
|
||||||
@ -61,6 +80,7 @@ def stats_snapshot(stats_tracking):
|
|||||||
"uptime": (int(time.time()) - stats_tracking["started"]),
|
"uptime": (int(time.time()) - stats_tracking["started"]),
|
||||||
"version": VERSION,
|
"version": VERSION,
|
||||||
"storage": {},
|
"storage": {},
|
||||||
|
"temperatures" : get_temperatures()
|
||||||
}
|
}
|
||||||
|
|
||||||
for path in [RECORD_DIR, CLIPS_DIR, CACHE_DIR, "/dev/shm"]:
|
for path in [RECORD_DIR, CLIPS_DIR, CACHE_DIR, "/dev/shm"]:
|
||||||
|
Loading…
Reference in New Issue
Block a user