Authentificate to API
Build, push image, and notify Watchtower / build-image (push) Successful in 40s
Build, push image, and notify Watchtower / notify (push) Successful in 8s

This commit is contained in:
2026-08-18 18:40:32 +02:00
parent f9309c4dbc
commit d0066a9d6d
2 changed files with 14 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
zeJlYcaW0dji4A88Q3OGfvqgqXUuUAm0
+13 -1
View File
@@ -72,7 +72,17 @@ def get_device_id():
pass
return "RPI_Orchestrateur_Default"
def get_api_key():
for path in ["api_key.txt", "/home/pi/SmartWave/orchestrateur/api_key.txt"]:
try:
with open(path, "r") as f:
return f.read().strip()
except Exception:
pass
return ""
DEVICE_ID = get_device_id()
API_KEY = get_api_key()
# --- DISPLAY QUEUE & NOTIFICATION HELPERS ---
display_update_queue = None
@@ -310,6 +320,7 @@ def on_new_alert(alert: Alert):
response = requests.post(
"https://smartwave.matthiasg.dev/alert",
headers={"Content-Type": "application/json", "X-API-Key": API_KEY},
json=payload,
)
@@ -447,6 +458,7 @@ async def request_cloud_cooking_plan(microwave_id, sensors_data):
requests.post,
URL,
json=sensors_data,
headers={"Content-Type": "application/json", "X-API-Key": API_KEY},
timeout=HTTP_TIMEOUT
)
@@ -666,7 +678,7 @@ async def handle_telemetry_request(endpoint: str, do_timeout=True):
requests.post,
endpoint,
data=telemetry_payload, # <-- Changed from json=telemetry_payload
headers={"Content-Type": "application/json"},
headers={"Content-Type": "application/json", "X-API-Key": API_KEY},
timeout=15
)