Files
matrix64/netdata.py
2025-12-31 11:48:55 +01:00

18 lines
507 B
Python

"""
Netdata API client for Matrix64 LED display.
"""
import requests
from config import NETDATA_URL
def get_hdd_temps():
"""Get HDD temperatures from Netdata."""
try:
url = f"{NETDATA_URL}/api/v2/data?contexts=hddtemp.disk_temperature&points=1&group_by=instance"
response = requests.get(url, timeout=10)
hdd_temps = response.json()['result']['data'][0]
return hdd_temps
except Exception as e:
print(f"Error fetching HDD temps: {e}")
return None