694419e6a6c774674ae49ccd4f7e6aedca04cf3c
[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  [heatpump-dimplex-wpm_*]
21   env.host_name Heating
22
23 =head1 DEPENDENCIES
24
25  - curl
26  - xsltproc
27
28 =head1 AUTHOR
29
30  Christian Weiske <cweiske@cweiske.de>
31
32 =head1 LICENSE
33
34  AGPL
35  http://www.gnu.org/licenses/agpl.html
36
37 =head1 MAGIC MARKERS
38
39  #%# family=manual
40
41 =cut
42
43 . ${MUNIN_LIBDIR:=/usr/share/munin}/plugins/plugin.sh
44
45 host=`echo ${0##*/}|sed 's/^.*_//g'`
46
47
48 if [ "$1" = "config" ]; then
49     if [ "$host_name" != "" ]; then
50         echo "host_name $host_name"
51     fi
52
53     #Outdoor temperature
54     echo 'multigraph heatpump_dimplex_wpm_outtemp'
55     echo 'graph_title Außentemperatur'
56     echo 'graph_args --base 1000'
57     echo 'graph_vlabel °C'
58     echo 'graph_info Zeigt die gemessene Außentemperatur an'
59     echo 'graph_scale no'
60     echo 'graph_category sensors'
61
62     echo 'outtemp.label Außentemperatur'
63
64     #Heating temperatures
65     echo 'multigraph heatpump_dimplex_wpm_heating'
66     echo 'graph_title Heizungstemperaturen'
67     echo 'graph_args --base 1000'
68     echo 'graph_vlabel °C'
69     echo 'graph_info Zeigt Heizungstemperatur-Betriebsdaten an'
70     echo 'graph_scale no'
71     echo 'graph_category sensors'
72
73     echo 'returntargettemp.label Rücklaufsolltemperatur'
74     echo 'returntemp.label Rücklauftemperatur'
75     echo 'influxtemp.label Vorlauftemperatur'
76
77     #Water temperature
78     echo 'multigraph heatpump_dimplex_wpm_water'
79     echo 'graph_title Warmwasser'
80     echo 'graph_args --base 1000'
81     echo 'graph_vlabel °C'
82     echo 'graph_info Zeigt Warmwasser-Betriebsdaten an'
83     echo 'graph_scale no'
84     echo 'graph_category sensors'
85
86     echo 'watertargettemp.label Solltemperatur'
87     echo 'watertemp.label Warmwassertemperatur'
88
89
90     #On/off states
91     echo 'multigraph heatpump_dimplex_wpm_states'
92     echo 'graph_title Stati'
93     echo 'graph_args --base 1000'
94     echo 'graph_vlabel An/Aus'
95     echo 'graph_info Zeigt binäre Daten an'
96     echo 'graph_scale no'
97     echo 'graph_category sensors'
98
99     echo 'reqheating.label Anforderung Heizung'
100     echo 'reqwater.label Anforderung Warmwasser'
101
102     exit 0
103 fi
104
105 xml=`curl -fs "http://$host/usr-cgi/xml.cgi?A|1|125|D|1|150|I|1|100"`; ret=$?
106 if [ "$ret" -ne 0 ]; then
107     echo "Error fetching data from heatpump server: $host"
108     exit 1
109 fi
110
111 data=`echo "$xml" | xsltproc paths.xsl -`; ret=$?
112 if [ "$ret" -ne 0 ]; then
113     echo "Error running xsltproc"
114     exit 2
115 fi
116
117 #Outdoor temperature
118 echo 'multigraph heatpump_dimplex_wpm_outtemp'
119 echo outtemp.value `echo "$data" | grep ANALOG/27 | cut -d" " -f2`
120
121 #Heating temperatures
122 echo 'multigraph heatpump_dimplex_wpm_heating'
123 echo returntargettemp.value `echo "$data" | grep ANALOG/28 | cut -d" " -f2`
124 echo returntemp.value `echo "$data" | grep ANALOG/29 | cut -d" " -f2`
125 echo influxtemp.value `echo "$data" | grep ANALOG/31 | cut -d" " -f2`
126
127 #Water temperatures
128 echo 'multigraph heatpump_dimplex_wpm_water'
129 echo watertargettemp.value `echo "$data" | grep ANALOG/40 | cut -d" " -f2`
130 echo watertemp.value `echo "$data" | grep ANALOG/30 | cut -d" " -f2`
131
132 #On/off states
133 echo 'multigraph heatpump_dimplex_wpm_states'
134 echo reqheating.value `echo "$data" | grep DIGITAL/136 | cut -d" " -f2`
135 water=`echo "$data" | grep DIGITAL/140 | cut -d" " -f2`
136 echo reqwater.value `echo $(($water * 2))`