From 846abedae457ea3c89016e3070f77b8ef0e968c1 Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 20 Jun 2025 11:49:13 +0200 Subject: [PATCH] fix: digital inputs status LED --- .env.development | 2 +- .env.production | 2 +- components/main/einausgaenge/DigitalInputs.tsx | 1 + components/main/einausgaenge/modals/InputModal.tsx | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- redux/slices/digitalInputsSlice.ts | 2 +- services/fetchDigitalInputsService.ts | 7 +++++-- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.env.development b/.env.development index 2f1ccc8..671f22c 100644 --- a/.env.development +++ b/.env.development @@ -6,5 +6,5 @@ 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.428 +NEXT_PUBLIC_APP_VERSION=1.6.429 NEXT_PUBLIC_CPL_MODE=jsmock # json (Entwicklungsumgebung) oder jsmock (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) \ No newline at end of file diff --git a/.env.production b/.env.production index 7997bc9..257e808 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.428 +NEXT_PUBLIC_APP_VERSION=1.6.429 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/components/main/einausgaenge/DigitalInputs.tsx b/components/main/einausgaenge/DigitalInputs.tsx index a3eb763..65b2691 100644 --- a/components/main/einausgaenge/DigitalInputs.tsx +++ b/components/main/einausgaenge/DigitalInputs.tsx @@ -19,6 +19,7 @@ export default function DigitalInputs({ openInputModal, inputRange }: Props) { ); const inputs = digitalInputs.slice(inputRange.start, inputRange.end); + //console.log("DigitalInputs", inputs); return (
diff --git a/components/main/einausgaenge/modals/InputModal.tsx b/components/main/einausgaenge/modals/InputModal.tsx index 3551fdf..fbf997c 100644 --- a/components/main/einausgaenge/modals/InputModal.tsx +++ b/components/main/einausgaenge/modals/InputModal.tsx @@ -40,7 +40,7 @@ export default function InputModal({ useEffect(() => { if (reduxInput && isInitialLoad) { //reduxInput - console.log("📦 reduxInput geladen:", reduxInput); + //console.log("📦 reduxInput geladen:", reduxInput); setLabel(reduxInput.label || ""); setInvertiert(reduxInput.invert); setTimeFilter(reduxInput.timeFilter); @@ -55,7 +55,7 @@ export default function InputModal({ const sendCgiUpdate = async (param: string) => { const url = `/CPL?/eingaenge.html&${param}`; - console.log("📡 CGI senden:", url); + //console.log("📡 CGI senden:", url); const response = await fetch(url); if (!response.ok) { diff --git a/package-lock.json b/package-lock.json index 432c616..644959a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.428", + "version": "1.6.429", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.428", + "version": "1.6.429", "dependencies": { "@fontsource/roboto": "^5.1.0", "@iconify-icons/ri": "^1.2.10", diff --git a/package.json b/package.json index cc7f25f..c703a4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.428", + "version": "1.6.429", "private": true, "scripts": { "dev": "next dev", diff --git a/redux/slices/digitalInputsSlice.ts b/redux/slices/digitalInputsSlice.ts index ab1ea84..9a5e97e 100644 --- a/redux/slices/digitalInputsSlice.ts +++ b/redux/slices/digitalInputsSlice.ts @@ -4,7 +4,6 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; interface DigitalInput { id: number; label: string; - status: number; counter: number; flutter: number; invert: boolean; @@ -12,6 +11,7 @@ interface DigitalInput { weighting: number; zaehlerAktiv: boolean; eingangOffline: boolean; + status: boolean; } interface DigitalInputsState { diff --git a/services/fetchDigitalInputsService.ts b/services/fetchDigitalInputsService.ts index a461636..48512b4 100644 --- a/services/fetchDigitalInputsService.ts +++ b/services/fetchDigitalInputsService.ts @@ -29,6 +29,7 @@ export const fetchDigitalInputsService = async () => { weighting: win.win_de_weighting[i], counterActive: !!win.win_de_counter_active[i], eingangOffline: !!win.win_de_offline[i], + status: !!win.win_de_state[i], })); } @@ -39,7 +40,7 @@ export const fetchDigitalInputsService = async () => { throw new Error("❌ Fehler beim Laden der digitalen Eingänge (json)"); const data = await res.json(); - + console.log("📡 JSON-Daten geladen in service:", data); return data.win_de_state.map((_: any, i: number) => ({ id: i + 1, value: data.win_de_state[i], @@ -50,6 +51,7 @@ export const fetchDigitalInputsService = async () => { weighting: data.win_de_weighting[i], counterActive: !!data.win_de_counter_active[i], eingangOffline: !!data.win_de_offline[i], + status: !!data.win_de_state[i], })); } @@ -60,7 +62,7 @@ export const fetchDigitalInputsService = async () => { throw new Error("❌ Fehler beim Laden der digitalen Eingänge (json)"); const data = await res.json(); - //console.log("📡 JSMOCK-Daten geladen in service:", data); + console.log("📡 JSMOCK-Daten geladen in service:", data); return data.win_de_state.map((_: any, i: number) => ({ id: i + 1, @@ -72,6 +74,7 @@ export const fetchDigitalInputsService = async () => { weighting: data.win_de_weighting[i], counterActive: !!data.win_de_counter_active[i], eingangOffline: !!data.win_de_offline[i], + status: !!data.win_de_state[i], })); }