From 3d6b2e5131bd73a3a70b66ba13ea4fab6a2e97fe Mon Sep 17 00:00:00 2001 From: Vincenzo-Petrolo Date: Sun, 30 Aug 2020 18:58:02 +0200 Subject: [PATCH] Fixed unit value conversion --- bar-functions/dwm_solar_panel.sh | 3 +- bar-functions/dwm_solar_panels_diff.sh | 41 -------------------------- 2 files changed, 1 insertion(+), 43 deletions(-) delete mode 100755 bar-functions/dwm_solar_panels_diff.sh diff --git a/bar-functions/dwm_solar_panel.sh b/bar-functions/dwm_solar_panel.sh index 20ae7f6..b966fae 100755 --- a/bar-functions/dwm_solar_panel.sh +++ b/bar-functions/dwm_solar_panel.sh @@ -40,8 +40,7 @@ dwm_solar_panel () { then echo "null" > ~/.cache/solar_panel.cache else - WATTC=`bc <<< "scale=3; $WATTS / 1000"` - printf "%s💡 $WATTC W %s" "$SEP1" "$SEP2" + printf "%s💡 $WATTS W %s" "$SEP1" "$SEP2" fi fi diff --git a/bar-functions/dwm_solar_panels_diff.sh b/bar-functions/dwm_solar_panels_diff.sh deleted file mode 100755 index 0561c08..0000000 --- a/bar-functions/dwm_solar_panels_diff.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -dwm_solar_panel () { - - if [[ -f ~/.cache/solar_panel.cache ]]; - then - read SID < ~/.cache/solar_panel.cache - if [ "$SID" == "null" ]; - then - #Getting session id - SID=`curl -s --location --request POST 'http://192.168.1.126/dyn/login.json' \ - --header 'Content-Type: text/plain' \ - --data-raw '{"right":"usr","pass":"ciao1234"}' | jq .result.sid` - SID=${SID//\"} - fi - #checks if it got a session token - if [ "$SID" != "" ] || [ "$SID" != "null" ]; - then - echo $SID > ~/.cache/solar_panel.cache - #get data, don't modify a single line of this url,except for the IP(192.168.1.126) - WATTS=$(curl -s --location --request POST "http://192.168.1.126/dyn/getValues.json?sid=$SID" \ - --header 'Content-Type: text/plain' \ - --data-raw '{"destDev":[],"keys":["6100_00543100","6800_008AA200","6100_40263F00","6800_00832A00","6180_08214800","6180_08414900","6180_08522F00","6400_00543A00","6400_00260100","6800_08811F00","6400_00462E00"]}' | jq '.result."0156-76BC3EC6"."6100_40263F00"."1"[0].val') - - if [ "$WATTS" == "" ] || [ "$WATTS" == "null" ]; - then - echo "null" > ~/.cache/solar_panel.cache - else - WATTC=`bc <<< "scale=3; $WATTS / 1000"` - printf "%s💡 $WATTC W %s" "$SEP1" "$SEP2" - fi - fi - else - touch ~/.cache/solar_panel.cache - - echo "null" > ~/.cache/solar_panel.cache - fi - -} -dwm_solar_panel -