Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend format check to support fractions #2666

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions modules/goelp1/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
re='^-?[0-9]+$'
re='^-?[0-9]+(\.[0-9]+)?$'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die Anpassung wirkt sich auf alle Prüfungen aus. Mindestens die Leistung muss ein ganzzahliger Wert sein.
Bitte einen separaten regulären Ausdruck definieren und bei Strom und Spannung nutzen.

rekwh='^[-+]?[0-9]+\.?[0-9]*$'

output=$(curl --connect-timeout $goetimeoutlp1 -s http://$goeiplp1/status)
Expand All @@ -10,17 +10,17 @@ if [[ $? == "0" ]] ; then
echo $watt > /var/www/html/openWB/ramdisk/llaktuell
fi
lla1=$(echo $output | jq -r '.nrg[4]')
lla1=$(echo "scale=0;$lla1 / 10" |bc)
lla1=$(echo "scale=1;$lla1 / 10" |bc)
if [[ $lla1 =~ $re ]] ; then
echo $lla1 > /var/www/html/openWB/ramdisk/lla1
fi
lla2=$(echo $output | jq -r '.nrg[5]')
lla2=$(echo "scale=0;$lla2 / 10" |bc)
lla2=$(echo "scale=1;$lla2 / 10" |bc)
if [[ $lla2 =~ $re ]] ; then
echo $lla2 > /var/www/html/openWB/ramdisk/lla2
fi
lla3=$(echo $output | jq -r '.nrg[6]')
lla3=$(echo "scale=0;$lla3 / 10" |bc)
lla3=$(echo "scale=1;$lla3 / 10" |bc)
if [[ $lla3 =~ $re ]] ; then
echo $lla3 > /var/www/html/openWB/ramdisk/lla3
fi
Expand All @@ -36,6 +36,21 @@ if [[ $? == "0" ]] ; then
if [[ $llv3 =~ $re ]] ; then
echo $llv3 > /var/www/html/openWB/ramdisk/llv3
fi
llpf1=$(echo $output | jq -r '.nrg[12]')
llpf1=$(echo "scale=2;$llpf1 / 1" |bc)
if [[ $llpf1 =~ $re ]] ; then
echo $llpf1 > /var/www/html/openWB/ramdisk/llpf1
fi
llpf2=$(echo $output | jq -r '.nrg[13]')
llpf2=$(echo "scale=2;$llpf2 / 1" |bc)
if [[ $llpf2 =~ $re ]] ; then
echo $llpf2 > /var/www/html/openWB/ramdisk/llpf2
fi
llpf3=$(echo $output | jq -r '.nrg[14]')
llpf3=$(echo "scale=2;$llpf3 / 1" |bc)
if [[ $llpf3 =~ $re ]] ; then
echo $llpf3 > /var/www/html/openWB/ramdisk/llpf3
fi
llkwh=$(echo $output | jq -r '.eto')
llkwh=$(echo "scale=3;$llkwh / 10" |bc)
if [[ $llkwh =~ $rekwh ]] ; then
Expand Down
8 changes: 4 additions & 4 deletions modules/goelp2/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
re='^-?[0-9]+$'
re='^-?[0-9]+(\.[0-9]+)?$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

output=$(curl --connect-timeout $goetimeoutlp2 -s http://$goeiplp2/status)
Expand All @@ -10,17 +10,17 @@ if [[ $? == "0" ]] ; then
echo $watt > /var/www/html/openWB/ramdisk/llaktuells1
fi
lla1=$(echo $output | jq -r '.nrg[4]')
lla1=$(echo "scale=0;$lla1 / 10" |bc)
lla1=$(echo "scale=1;$lla1 / 10" |bc)
if [[ $lla1 =~ $re ]] ; then
echo $lla1 > /var/www/html/openWB/ramdisk/llas11
fi
lla2=$(echo $output | jq -r '.nrg[5]')
lla2=$(echo "scale=0;$lla2 / 10" |bc)
lla2=$(echo "scale=1;$lla2 / 10" |bc)
if [[ $lla2 =~ $re ]] ; then
echo $lla2 > /var/www/html/openWB/ramdisk/llas12
fi
lla3=$(echo $output | jq -r '.nrg[6]')
lla3=$(echo "scale=0;$lla3 / 10" |bc)
lla3=$(echo "scale=1;$lla3 / 10" |bc)
if [[ $lla3 =~ $re ]] ; then
echo $lla3 > /var/www/html/openWB/ramdisk/llas13
fi
Expand Down
8 changes: 4 additions & 4 deletions modules/goelp3/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
re='^-?[0-9]+$'
re='^-?[0-9]+(\.[0-9]+)?$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

output=$(curl --connect-timeout $goetimeoutlp3 -s http://$goeiplp3/status)
Expand All @@ -10,17 +10,17 @@ if [[ $? == "0" ]] ; then
echo $watt > /var/www/html/openWB/ramdisk/llaktuells2
fi
lla1=$(echo $output | jq -r '.nrg[4]')
lla1=$(echo "scale=0;$lla1 / 10" |bc)
lla1=$(echo "scale=1;$lla1 / 10" |bc)
if [[ $lla1 =~ $re ]] ; then
echo $lla1 > /var/www/html/openWB/ramdisk/llas21
fi
lla2=$(echo $output | jq -r '.nrg[5]')
lla2=$(echo "scale=0;$lla2 / 10" |bc)
lla2=$(echo "scale=1;$lla2 / 10" |bc)
if [[ $lla2 =~ $re ]] ; then
echo $lla2 > /var/www/html/openWB/ramdisk/llas22
fi
lla3=$(echo $output | jq -r '.nrg[6]')
lla3=$(echo "scale=0;$lla3 / 10" |bc)
lla3=$(echo "scale=1;$lla3 / 10" |bc)
if [[ $lla3 =~ $re ]] ; then
echo $lla3 > /var/www/html/openWB/ramdisk/llas23
fi
Expand Down