-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgetInfo.sh
More file actions
57 lines (47 loc) · 2.78 KB
/
getInfo.sh
File metadata and controls
57 lines (47 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/pi
# DATA FOR AQUAREA SERVICE PORTAL
# The deviceID is a unique identifier and NOT the ID shown in the portal. Find it from the website source
deviceID=""
# The userID can be found from the website source
userID=""
# The regular login-name for the service portal
username=""
# The password is a the md5 hash from the concatenation of the username and the password (no spaces)
# So if your username is aquareaUser and your pw is lovelypana then you have to create the md5 hash
# from aquareaUserlovelypana and enter it here.
# I might add an algorithm to do that in the future
# use e.g. https://www.md5-generator.de/ to find it
password=""
# DATA FOR INFLUX DB
dbname=geisha
dbuser=
dbpassword=
curl --cookie-jar cookie https://aquarea-service.panasonic.com/ | grep -Eoi "shiesuahruefutohkun = '(.*?)'" | cut -d \' -f 2 > shiesuahruefutohkun
shiesuahruefutohkun="`cat shiesuahruefutohkun`"
curl --cookie-jar cookie -H "Origin: https://aquarea-service.panasonic.com" --referer https://aquarea-service.panasonic.com/ -d "var.loginId=${username}&var.password=${password}&var.inputOmit=false&shiesuahruefutohkun=${shiesuahruefutohkun}" -X POST https://aquarea-service.panasonic.com/installer/api/auth/login
curl --cookie cookie https://aquarea-service.panasonic.com/installer/home | grep -Eoi "shiesuahruefutohkun = '(.*?)'" | cut -d \' -f 2 > shiesuahruefutohkun
shiesuahruefutohkun="`cat shiesuahruefutohkun`"
curl --cookie cookie -d "var.functionSelectedGwUid=${userID}" -X POST https://aquarea-service.panasonic.com/installer/functionUserInformation | grep -Eoi "shiesuahruefutohkun = '(.*?)'" | cut -d \' -f 2 > shiesuahruefutohkun
shiesuahruefutohkun="`cat shiesuahruefutohkun`"
curl --cookie cookie -o aquareadata.json -d "var.deviceId=${deviceID}&shiesuahruefutohkun=${shiesuahruefutohkun}" -X POST https://aquarea-service.panasonic.com/installer/api/function/status
i=0
for row in $(cat zuordnung.json | jq -r '.[] | @base64'); do
_jq() {
echo ${row} | base64 --decode | jq -r ${1}
}
description=$(_jq '.desc')
fstext=$(_jq '.fstext')
textID=$(_jq '.textID')
measurementValue=$(cat aquareadata.json | jq '.statusDataInfo["'${fstext}'"]' | jq '.value')
textValue=$(cat aquareadata.json | jq -r '.statusDataInfo["'${fstext}'"]' | jq '.textValue')
measurementType=$(cat aquareadata.json | jq -r '.statusDataInfo["'${fstext}'"]' | jq '.type')
trimmedValue=$(sed -e 's/^"//' -e 's/"$//' <<<"$measurementValue")
trimmedDesc=$(sed -e 's/^"//' -e 's/"$//' <<<"$description")
# INTEGER VALUE
re='^[0-9]+$'
if [[ $trimmedValue =~ $re ]] ; then
curl -i -XPOST -u $dbuser:$dbpassword 'http://192.168.178.39:8086/write?db='${dbname}'' --data-binary ''${trimmedDesc}' value='${trimmedValue}''
fi
i=$((i+1))
done