-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick.sh
More file actions
executable file
·145 lines (131 loc) · 5.02 KB
/
quick.sh
File metadata and controls
executable file
·145 lines (131 loc) · 5.02 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
COOKIE=${1}
while read LINE; do
K=$(echo ${LINE}|grep "temp value"|awk -F'[ "]' '{print $4}')
V=$(echo ${LINE}|grep "temp value"|awk -F'[>&]' '{print $2}')
P=$(echo ${LINE}|grep "img src" | awk -F '"' '{print $2}' | basename $(cat /dev/stdin) 2> /dev/null)
if [ -n "${K}" ]; then
case "${K}" in
value7)
echo dvienergi.smartcontrol.outside value=${V}
;;
value5)
echo dvienergi.smartcontrol.heating value=${V}
;;
value3)
echo dvienergi.smartcontrol.hotwater value=${V}
;;
value1)
echo dvienergi.smartcontrol.heating_forward value=${V}
;;
value2)
echo dvienergi.smartcontrol.heating_return1 value=${V}
;;
value8)
echo dvienergi.smartcontrol.heating_return2 value=${V}
;;
value13)
echo dvienergi.smartcontrol.ground_return value=${V}
;;
value14)
echo dvienergi.smartcontrol.ground_forward value=${V}
;;
value12)
echo dvienergi.smartcontrol.compressor_front value=${V}
;;
value11)
echo dvienergi.smartcontrol.compressor_back value=${V}
;;
value9)
echo dvienergi.smartcontrol.solar_roof value=${V}
;;
*)
echo "Unhandled temperature"
echo ${K}: ${V} 1>&2
;;
esac
fi
if [ -n "${P}" ]; then
case "${P}" in
A1-1.gif)
echo dvienergi.smartcontrol.solar_heating_pump value=0i
echo dvienergi.smartcontrol.solar_to_ground value=0i
;;
A1-1-4.gif)
echo dvienergi.smartcontrol.solar_heating_pump value=1i
echo dvienergi.smartcontrol.solar_to_ground value=0i
;;
A1-2-4.gif)
echo dvienergi.smartcontrol.solar_heating_pump value=1i
echo dvienergi.smartcontrol.solar_to_ground value=1i
;;
A2-1.gif)
# not a pump
;;
A3-1.gif)
# not a pump
;;
A4-1.gif)
echo dvienergi.smartcontrol.ground_pump value=0i
;;
A4-1-4.gif)
echo dvienergi.smartcontrol.ground_pump value=1i
;;
A4-6-4.gif)
echo dvienergi.smartcontrol.ground_pump value=1i
;;
A5-1.gif)
echo dvienergi.smartcontrol.compressor value=0i
;;
A5-1-4.gif)
echo dvienergi.smartcontrol.compressor value=1i
;;
A6-0.gif)
echo dvienergi.smartcontrol.electric_heater value=0i
;;
A6-1.gif)
echo dvienergi.smartcontrol.electric_heater value=0i
;;
A6-1-4.gif)
echo dvienergi.smartcontrol.electric_heater value=1i
;;
A7-1.gif)
echo dvienergi.smartcontrol.house_heating value=0i
;;
A7-1-4.gif)
echo dvienergi.smartcontrol.house_heating value=1i
;;
A8-1.gif)
echo dvienergi.smartcontrol.house_heating_pump value=0i
;;
A8-1-4.gif)
echo dvienergi.smartcontrol.house_heating_pump value=1i
;;
*)
echo "Unhandled pump"
echo ${P} 1>&2
esac
fi
done < <(curl 'https://smartcontrol.dvienergi.com/includes/process.php' -H "cookie: PHPSESSID=${COOKIE}" --data 'subupdatepumpgraphics=1' -s|sed 's/></>\n</g'|grep "\(temp value\|img src\)")
while read LINE; do
case "${LINE}" in
*user2*)
echo ${LINE}|awk -F' ' '{print "dvienergi.smartcontrol.heating_curve value=" $4}'
;;
*Beregnet\ temperatur*)
echo ${LINE}|awk -F'[ <]' '{print "dvienergi.smartcontrol.calculated_setpoint value=" $6}'
;;
esac
done < <(curl 'https://smartcontrol.dvienergi.com/includes/pumpchoice.php?id=12' -H "cookie: PHPSESSID=${COOKIE}" -s|sed 's/></>\n</g')
HOTWATERSETPOINT=$(curl 'https://smartcontrol.dvienergi.com/includes/pumpchoice.php?id=22' -H "cookie: PHPSESSID=${COOKIE}" -s|sed 's/></>\n</g'|grep 'user11'|awk -F' ' '{print $4}')
COMPRESSORTIME=$(curl 'https://smartcontrol.dvienergi.com/includes/pumpinfo.php?id=31' -H "cookie: PHPSESSID=${COOKIE}" -s|sed 's/></>\n</g'|grep "Kompressor" -A 1|tail -n 1|sed -e 's/<[^>]*>//g')
HOTWATERTIME=$(curl 'https://smartcontrol.dvienergi.com/includes/pumpinfo.php?id=31' -H "cookie: PHPSESSID=${COOKIE}" -s|sed 's/></>\n</g'|grep "Varmt vand" -A 1|tail -n 1|sed -e 's/<[^>]*>//g')
ELECTRICHEATERTIME=$(curl 'https://smartcontrol.dvienergi.com/includes/pumpinfo.php?id=31' -H "cookie: PHPSESSID=${COOKIE}" -s|sed 's/></>\n</g'|grep "Tilskudsvarme" -A 1|tail -n 1|sed -e 's/<[^>]*>//g')
SOLARTIME=$(curl 'https://smartcontrol.dvienergi.com/includes/pumpinfo.php?id=31' -H "cookie: PHPSESSID=${COOKIE}" -s|sed 's/></>\n</g'|grep "Solvarme" -A 1|tail -n 1|sed -e 's/<[^>]*>//g')
SOLARTOGROUNDTIME=$(curl 'https://smartcontrol.dvienergi.com/includes/pumpinfo.php?id=31' -H "cookie: PHPSESSID=${COOKIE}" -s|sed 's/></>\n</g'|grep "Sol til Jord" -A 1|tail -n 1|sed -e 's/<[^>]*>//g')
echo dvienergi.smartcontrol.hotwater_setpoint value=${HOTWATERSETPOINT}
echo dvienergi.smartcontrol.compressor_time value=${COMPRESSORTIME}
echo dvienergi.smartcontrol.hotwater_time value=${HOTWATERTIME}
echo dvienergi.smartcontrol.electricheater_time value=${ELECTRICHEATERTIME}
echo dvienergi.smartcontrol.solar_time value=${SOLARTIME}
echo dvienergi.smartcontrol.solartoground_time value=${SOLARTOGROUNDTIME}