/** * Holt Temperaturwerte vom AD-Wandler aus der passenden JSON-Datei über die API * @param type - Typ der Daten: DIA0 = alle, DIA1 = stündlich, DIA2 = täglich */ export const fetchTemperaturAdWandlerService = async ( type: "DIA0" | "DIA1" | "DIA2" ) => { try { const isDev = process.env.NODE_ENV === "development"; const channel = 116; // 116 = Temperatur AD-Wandler laut Spezifikation const from = "2025;01;01"; const to = "2025;07;31"; const path = isDev ? `/api/cpl/getTemperaturAdWandlerHandler?typ=${type}` : `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`; const res = await fetch(path); if (!res.ok) throw new Error( "❌ Fehler beim Abrufen der Temperaturdaten (AD-Wandler)" ); return await res.json(); } catch (err) { console.error("❌ Fehler in fetchTemperaturAdWandlerService:", err); return null; } };