mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
Add temperature of coral tpu to telemetry mqtt message
This commit is contained in:
parent
ecb3ab2b3e
commit
21c6056baf
@ -31,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 read_temperature(path):
|
def read_temperature(path):
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user