feat(service): CPL-Request verwendet DIA0, DIA1 oder DIA2 je nach Zeitraum für analoge Eingänge
This commit is contained in:
@@ -35,12 +35,16 @@ export async function fetchAnalogInputsHistory(
|
||||
}
|
||||
const [vonJahr, vonMonat, vonTag] = vonDatum.split("-");
|
||||
const [bisJahr, bisMonat, bisTag] = bisDatum.split("-");
|
||||
// CPL-Eingang: 1-8, Zeitraum: 1=Stündlich, 2=Täglich, 0=Alle Messwerte
|
||||
let cplZeitraum = 1;
|
||||
if (zeitraum === "DIA2") cplZeitraum = 2;
|
||||
if (zeitraum === "DIA0") cplZeitraum = 0;
|
||||
// Beispiel: /CPL?seite.ACP&DIA1=2025;01;01;2025;07;31;2;4
|
||||
const url = `${window.location.origin}/CPL?seite.ACP&DIA1=${vonJahr};${vonMonat};${vonTag};${bisJahr};${bisMonat};${bisTag};${eingang};${cplZeitraum}`;
|
||||
// CPL-Eingang: 100-107 für AE-Eingänge
|
||||
// AE-Eingang: 100 + (eingang - 1)
|
||||
const aeEingang = 100 + (eingang - 1);
|
||||
// Zeitraum-Parameter: DIA0, DIA1, DIA2
|
||||
let diaType = "DIA1";
|
||||
if (zeitraum === "DIA0") diaType = "DIA0";
|
||||
if (zeitraum === "DIA2") diaType = "DIA2";
|
||||
// Beispiel: /CPL?seite.ACP&DIA1=2025;06;21;2025;07;21;100;1
|
||||
const url = `${window.location.origin}/CPL?seite.ACP&${diaType}=${vonJahr};${vonMonat};${vonTag};${bisJahr};${bisMonat};${bisTag};${aeEingang};1`;
|
||||
console.log("CPL URL:", url); // Debug-Ausgabe
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) {
|
||||
throw new Error("Fehler bei CPL-Server: " + res.status);
|
||||
|
||||
@@ -8,7 +8,7 @@ export const fetchAnalogInputsService = async () => {
|
||||
|
||||
// ✅ PRODUKTIV: lädt JSON-Datei vom Gerät über CGI
|
||||
if (mode === "production") {
|
||||
console.log("🔄 Lade analoge Eingänge im Produktionsmodus (JSON über CGI)");
|
||||
//console.log("🔄 Lade analoge Eingänge im Produktionsmodus (JSON über CGI)");
|
||||
|
||||
const res = await fetch("/CPL?/CPL/SERVICE/analogInputs.json", {
|
||||
headers: { Accept: "application/json" },
|
||||
|
||||
Reference in New Issue
Block a user