feat: Script zum Abrufen und Speichern von CPL-Meldungen als Mockdaten hinzugefügt

This commit is contained in:
ISA
2025-08-01 08:27:45 +02:00
parent c1ed09a21d
commit 423c87ca11
33 changed files with 100402 additions and 96861 deletions

View File

@@ -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.671
NEXT_PUBLIC_APP_VERSION=1.6.672
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)

View File

@@ -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.671
NEXT_PUBLIC_APP_VERSION=1.6.672
NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,12 @@
## [1.6.672] 2025-08-01
- style: apply littwin-blue color to NTP settings checkbox
- Add accent-littwin-blue class to NTP active checkbox
- Increase checkbox size to w-4 h-4 for better visibility
- Maintain consistent brand coloring across UI components
---
## [1.6.671] 2025-07-31
- feat: hide logout button when admin is not logged in

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,75 @@
[
{
"t": "2025-08-01 00:00:00",
"i": 125.698,
"a": 128.011,
"g": 127.018
},
{
"t": "2025-07-31 00:00:00",
"i": 125.901,
"a": 128.445,
"g": 126.909
},
{
"t": "2025-07-30 00:00:00",
"i": 125.703,
"a": 128.398,
"g": 126.894
},
{
"t": "2025-07-29 00:00:00",
"i": 125.881,
"a": 128.436,
"g": 126.981
},
{
"t": "2025-07-28 00:00:00",
"i": 125.748,
"a": 128.195,
"g": 126.962
},
{
"t": "2025-07-27 00:00:00",
"i": 125.917,
"a": 128.488,
"g": 126.893
},
{
"t": "2025-07-26 00:00:00",
"i": 126.039,
"a": 128.153,
"g": 126.992
},
{
"t": "2025-07-25 00:00:00",
"i": 125.845,
"a": 128.654,
"g": 127.027
},
{
"t": "2025-07-24 00:00:00",
"i": 125.501,
"a": 128.296,
"g": 126.988
},
{
"t": "2025-07-23 00:00:00",
"i": 0,
"a": 128.286,
"g": 126.931
},
{
"t": "2025-07-22 00:00:00",
"i": 0,
"a": 127.906,
"g": 126.936
},
{
"t": "2025-07-21 00:00:00",
"i": 125.883,
"a": 127.904,
"g": 126.903
"i": 125.723,
"a": 127.953,
"g": 126.904
},
{
"t": "2025-07-20 00:00:00",
@@ -118,71 +184,5 @@
"i": 125.551,
"a": 128.123,
"g": 126.811
},
{
"t": "2025-07-01 00:00:00",
"i": 125.604,
"a": 127.805,
"g": 126.685
},
{
"t": "2025-06-30 00:00:00",
"i": 0,
"a": 127.89,
"g": 126.688
},
{
"t": "2025-06-29 00:00:00",
"i": 125.667,
"a": 127.784,
"g": 126.804
},
{
"t": "2025-06-28 00:00:00",
"i": 125.734,
"a": 127.929,
"g": 126.773
},
{
"t": "2025-06-27 00:00:00",
"i": 125.516,
"a": 127.84,
"g": 126.802
},
{
"t": "2025-06-26 00:00:00",
"i": 125.761,
"a": 128.103,
"g": 126.875
},
{
"t": "2025-06-25 00:00:00",
"i": 125.905,
"a": 128.058,
"g": 126.856
},
{
"t": "2025-06-24 00:00:00",
"i": 125.707,
"a": 127.876,
"g": 126.814
},
{
"t": "2025-06-23 00:00:00",
"i": 125.532,
"a": 127.944,
"g": 126.776
},
{
"t": "2025-06-22 00:00:00",
"i": 125.447,
"a": 127.969,
"g": 126.806
},
{
"t": "2025-06-21 00:00:00",
"i": 125.592,
"a": 127.869,
"g": 126.773
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,76 @@
[
{
"t": "2025-07-21 00:00:00",
"i": 5.624,
"a": 5.734,
"t": "2025-08-01 00:00:00",
"i": 0,
"a": 5.741,
"g": 5.686
},
{
"t": "2025-07-31 00:00:00",
"i": 5.631,
"a": 5.75,
"g": 5.686
},
{
"t": "2025-07-30 00:00:00",
"i": 5.631,
"a": 5.745,
"g": 5.686
},
{
"t": "2025-07-29 00:00:00",
"i": 5.616,
"a": 5.761,
"g": 5.685
},
{
"t": "2025-07-28 00:00:00",
"i": 5.62,
"a": 5.754,
"g": 5.688
},
{
"t": "2025-07-27 00:00:00",
"i": 5.623,
"a": 5.75,
"g": 5.689
},
{
"t": "2025-07-26 00:00:00",
"i": 5.604,
"a": 5.75,
"g": 5.687
},
{
"t": "2025-07-25 00:00:00",
"i": 5.622,
"a": 5.759,
"g": 5.689
},
{
"t": "2025-07-24 00:00:00",
"i": 5.605,
"a": 5.741,
"g": 5.687
},
{
"t": "2025-07-23 00:00:00",
"i": 0,
"a": 5.755,
"g": 5.684
},
{
"t": "2025-07-22 00:00:00",
"i": 0,
"a": 5.752,
"g": 5.682
},
{
"t": "2025-07-21 00:00:00",
"i": 5.617,
"a": 5.745,
"g": 5.684
},
{
"t": "2025-07-20 00:00:00",
"i": 5.637,
@@ -118,71 +184,5 @@
"i": 5.64,
"a": 5.737,
"g": 5.682
},
{
"t": "2025-07-01 00:00:00",
"i": 5.634,
"a": 5.738,
"g": 5.679
},
{
"t": "2025-06-30 00:00:00",
"i": 0,
"a": 5.736,
"g": 5.677
},
{
"t": "2025-06-29 00:00:00",
"i": 5.631,
"a": 5.738,
"g": 5.679
},
{
"t": "2025-06-28 00:00:00",
"i": 5.627,
"a": 5.74,
"g": 5.68
},
{
"t": "2025-06-27 00:00:00",
"i": 5.625,
"a": 5.739,
"g": 5.682
},
{
"t": "2025-06-26 00:00:00",
"i": 5.621,
"a": 5.745,
"g": 5.683
},
{
"t": "2025-06-25 00:00:00",
"i": 5.627,
"a": 5.735,
"g": 5.682
},
{
"t": "2025-06-24 00:00:00",
"i": 5.622,
"a": 5.732,
"g": 5.681
},
{
"t": "2025-06-23 00:00:00",
"i": 5.603,
"a": 5.732,
"g": 5.679
},
{
"t": "2025-06-22 00:00:00",
"i": 5.633,
"a": 5.74,
"g": 5.68
},
{
"t": "2025-06-21 00:00:00",
"i": 5.641,
"a": 5.74,
"g": 5.678
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,76 @@
[
{
"t": "2025-07-21 00:00:00",
"t": "2025-08-01 00:00:00",
"i": -0.029,
"a": 0.037,
"g": 0.009
},
{
"t": "2025-07-31 00:00:00",
"i": -0.036,
"a": 0.052,
"a": 0.046,
"g": 0.004
},
{
"t": "2025-07-30 00:00:00",
"i": -0.032,
"a": 0.05,
"g": 0.005
},
{
"t": "2025-07-29 00:00:00",
"i": -0.031,
"a": 0.047,
"g": 0.006
},
{
"t": "2025-07-28 00:00:00",
"i": -0.034,
"a": 0.043,
"g": 0.005
},
{
"t": "2025-07-27 00:00:00",
"i": -0.036,
"a": 0.042,
"g": 0.006
},
{
"t": "2025-07-26 00:00:00",
"i": -0.036,
"a": 0.047,
"g": 0.006
},
{
"t": "2025-07-25 00:00:00",
"i": -0.034,
"a": 0.047,
"g": 0.004
},
{
"t": "2025-07-24 00:00:00",
"i": -0.042,
"a": 0.044,
"g": 0.004
},
{
"t": "2025-07-23 00:00:00",
"i": -0.039,
"a": 0.042,
"g": 0.006
},
{
"t": "2025-07-22 00:00:00",
"i": -0.033,
"a": 0.046,
"g": 0.002
},
{
"t": "2025-07-21 00:00:00",
"i": -0.038,
"a": 0.052,
"g": 0.007
},
{
"t": "2025-07-20 00:00:00",
"i": -0.031,
@@ -118,71 +184,5 @@
"i": -0.03,
"a": 0.041,
"g": 0.007
},
{
"t": "2025-07-01 00:00:00",
"i": -0.032,
"a": 0.041,
"g": 0.004
},
{
"t": "2025-06-30 00:00:00",
"i": -0.032,
"a": 0.038,
"g": 0.004
},
{
"t": "2025-06-29 00:00:00",
"i": -0.031,
"a": 0.039,
"g": 0.003
},
{
"t": "2025-06-28 00:00:00",
"i": -0.03,
"a": 0.038,
"g": 0.004
},
{
"t": "2025-06-27 00:00:00",
"i": -0.033,
"a": 0.039,
"g": 0.003
},
{
"t": "2025-06-26 00:00:00",
"i": -0.03,
"a": 0.037,
"g": 0.003
},
{
"t": "2025-06-25 00:00:00",
"i": -0.03,
"a": 0.04,
"g": 0.004
},
{
"t": "2025-06-24 00:00:00",
"i": -0.028,
"a": 0.034,
"g": 0.003
},
{
"t": "2025-06-23 00:00:00",
"i": -0.031,
"a": 0.039,
"g": 0.003
},
{
"t": "2025-06-22 00:00:00",
"i": -0.03,
"a": 0.038,
"g": 0.003
},
{
"t": "2025-06-21 00:00:00",
"i": -0.032,
"a": 0.032,
"g": 0.003
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,70 @@
[
{
"t": "2025-08-01 00:00:00",
"i": -0.032,
"a": 0.039,
"g": 0.008
},
{
"t": "2025-07-31 00:00:00",
"i": -0.038,
"a": 0.047,
"g": 0.001
},
{
"t": "2025-07-30 00:00:00",
"i": -0.04,
"a": 0.042,
"g": 0.004
},
{
"t": "2025-07-29 00:00:00",
"i": -0.035,
"a": 0.043,
"g": 0.005
},
{
"t": "2025-07-28 00:00:00",
"i": -0.036,
"a": 0.047,
"g": 0.003
},
{
"t": "2025-07-27 00:00:00",
"i": -0.033,
"a": 0.041,
"g": 0.004
},
{
"t": "2025-07-26 00:00:00",
"i": -0.036,
"a": 0.044,
"g": 0.005
},
{
"t": "2025-07-25 00:00:00",
"i": -0.033,
"a": 0.042,
"g": 0.003
},
{
"t": "2025-07-24 00:00:00",
"i": -0.035,
"a": 0.041,
"g": 0.003
},
{
"t": "2025-07-23 00:00:00",
"i": -0.04,
"a": 0.041,
"g": 0.005
},
{
"t": "2025-07-22 00:00:00",
"i": -0.035,
"a": 0.041,
"g": 0.003
},
{
"t": "2025-07-21 00:00:00",
"i": -0.034,
@@ -118,71 +184,5 @@
"i": -0.033,
"a": 0.041,
"g": 0.003
},
{
"t": "2025-07-01 00:00:00",
"i": -0.035,
"a": 0.04,
"g": 0.002
},
{
"t": "2025-06-30 00:00:00",
"i": -0.032,
"a": 0.04,
"g": 0.003
},
{
"t": "2025-06-29 00:00:00",
"i": -0.035,
"a": 0.036,
"g": 0
},
{
"t": "2025-06-28 00:00:00",
"i": -0.033,
"a": 0.036,
"g": 0.001
},
{
"t": "2025-06-27 00:00:00",
"i": -0.032,
"a": 0.039,
"g": 0.002
},
{
"t": "2025-06-26 00:00:00",
"i": -0.033,
"a": 0.036,
"g": 0.001
},
{
"t": "2025-06-25 00:00:00",
"i": -0.035,
"a": 0.035,
"g": 0
},
{
"t": "2025-06-24 00:00:00",
"i": -0.03,
"a": 0.042,
"g": 0.001
},
{
"t": "2025-06-23 00:00:00",
"i": -0.033,
"a": 0.032,
"g": 0.001
},
{
"t": "2025-06-22 00:00:00",
"i": -0.031,
"a": 0.032,
"g": 0.001
},
{
"t": "2025-06-21 00:00:00",
"i": -0.034,
"a": 0.032,
"g": 0
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,70 @@
[
{
"t": "2025-08-01 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-31 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-30 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-29 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-28 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-27 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-26 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-25 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-24 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-23 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-22 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-21 00:00:00",
"i": 0,
@@ -118,71 +184,5 @@
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-01 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-30 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-29 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-28 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-27 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-26 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-25 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-24 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-23 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-22 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-21 00:00:00",
"i": 0,
"a": 0,
"g": 0
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,70 @@
[
{
"t": "2025-08-01 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-31 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-30 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-29 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-28 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-27 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-26 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-25 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-24 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-23 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-22 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-21 00:00:00",
"i": 0,
@@ -118,71 +184,5 @@
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-01 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-30 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-29 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-28 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-27 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-26 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-25 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-24 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-23 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-22 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-21 00:00:00",
"i": 0,
"a": 0,
"g": 0
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,70 @@
[
{
"t": "2025-08-01 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-31 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-30 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-29 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-28 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-27 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-26 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-25 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-24 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-23 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-22 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-21 00:00:00",
"i": 0,
@@ -118,71 +184,5 @@
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-01 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-30 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-29 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-28 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-27 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-26 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-25 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-24 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-23 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-22 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-21 00:00:00",
"i": 0,
"a": 0,
"g": 0
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,70 @@
[
{
"t": "2025-08-01 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-31 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-30 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-29 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-28 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-27 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-26 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-25 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-24 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-23 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-22 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-21 00:00:00",
"i": 0,
@@ -118,71 +184,5 @@
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-07-01 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-30 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-29 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-28 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-27 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-26 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-25 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-24 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-23 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-22 00:00:00",
"i": 0,
"a": 0,
"g": 0
},
{
"t": "2025-06-21 00:00:00",
"i": 0,
"a": 0,
"g": 0
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,10 @@
// Script zum Aktualisieren der Mockdaten für analoge Eingänge von CPL-Gerät
// Benötigt: node-fetch und fs/promises
// npm install node-fetch
// In package.json: "type": "module"
/*
Das Script fetchAnalogInputsData.mjs lädt historische Messdaten für analoge Eingänge eines CPL-Geräts (über HTTP-API) für die
letzten 30 Tage herunter und speichert sie als JSON-Dateien in einem lokalen Verzeichnis.
Es verwendet die Zugangsdaten Littwin und ruft für jeden Eingang (100107) und jeden DIA-Typ (DIA0, DIA1, DIA2)
die Daten ab. Die Ergebnisse werden in mocks/device-cgi-simulator/chartsData/analogInputs/<Eingang>/<DIA>.json gespeichert.
Das Script dient zur Aktualisierung von Mockdaten für Tests oder Simulationen.
*/
import fetch from "node-fetch";
import fs from "fs/promises";

View File

@@ -0,0 +1,52 @@
/*
Das Script fetchMessagesData.mjs lädt Meldungen von einem CPL-Gerät über eine HTTPS-API für einen angegebenen Zeitraum herunter.
Es authentifiziert sich mit Benutzername und Passwort, akzeptiert selbst-signierte Zertifikate und speichert die abgerufenen Daten
als JSON in zwei Dateien (messages.json und messages_all.json) im Verzeichnis meldungen. Das Script dient dazu,
Mockdaten für Tests oder Simulationen aktuell zu halten.
*/
import fetch from "node-fetch";
import https from "https";
import fs from "fs/promises";
import path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const CPL_URL =
"https://10.10.0.118/CPL?Service/ae.ACP&MSS1=2025;07;02;2025;08;01;All";
const USERNAME = "Littwin";
const PASSWORD = "Littwin";
const targetDir = path.join(__dirname, "../device-cgi-simulator/meldungen");
async function fetchAndSaveMessages() {
console.log("Fetch:", CPL_URL);
const agent = new https.Agent({ rejectUnauthorized: false });
const res = await fetch(CPL_URL, {
headers: {
Authorization:
"Basic " + Buffer.from(`${USERNAME}:${PASSWORD}`).toString("base64"),
},
agent,
});
if (!res.ok)
throw new Error(`Fehler beim Abrufen der Meldungen: ${res.status}`);
const data = await res.json();
await fs.mkdir(targetDir, { recursive: true });
await fs.writeFile(
path.join(targetDir, "messages.json"),
JSON.stringify(data, null, 2)
);
await fs.writeFile(
path.join(targetDir, "messages_all.json"),
JSON.stringify(data, null, 2)
);
}
(async () => {
try {
await fetchAndSaveMessages();
console.log("Meldungen aktualisiert.");
} catch (e) {
console.error(e);
}
})();

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "cpl-v4",
"version": "1.6.671",
"version": "1.6.672",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cpl-v4",
"version": "1.6.671",
"version": "1.6.672",
"dependencies": {
"@fontsource/roboto": "^5.1.0",
"@headlessui/react": "^2.2.4",

View File

@@ -1,6 +1,6 @@
{
"name": "cpl-v4",
"version": "1.6.671",
"version": "1.6.672",
"private": true,
"scripts": {
"dev": "next dev",