#!/bin/sh
# -*- sh -*-
+: << =cut
+
+=head1 NAME
+
+ heatpump-dimplex-wpm - Munin plugin to display Diplex heatpump data
+
+ Tested with Dimplex NWPM, BIOS 4.1, BOOT 4.03, SOFTWARE: WPM_H_H54
+
+=head1 CONFIGURATION
+
+ You need to configure the hostname in the plugin name.
+
+ Symlink heatpump-dimplex-wpm_ as "heatpump-dimplex-wpm_192.168.20.71".
+
+=head1 DEPENDENCIES
+
+ curl
+
+=head1 AUTHOR
+
+ Christian Weiske <cweiske@cweiske.de>
+
+=head1 LICENSE
+
+ AGPL
+ http://www.gnu.org/licenses/agpl.html
+
+=head1 MAGIC MARKERS
+
+ #%# family=manual
+
+=cut
+
. ${MUNIN_LIBDIR:=/usr/share/munin}/plugins/plugin.sh
+host=`echo ${0##*/}|sed 's/^.*_//g'`
+
if [ "$1" = "config" ]; then
- echo 'multigraph heatpump_dimplex_wpm_outtemp'
- echo 'graph_title Außentemperatur'
- echo 'graph_args --base 1000'
- echo 'graph_vlabel °C'
- echo 'graph_info Zeigt die gemessene Außentemperatur an'
- echo 'graph_scale no'
- echo 'graph_category sensors'
-
- echo 'outtemp.label Außentemperatur'
- exit 0
+ #Outdoor temperature
+ echo 'multigraph heatpump_dimplex_wpm_outtemp'
+ echo 'graph_title Außentemperatur'
+ echo 'graph_args --base 1000'
+ echo 'graph_vlabel °C'
+ echo 'graph_info Zeigt die gemessene Außentemperatur an'
+ echo 'graph_scale no'
+ echo 'graph_category sensors'
+
+ echo 'outtemp.label Außentemperatur'
+
+ #Heating temperatures
+ echo 'multigraph heatpump_dimplex_wpm_heating'
+ echo 'graph_title Heizungstemperaturen'
+ echo 'graph_args --base 1000'
+ echo 'graph_vlabel °C'
+ echo 'graph_info Zeigt Heizungstemperatur-Betriebsdaten an'
+ echo 'graph_scale no'
+ echo 'graph_category sensors'
+
+ echo 'returntargettemp.label Rücklaufsolltemperatur'
+ echo 'returntemp.label Rücklauftemperatur'
+ echo 'influxtemp.label Vorlauftemperatur'
+
+ #Water temperature
+ echo 'multigraph heatpump_dimplex_wpm_water'
+ echo 'graph_title Warmwasser'
+ echo 'graph_args --base 1000'
+ echo 'graph_vlabel °C'
+ echo 'graph_info Zeigt Warmwasser-Betriebsdaten an'
+ echo 'graph_scale no'
+ echo 'graph_category sensors'
+
+ echo 'watertargettemp.label Solltemperatur'
+ echo 'watertemp.label Warmwassertemperatur'
+
+
+ #On/off states
+ echo 'multigraph heatpump_dimplex_wpm_states'
+ echo 'graph_title Stati'
+ echo 'graph_args --base 1000'
+ echo 'graph_vlabel An/Aus'
+ echo 'graph_info Zeigt binäre Daten an'
+ echo 'graph_scale no'
+ echo 'graph_category sensors'
+
+ echo 'reqheating.label Anforderung Heizung'
+ echo 'reqwater.label Anforderung Warmwasser'
+
+ exit 0
fi
-data=`curl -s http://192.168.20.71/usr-cgi/xml.cgi?A%7C1%7C125%7CD%7C1%7C100%7CI%7C1%7C100 | xsltproc paths.xsl -`
+data=`curl -s "http://$host/usr-cgi/xml.cgi?A|1|125|D|1|150|I|1|100" | xsltproc paths.xsl -`
+#Outdoor temperature
+echo 'multigraph heatpump_dimplex_wpm_outtemp'
echo outtemp.value `echo "$data" | grep ANALOG/27 | cut -d" " -f2`
+
+#Heating temperatures
+echo 'multigraph heatpump_dimplex_wpm_heating'
+echo returntargettemp.value `echo "$data" | grep ANALOG/28 | cut -d" " -f2`
+echo returntemp.value `echo "$data" | grep ANALOG/29 | cut -d" " -f2`
+echo influxtemp.value `echo "$data" | grep ANALOG/31 | cut -d" " -f2`
+
+#Water temperatures
+echo 'multigraph heatpump_dimplex_wpm_water'
+echo watertargettemp.value `echo "$data" | grep ANALOG/40 | cut -d" " -f2`
+echo watertemp.value `echo "$data" | grep ANALOG/30 | cut -d" " -f2`
+
+#On/off states
+echo 'multigraph heatpump_dimplex_wpm_states'
+echo reqheating.value `echo "$data" | grep DIGITAL/136 | cut -d" " -f2`
+water=`echo "$data" | grep DIGITAL/140 | cut -d" " -f2`
+echo reqwater.value `echo $(($water * 2))`