From d931ed4bf12fd42070a197b4052c76b939bb1a5b Mon Sep 17 00:00:00 2001 From: Holger Mueller Date: Sat, 25 Mar 2023 20:09:22 +0100 Subject: [PATCH 1/6] Extend format check to support fractions --- modules/goelp1/main.sh | 2 +- modules/goelp2/main.sh | 2 +- modules/goelp3/main.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/goelp1/main.sh b/modules/goelp1/main.sh index 80b9455ad..85a0f710d 100755 --- a/modules/goelp1/main.sh +++ b/modules/goelp1/main.sh @@ -1,5 +1,5 @@ #!/bin/bash -re='^-?[0-9]+$' +re='^-?[0-9]+(\.?[0-9]+)$' rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp1 -s http://$goeiplp1/status) diff --git a/modules/goelp2/main.sh b/modules/goelp2/main.sh index e830d6e97..aea7e9bea 100755 --- a/modules/goelp2/main.sh +++ b/modules/goelp2/main.sh @@ -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) diff --git a/modules/goelp3/main.sh b/modules/goelp3/main.sh index c468058dd..e7162ea1c 100755 --- a/modules/goelp3/main.sh +++ b/modules/goelp3/main.sh @@ -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) From 813f9398aac294c9f1e307c9c7e03f44e55de4e7 Mon Sep 17 00:00:00 2001 From: Holger Mueller Date: Sun, 26 Mar 2023 17:57:38 +0200 Subject: [PATCH 2/6] fixing re for none fractional numbers --- modules/goelp1/main.sh | 2 +- modules/goelp2/main.sh | 2 +- modules/goelp3/main.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/goelp1/main.sh b/modules/goelp1/main.sh index 85a0f710d..c490f498e 100755 --- a/modules/goelp1/main.sh +++ b/modules/goelp1/main.sh @@ -1,5 +1,5 @@ #!/bin/bash -re='^-?[0-9]+(\.?[0-9]+)$' +re='^-?[0-9]+(\.[0-9]+)?$' rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp1 -s http://$goeiplp1/status) diff --git a/modules/goelp2/main.sh b/modules/goelp2/main.sh index aea7e9bea..f7fa179bf 100755 --- a/modules/goelp2/main.sh +++ b/modules/goelp2/main.sh @@ -1,5 +1,5 @@ #!/bin/bash -re='^-?[0-9]+(\.?[0-9]+)$' +re='^-?[0-9]+(\.[0-9]+)?$' rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp2 -s http://$goeiplp2/status) diff --git a/modules/goelp3/main.sh b/modules/goelp3/main.sh index e7162ea1c..0c9c9938b 100755 --- a/modules/goelp3/main.sh +++ b/modules/goelp3/main.sh @@ -1,5 +1,5 @@ #!/bin/bash -re='^-?[0-9]+(\.?[0-9]+)$' +re='^-?[0-9]+(\.[0-9]+)?$' rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp3 -s http://$goeiplp3/status) From bd5178a768c9b8d3d4808320e9a19d677b892c8f Mon Sep 17 00:00:00 2001 From: Holger Mueller Date: Sun, 26 Mar 2023 18:01:11 +0200 Subject: [PATCH 3/6] one digit fractional for currents --- modules/goelp1/main.sh | 6 +++--- modules/goelp2/main.sh | 6 +++--- modules/goelp3/main.sh | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/goelp1/main.sh b/modules/goelp1/main.sh index c490f498e..14bc42310 100755 --- a/modules/goelp1/main.sh +++ b/modules/goelp1/main.sh @@ -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 diff --git a/modules/goelp2/main.sh b/modules/goelp2/main.sh index f7fa179bf..cd0dd928d 100755 --- a/modules/goelp2/main.sh +++ b/modules/goelp2/main.sh @@ -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 diff --git a/modules/goelp3/main.sh b/modules/goelp3/main.sh index 0c9c9938b..fcc23c7c2 100755 --- a/modules/goelp3/main.sh +++ b/modules/goelp3/main.sh @@ -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 From 72faf8a61d98620cf06e4eb685ab69ddd09aba90 Mon Sep 17 00:00:00 2001 From: Holger Mueller Date: Sun, 26 Mar 2023 18:18:30 +0200 Subject: [PATCH 4/6] Adding power factor readout for lp1 --- modules/goelp1/main.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/goelp1/main.sh b/modules/goelp1/main.sh index 14bc42310..d83f3ab9b 100755 --- a/modules/goelp1/main.sh +++ b/modules/goelp1/main.sh @@ -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 From 03ff043d90ac516455be416dc6210e044f7aa951 Mon Sep 17 00:00:00 2001 From: Holger Mueller Date: Sun, 2 Apr 2023 09:29:15 +0200 Subject: [PATCH 5/6] =?UTF-8?q?Review=20Kommentare=20separate=20RE=20f?= =?UTF-8?q?=C3=BCr=20V,=20A=20und=20Pf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/goelp1/main.sh | 3 ++- modules/goelp2/main.sh | 13 +++++++------ modules/goelp3/main.sh | 15 ++++++++------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/modules/goelp1/main.sh b/modules/goelp1/main.sh index d83f3ab9b..07f52f196 100755 --- a/modules/goelp1/main.sh +++ b/modules/goelp1/main.sh @@ -1,5 +1,6 @@ #!/bin/bash -re='^-?[0-9]+(\.[0-9]+)?$' +re='^-?[0-9]+$' +reFrac='^-?[0-9]+(\.[0-9]+)?$' rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp1 -s http://$goeiplp1/status) diff --git a/modules/goelp2/main.sh b/modules/goelp2/main.sh index cd0dd928d..3be8f0b7d 100755 --- a/modules/goelp2/main.sh +++ b/modules/goelp2/main.sh @@ -1,5 +1,6 @@ #!/bin/bash -re='^-?[0-9]+(\.[0-9]+)?$' +re='^-?[0-9]+$' +reVAPf='^-?[0-9]+(\.[0-9]+)?$' rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp2 -s http://$goeiplp2/status) @@ -11,17 +12,17 @@ if [[ $? == "0" ]] ; then fi lla1=$(echo $output | jq -r '.nrg[4]') lla1=$(echo "scale=1;$lla1 / 10" |bc) - if [[ $lla1 =~ $re ]] ; then + if [[ $lla1 =~ $reVAPf ]] ; then echo $lla1 > /var/www/html/openWB/ramdisk/llas11 fi lla2=$(echo $output | jq -r '.nrg[5]') lla2=$(echo "scale=1;$lla2 / 10" |bc) - if [[ $lla2 =~ $re ]] ; then + if [[ $lla2 =~ $reVAPf ]] ; then echo $lla2 > /var/www/html/openWB/ramdisk/llas12 fi lla3=$(echo $output | jq -r '.nrg[6]') lla3=$(echo "scale=1;$lla3 / 10" |bc) - if [[ $lla3 =~ $re ]] ; then + if [[ $lla3 =~ $reVAPf ]] ; then echo $lla3 > /var/www/html/openWB/ramdisk/llas13 fi llv1=$(echo $output | jq -r '.nrg[0]') @@ -29,11 +30,11 @@ if [[ $? == "0" ]] ; then echo $llv1 > /var/www/html/openWB/ramdisk/llvs11 fi llv2=$(echo $output | jq -r '.nrg[1]') - if [[ $llv2 =~ $re ]] ; then + if [[ $llv2 =~ $reVAPf ]] ; then echo $llv2 > /var/www/html/openWB/ramdisk/llvs12 fi llv3=$(echo $output | jq -r '.nrg[2]') - if [[ $llv3 =~ $re ]] ; then + if [[ $llv3 =~ $reVAPf ]] ; then echo $llv3 > /var/www/html/openWB/ramdisk/llvs13 fi llkwh=$(echo $output | jq -r '.eto') diff --git a/modules/goelp3/main.sh b/modules/goelp3/main.sh index fcc23c7c2..c7b31ed30 100755 --- a/modules/goelp3/main.sh +++ b/modules/goelp3/main.sh @@ -1,5 +1,6 @@ #!/bin/bash -re='^-?[0-9]+(\.[0-9]+)?$' +re='^-?[0-9]+$' +reVAPf='^-?[0-9]+(\.[0-9]+)?$' rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp3 -s http://$goeiplp3/status) @@ -11,29 +12,29 @@ if [[ $? == "0" ]] ; then fi lla1=$(echo $output | jq -r '.nrg[4]') lla1=$(echo "scale=1;$lla1 / 10" |bc) - if [[ $lla1 =~ $re ]] ; then + if [[ $lla1 =~ $reVAPf ]] ; then echo $lla1 > /var/www/html/openWB/ramdisk/llas21 fi lla2=$(echo $output | jq -r '.nrg[5]') lla2=$(echo "scale=1;$lla2 / 10" |bc) - if [[ $lla2 =~ $re ]] ; then + if [[ $lla2 =~ $reVAPf ]] ; then echo $lla2 > /var/www/html/openWB/ramdisk/llas22 fi lla3=$(echo $output | jq -r '.nrg[6]') lla3=$(echo "scale=1;$lla3 / 10" |bc) - if [[ $lla3 =~ $re ]] ; then + if [[ $lla3 =~ $reVAPf ]] ; then echo $lla3 > /var/www/html/openWB/ramdisk/llas23 fi llv1=$(echo $output | jq -r '.nrg[0]') - if [[ $llv1 =~ $re ]] ; then + if [[ $llv1 =~ $reVAPf ]] ; then echo $llv1 > /var/www/html/openWB/ramdisk/llvs21 fi llv2=$(echo $output | jq -r '.nrg[1]') - if [[ $llv2 =~ $re ]] ; then + if [[ $llv2 =~ $reVAPf ]] ; then echo $llv2 > /var/www/html/openWB/ramdisk/llvs22 fi llv3=$(echo $output | jq -r '.nrg[2]') - if [[ $llv3 =~ $re ]] ; then + if [[ $llv3 =~ $reVAPf ]] ; then echo $llv3 > /var/www/html/openWB/ramdisk/llvs23 fi llkwh=$(echo $output | jq -r '.eto') From a2cb48fec1083ac9324cc41f73bec8bebc5d2a18 Mon Sep 17 00:00:00 2001 From: Holger Mueller Date: Thu, 6 Apr 2023 11:43:06 +0200 Subject: [PATCH 6/6] Fixing diffs between lp1 & 2/3 --- modules/goelp1/main.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/goelp1/main.sh b/modules/goelp1/main.sh index 07f52f196..ff5de7d0d 100755 --- a/modules/goelp1/main.sh +++ b/modules/goelp1/main.sh @@ -1,6 +1,6 @@ #!/bin/bash re='^-?[0-9]+$' -reFrac='^-?[0-9]+(\.[0-9]+)?$' +reVAPf='^-?[0-9]+(\.[0-9]+)?$' rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp1 -s http://$goeiplp1/status) @@ -12,44 +12,44 @@ if [[ $? == "0" ]] ; then fi lla1=$(echo $output | jq -r '.nrg[4]') lla1=$(echo "scale=1;$lla1 / 10" |bc) - if [[ $lla1 =~ $re ]] ; then + if [[ $lla1 =~ $reVAPf ]] ; then echo $lla1 > /var/www/html/openWB/ramdisk/lla1 fi lla2=$(echo $output | jq -r '.nrg[5]') lla2=$(echo "scale=1;$lla2 / 10" |bc) - if [[ $lla2 =~ $re ]] ; then + if [[ $lla2 =~ $reVAPf ]] ; then echo $lla2 > /var/www/html/openWB/ramdisk/lla2 fi lla3=$(echo $output | jq -r '.nrg[6]') lla3=$(echo "scale=1;$lla3 / 10" |bc) - if [[ $lla3 =~ $re ]] ; then + if [[ $lla3 =~ $reVAPf ]] ; then echo $lla3 > /var/www/html/openWB/ramdisk/lla3 fi llv1=$(echo $output | jq -r '.nrg[0]') - if [[ $llv1 =~ $re ]] ; then + if [[ $llv1 =~ $reVAPf ]] ; then echo $llv1 > /var/www/html/openWB/ramdisk/llv1 fi llv2=$(echo $output | jq -r '.nrg[1]') - if [[ $llv2 =~ $re ]] ; then + if [[ $llv2 =~ $reVAPf ]] ; then echo $llv2 > /var/www/html/openWB/ramdisk/llv2 fi llv3=$(echo $output | jq -r '.nrg[2]') - if [[ $llv3 =~ $re ]] ; then + if [[ $llv3 =~ $reVAPf ]] ; 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 + if [[ $llpf1 =~ $reVAPf ]] ; 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 + if [[ $llpf2 =~ $reVAPf ]] ; 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 + if [[ $llpf3 =~ $reVAPf ]] ; then echo $llpf3 > /var/www/html/openWB/ramdisk/llpf3 fi llkwh=$(echo $output | jq -r '.eto')