diff --git a/.env.development b/.env.development index 675b302..feeb491 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_USE_CGI=false # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.674 +NEXT_PUBLIC_APP_VERSION=1.6.675 NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) diff --git a/.env.production b/.env.production index 77e03ea..36b0e95 100644 --- a/.env.production +++ b/.env.production @@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_USE_CGI=true # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.674 +NEXT_PUBLIC_APP_VERSION=1.6.675 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e1caa72..d76cee8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [1.6.675] – 2025-08-01 + +- feat: fetchSystemData.mjs erweitert und optimiert + +Analoge Eingänge und Systemdaten werden jetzt gemeinsam abgerufen und gespeichert +Einheitliche Benennung (input statt eingang) für analoge Eingänge +Datumssplittung als Hilfsfunktion ausgelagert +Kommentare und Beschreibung verbessert + +--- ## [1.6.674] – 2025-08-01 - refactor: mMeldungen angepasst diff --git a/mocks/scripts/fetchSystemspannung15VplusData.mjs b/mocks/scripts/fetchSystemspannung15VplusData.mjs new file mode 100644 index 0000000..e69de29 diff --git a/package-lock.json b/package-lock.json index 0338bd4..dbf6c8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.674", + "version": "1.6.675", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.674", + "version": "1.6.675", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index f300c1a..714496a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.674", + "version": "1.6.675", "private": true, "scripts": { "dev": "next dev", diff --git a/services/fetchSystemspannung15VminusService.ts b/services/fetchSystemspannung15VminusService.ts index c1c77a0..f6d6cbf 100644 --- a/services/fetchSystemspannung15VminusService.ts +++ b/services/fetchSystemspannung15VminusService.ts @@ -9,12 +9,22 @@ export const fetchSystemspannung15VminusService = async ( const isDev = process.env.NODE_ENV === "development"; const channel = 114; // 114 = -15V laut Spezifikation - const from = "2025;01;01"; - const to = "2025;07;31"; + // Dynamisch: to = heute, from = 30 Tage zurück + const getDateParts = (date: Date) => { + const y = date.getFullYear(); + const m = String(date.getMonth() + 1).padStart(2, "0"); + const d = String(date.getDate()).padStart(2, "0"); + return { y, m, d }; + }; + const today = new Date(); + const toParts = getDateParts(today); + const fromDateObj = new Date(today); + fromDateObj.setDate(today.getDate() - 30); + const fromParts = getDateParts(fromDateObj); const path = isDev ? `/api/cpl/getSystemspannung15VminusHandler?typ=${type}` - : `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`; + : `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`; const res = await fetch(path); if (!res.ok) throw new Error("❌ Fehler beim Abrufen der -15V-Daten"); diff --git a/services/fetchSystemspannung15VplusService.ts b/services/fetchSystemspannung15VplusService.ts index d7e74d4..6fa0f50 100644 --- a/services/fetchSystemspannung15VplusService.ts +++ b/services/fetchSystemspannung15VplusService.ts @@ -9,12 +9,23 @@ export const fetchSystemspannung15VplusService = async ( const isDev = process.env.NODE_ENV === "development"; const channel = 108; // 108 = +15V laut Spezifikation - const from = "2025;01;01"; - const to = "2025;07;31"; + // Dynamisch: to = heute, from = 30 Tage zurück + // Hilfsfunktion für Datumsteile + const getDateParts = (date: Date) => { + const y = date.getFullYear(); + const m = String(date.getMonth() + 1).padStart(2, "0"); + const d = String(date.getDate()).padStart(2, "0"); + return { y, m, d }; + }; + const today = new Date(); + const toParts = getDateParts(today); + const fromDateObj = new Date(today); + fromDateObj.setDate(today.getDate() - 30); + const fromParts = getDateParts(fromDateObj); const path = isDev ? `/api/cpl/getSystemspannung15VplusHandler?typ=${type}` - : `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`; + : `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`; const res = await fetch(path); if (!res.ok) throw new Error("❌ Fehler beim Abrufen der +15V-Daten"); diff --git a/services/fetchSystemspannung5VplusService.ts b/services/fetchSystemspannung5VplusService.ts index 95bd2ac..ffc7c1a 100644 --- a/services/fetchSystemspannung5VplusService.ts +++ b/services/fetchSystemspannung5VplusService.ts @@ -11,12 +11,22 @@ export const fetchSystemspannung5VplusService = async ( const isDev = process.env.NODE_ENV === "development"; const channel = 110; // 110 = +5V - const from = "2025;01;01"; - const to = "2025;07;31"; + // Dynamisch: to = heute, from = 30 Tage zurück + const getDateParts = (date: Date) => { + const y = date.getFullYear(); + const m = String(date.getMonth() + 1).padStart(2, "0"); + const d = String(date.getDate()).padStart(2, "0"); + return { y, m, d }; + }; + const today = new Date(); + const toParts = getDateParts(today); + const fromDateObj = new Date(today); + fromDateObj.setDate(today.getDate() - 30); + const fromParts = getDateParts(fromDateObj); const path = isDev ? `/api/cpl/getSystemspannung5VplusHandler?typ=${type}` - : `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`; + : `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`; const res = await fetch(path); if (!res.ok) throw new Error("❌ Fehler beim Abrufen der +5V-Daten"); diff --git a/services/fetchSystemspannung98VminusService.ts b/services/fetchSystemspannung98VminusService.ts index 2969d75..cebb830 100644 --- a/services/fetchSystemspannung98VminusService.ts +++ b/services/fetchSystemspannung98VminusService.ts @@ -9,12 +9,22 @@ export const fetchSystemspannung98VminusService = async ( const isDev = process.env.NODE_ENV === "development"; const channel = 115; // 115 = -98V laut Spezifikation - const from = "2025;01;01"; - const to = "2025;07;31"; + // Dynamisch: to = heute, from = 30 Tage zurück + const getDateParts = (date: Date) => { + const y = date.getFullYear(); + const m = String(date.getMonth() + 1).padStart(2, "0"); + const d = String(date.getDate()).padStart(2, "0"); + return { y, m, d }; + }; + const today = new Date(); + const toParts = getDateParts(today); + const fromDateObj = new Date(today); + fromDateObj.setDate(today.getDate() - 30); + const fromParts = getDateParts(fromDateObj); const path = isDev ? `/api/cpl/getSystemspannung98VminusHandler?typ=${type}` - : `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`; + : `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`; const res = await fetch(path); if (!res.ok) throw new Error("❌ Fehler beim Abrufen der -98V-Daten"); diff --git a/services/fetchTemperaturAdWandlerService.ts b/services/fetchTemperaturAdWandlerService.ts index 99f2be1..699fa9f 100644 --- a/services/fetchTemperaturAdWandlerService.ts +++ b/services/fetchTemperaturAdWandlerService.ts @@ -9,12 +9,22 @@ export const fetchTemperaturAdWandlerService = async ( 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"; + // Dynamisch: to = heute, from = 30 Tage zurück + const getDateParts = (date: Date) => { + const y = date.getFullYear(); + const m = String(date.getMonth() + 1).padStart(2, "0"); + const d = String(date.getDate()).padStart(2, "0"); + return { y, m, d }; + }; + const today = new Date(); + const toParts = getDateParts(today); + const fromDateObj = new Date(today); + fromDateObj.setDate(today.getDate() - 30); + const fromParts = getDateParts(fromDateObj); const path = isDev ? `/api/cpl/getTemperaturAdWandlerHandler?typ=${type}` - : `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`; + : `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`; const res = await fetch(path); if (!res.ok) diff --git a/services/fetchTemperaturProzessorService.ts b/services/fetchTemperaturProzessorService.ts index acd99e6..85affff 100644 --- a/services/fetchTemperaturProzessorService.ts +++ b/services/fetchTemperaturProzessorService.ts @@ -9,12 +9,22 @@ export const fetchTemperaturProzessorService = async ( const isDev = process.env.NODE_ENV === "development"; const channel = 117; // 117 = Temperatur Prozessor laut Spezifikation - const from = "2025;01;01"; - const to = "2025;07;31"; + // Dynamisch: to = heute, from = 30 Tage zurück + const getDateParts = (date: Date) => { + const y = date.getFullYear(); + const m = String(date.getMonth() + 1).padStart(2, "0"); + const d = String(date.getDate()).padStart(2, "0"); + return { y, m, d }; + }; + const today = new Date(); + const toParts = getDateParts(today); + const fromDateObj = new Date(today); + fromDateObj.setDate(today.getDate() - 30); + const fromParts = getDateParts(fromDateObj); const path = isDev ? `/api/cpl/getTemperaturProzessorHandler?typ=${type}` - : `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`; + : `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`; const res = await fetch(path); if (!res.ok)