tell about config file
[munin-heatpump.git] / heatpump-dimplex-wpm_
1 #!/bin/sh
2 # -*- sh -*-
3
4 : << =cut
5
6 =head1 NAME
7
8  heatpump-dimplex-wpm - Munin plugin to display Diplex heatpump data
9
10  Tested with Dimplex NWPM, BIOS 4.1, BOOT 4.03, SOFTWARE: WPM_H_H54
11
12 =head1 CONFIGURATION
13
14  You need to configure the hostname in the plugin name.
15
16  Symlink heatpump-dimplex-wpm_ as "heatpump-dimplex-wpm_192.168.20.71".
17
18 =head2 EXAMPLE CONFIGURATION
19
20  In /etc/munin/plugin-conf.d/munin-node:
21
22  [heatpump-dimplex-wpm_*]
23   env.host_name Heating
24
25 =head1 DEPENDENCIES
26
27  - curl
28  - xsltproc
29
30 =head1 AUTHOR
31
32  Christian Weiske <cweiske@cweiske.de>
33
34 =head1 LICENSE
35
36  AGPL
37  http://www.gnu.org/licenses/agpl.html
38
39 =head1 MAGIC MARKERS
40
41  #%# family=manual
42
43 =cut
44
45 . ${MUNIN_LIBDIR:=/usr/share/munin}/plugins/plugin.sh
46
47 host=`echo ${0##*/}|sed 's/^.*_//g'`
48
49
50 if [ "$1" = "config" ]; then
51     if [ "$host_name" != "" ]; then
52         echo "host_name $host_name"
53     fi
54
55     #Outdoor temperature
56     echo 'multigraph heatpump_dimplex_wpm_outtemp'
57     echo 'graph_title Aussentemperatur'
58     echo 'graph_args --base 1000'
59     echo 'graph_vlabel °C'
60     echo 'graph_info Zeigt die gemessene Außentemperatur an'
61     echo 'graph_scale no'
62     echo 'graph_category sensors'
63
64     echo 'outtemp.label Aussentemperatur'
65     echo 'outtemp.draw LINE1'
66
67     #Heating temperatures
68     echo 'multigraph heatpump_dimplex_wpm_heating'
69     echo 'graph_title Heizungstemperaturen'
70     echo 'graph_args --base 1000'
71     echo 'graph_vlabel °C'
72     echo 'graph_info Zeigt Heizungstemperatur-Betriebsdaten an'
73     echo 'graph_scale no'
74     echo 'graph_category sensors'
75
76     echo 'returntargettemp.label Ruecklaufsolltemperatur'
77     echo 'returntargettemp.draw LINE2'
78     echo 'returntemp.label Ruecklauftemperatur'
79     echo 'returntemp.draw LINE1'
80     echo 'influxtemp.label Vorlauftemperatur'
81     echo 'influxtemp.draw LINE1'
82
83     #Water temperature
84     echo 'multigraph heatpump_dimplex_wpm_water'
85     echo 'graph_title Warmwasser'
86     echo 'graph_args --base 1000'
87     echo 'graph_vlabel °C'
88     echo 'graph_info Zeigt Warmwasser-Betriebsdaten an'
89     echo 'graph_scale no'
90     echo 'graph_category sensors'
91
92     echo 'watertargettemp.label Solltemperatur'
93     echo 'watertargettemp.draw LINE2'
94     echo 'watertemp.label Warmwassertemperatur'
95     echo 'watertemp.draw LINE1'
96
97
98     #On/off states
99     echo 'multigraph heatpump_dimplex_wpm_states'
100     echo 'graph_title Stati'
101     echo 'graph_args --base 1000'
102     echo 'graph_vlabel An/Aus'
103     echo 'graph_info Zeigt binäre Daten an'
104     echo 'graph_scale no'
105     echo 'graph_category sensors'
106
107     echo 'reqheating.label Anforderung Heizung'
108     echo 'reqheating.draw LINE1'
109     echo 'reqwater.label Anforderung Warmwasser'
110     echo 'reqwater.draw LINE1'
111
112     #settings: heating level
113     echo 'multigraph heatpump_dimplex_wpm_heating_level'
114     echo 'graph_title Heizungseinstellung'
115     echo 'graph_args --base 1000 --lower-limit 0 --upper-limit 38'
116     echo 'graph_vlabel Einstellung'
117     echo 'graph_info Shows the heating setting'
118     echo 'graph_scale no'
119     echo 'graph_category settings'
120
121     echo 'circuit1.label Heizkreis 1'
122     echo 'circuit1.draw LINE1'
123
124     #error level
125     echo 'multigraph heatpump_dimplex_wpm_errorlevel'
126     echo 'graph_title Alarme/Fehler'
127     echo 'graph_args --base 1000 --lower-limit 0 --upper-limit 100'
128     echo 'graph_vlabel Fehler'
129     echo 'graph_info Shows the error level'
130     echo 'graph_scale no'
131     echo 'graph_category sensors'
132
133     echo 'errorlevel.label Sammelstoermeldung'
134     echo 'errorlevel.draw LINE1'
135     echo 'errorlevel.critical 0:0'
136
137     exit 0
138 fi
139
140 xml=`curl -fs "http://$host/usr-cgi/xml.cgi?A|1|125|D|1|150|I|1|100"`; ret=$?
141 if [ "$ret" -ne 0 ]; then
142     echo "Error fetching data from heatpump server: $host"
143     exit 1
144 fi
145
146 xslfile=paths.xsl
147 if [ ! -f "$xslfile" ]; then
148     shell="`readlink -f "$0"`"
149     path="`dirname "$shell"`"
150     xslfile="$path/paths.xsl"
151     if [ ! -f "$xslfile" ]; then
152         echo 'Could not find paths.xsl'
153         exit 2
154     fi
155 fi
156
157 data=`echo "$xml" | xsltproc "$xslfile" -`; ret=$?
158 if [ "$ret" -ne 0 ]; then
159     echo 'Error running xsltproc'
160     exit 2
161 fi
162
163 #Outdoor temperature
164 echo 'multigraph heatpump_dimplex_wpm_outtemp'
165 echo outtemp.value `echo "$data" | grep ANALOG/27 | cut -d" " -f2`
166
167 #Heating temperatures
168 echo 'multigraph heatpump_dimplex_wpm_heating'
169 echo returntargettemp.value `echo "$data" | grep ANALOG/28 | cut -d" " -f2`
170 echo returntemp.value `echo "$data" | grep ANALOG/29 | cut -d" " -f2`
171 echo influxtemp.value `echo "$data" | grep ANALOG/31 | cut -d" " -f2`
172
173 #Water temperatures
174 echo 'multigraph heatpump_dimplex_wpm_water'
175 echo watertargettemp.value `echo "$data" | grep ANALOG/40 | cut -d" " -f2`
176 echo watertemp.value `echo "$data" | grep ANALOG/30 | cut -d" " -f2`
177
178 #On/off states
179 echo 'multigraph heatpump_dimplex_wpm_states'
180 echo reqheating.value `echo "$data" | grep DIGITAL/136 | cut -d" " -f2`
181 water=`echo "$data" | grep DIGITAL/140 | cut -d" " -f2`
182 echo reqwater.value `echo $(($water * 2))`
183
184 #Settings: Heating level
185 echo 'multigraph heatpump_dimplex_wpm_heating_level'
186 echo circuit1.value `echo "$data" | grep 'INTEGER/1 ' | cut -d" " -f2`
187
188 #Error level
189 #docs: 8,Analog,Ausgang,Sammelstörmeldung
190 echo 'multigraph heatpump_dimplex_wpm_errorlevel'
191 echo errorlevel.value `echo "$data" | grep 'ANALOG/8 ' | cut -d" " -f2`