From ea5f7846760184cbe1c29ebeab4f2cdedfd5fbce Mon Sep 17 00:00:00 2001 From: ststrobel <> Date: Sat, 21 Mar 2015 14:30:37 +0000 Subject: [PATCH] 98_ModbusSET.pm: added module for SET Silent Heat pumps with modbus interface git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@8255 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/98_ModbusSET.pm | 299 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100755 FHEM/98_ModbusSET.pm diff --git a/FHEM/98_ModbusSET.pm b/FHEM/98_ModbusSET.pm new file mode 100755 index 000000000..8fede266e --- /dev/null +++ b/FHEM/98_ModbusSET.pm @@ -0,0 +1,299 @@ +############################################## +############################################## +# $Id: 98_ModbusSET.pm +# +# fhem Modul für Wärmepumpen der Silent Serie von SET mit Modbus-Interface +# verwendet Modbus.pm als Basismodul für die eigentliche Implementation des Protokolls. +# +# Siehe ModbusExample.pm für eine ausführlichere Infos zur Verwendung des Moduls +# 98_Modbus.pm +# +# +# This file is part of fhem. +# +# Fhem is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# Fhem is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with fhem. If not, see . +# +############################################################################## +# Changelog: +# +# 2014-07-12 initial release +# 2015-01-25 changes in sync with the changes in 98_Modbus.pm +# 2015-01-26 more examples / comments on the keys in the parseInfo hash: +# - unpack for packing and unpacking the values / data types in the Modbus frames +# - len (for values like floats that span two registers) +# - format +# 2015-01-27 defLen im Modul-hash des logischen Moduls als Default +# maxLen als Max für die Länge bei function code 3 (laut Standard 125) +# 2015-01-31 new deviceInfo hash to bundle defaults and function code specific settings +# added defaultpolldelay to parseInfo +# 2015-02-16 added defPoll,defShowGet to deviceInfo, +# defaultpoll in parseInfo, defPoll in deviceInfo und das entsprechende Attribut können auch auf "once" +# gesetzt werden, +# defaultpolldelay +# defaultpolldelay bzw. das Attribut kann mit x beginnen und ist dann Multiplikator des Intervalls +# 2015-02-17 Initialize, Define und Undef in das Basismodul verlagert +# Abhängigkeit von Client-Definitionen entfernt. +# +# 2015-02-26 defaultpoll und defaultpolldelay umbenannt +# attribute für timing umbenannt +# + +package main; +use strict; +use warnings; +sub ModbusSET_Initialize($); + +my %SET10parseInfo = ( + "h256" => { reading => "Temp_Wasser_Ein", # name of the reading for this value + name => "Pb1", # internal name of this register in the hardware doc + expr => '$val / 10', # conversion of raw value to visible value + }, + "h258" => { reading => "Temp_Wasser_Aus", + name => "Pb2", + expr => '$val / 10', + }, + "h260" => { reading => "Temp_Verdampfer", + name => "Pb3", + expr => '$val / 10', + }, + "h262" => { reading => "Temp_Luft", + name => "Pb4", + expr => '$val / 10', + }, + "h770" => { reading => "Temp_Soll", + name => "ST03", + expr => '$val / 10', + setexpr => '$val * 10', # expression to convert a set value to the internal value + min => 10, # input validation for set: min value + max => 32, # input validation for set: max value + hint => "8,10,20,25,28,29,30,30.5,31,31.5,32", + set => 1, # this value can be set + }, + "h771" => { reading => "Hysterese", # Hex Adr 303 + name => "ST04", + expr => '$val / 10', + setexpr => '$val * 10', + poll => "once", # only poll once (or after a set) + min => 0.5, + max => 3, + set => 1, + }, + "h777" => { reading => "Hyst_Mode", # Hex Adr 0309 + name => "ST10", + map => "0:mittig, 1:oberhalb, 2:unterhalb", + poll => "once", # only poll once (or after a set) + set => 1, + }, + "h801" => { reading => "Temp_Wasser_Ein_Off", + name => "CF24", + expr => '$val / 10', + poll => 0, + setexpr => '$val * 10', + set => 1, + }, + "h802" => { reading => "Temp_Wasser_Aus_Off", + name => "CF25", + expr => '$val / 10', + poll => 0, + setexpr => '$val * 10', + set => 1, + }, + "h803" => { reading => "Temp_Verdampfer_Off", + name => "CF26", + expr => '$val / 10', + poll => 0, + setexpr => '$val * 10', + set => 1, + }, + "h804" => { reading => "Temp_Luft_Off", + name => "CF27", + expr => '$val / 10', + poll => 0, + setexpr => '$val * 10', + set => 1, + }, +); + + +my %SET10deviceInfo = ( + "timing" => { + timeout => 2, + commDelay => 0.7, + sendDelay => 0.7, + }, + "h" => { + combine => 5, + defShowGet => 1, + defPoll => 1, + defUnpack => "s>", + }, +); + + + +##################################### +sub +ModbusSET_Initialize($) +{ + my ($modHash) = @_; + + require "$attr{global}{modpath}/FHEM/98_Modbus.pm"; + + $modHash->{parseInfo} = \%SET10parseInfo; # defines registers, inputs, coils etc. for this Modbus Defive + + $modHash->{deviceInfo} = \%SET10deviceInfo; # defines properties of the device like + # defaults and supported function codes + + ModbusLD_Initialize($modHash); # Generic function of the Modbus module does the rest + + $modHash->{AttrList} = $modHash->{AttrList} . " " . # Standard Attributes like IODEv etc + $modHash->{ObjAttrList} . " " . # Attributes to add or overwrite parseInfo definitions + $modHash->{DevAttrList} . " " . # Attributes to add or overwrite devInfo definitions + "poll-.* " . # overwrite poll with poll-ReadingName + "polldelay-.* "; # overwrite polldelay with polldelay-ReadingName +} + + +1; + +=pod +=begin html + + +

ModbusSET

+ + +=end html +=cut