summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-01-13 22:23:53 +0100
committertomsmeding <tom.smeding@gmail.com>2016-01-13 22:23:53 +0100
commit0be315ca46b7536dd8139abcbb49f45c2c1ccacd (patch)
treeaa96823f8eb4964fe1c3deafef445c0d04df2ef8
parent394acb2a3c198dfa678153b2cad064af3f1fc810 (diff)
parse the json
-rwxr-xr-xfunctions.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/functions.sh b/functions.sh
index b24f80b..c1ee319 100755
--- a/functions.sh
+++ b/functions.sh
@@ -111,7 +111,7 @@ function fgetstatenames() {
function fgetprogress() {
fensurelogin
json="$(fcurlwithtoken 'https://www.e-thermostaat.nl/pages/temperature_progress' | grep -m 1 'var json_data =' | sed 's/[^=]*= *\({.*}\);.*/\1/')"
- echo $json
+ echo $json | node -e 's="";process.stdin.on("data",function(d){s+=d.toString();});process.stdin.on("end",function(){o=JSON.parse(s);for(k in o){if(isNaN(+k))continue;for(K in o[k])console.log(("00"+k).slice(-2)+":"+("00"+K).slice(-2)+" "+o[k][K].M+" "+o[k][K].W);}})'
}