From ee0df484680ae2c6eaab3e121dc09d371a7efd2c Mon Sep 17 00:00:00 2001 From: tpoitzsch <> Date: Sat, 25 Jan 2014 12:21:18 +0000 Subject: [PATCH] LUXTRONIK2: Doku, currentOperatingStatus git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@4734 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/23_LUXTRONIK2.pm | 156 +++++++++++++++++++++++++----------------- 1 file changed, 93 insertions(+), 63 deletions(-) diff --git a/FHEM/23_LUXTRONIK2.pm b/FHEM/23_LUXTRONIK2.pm index aedfd6400..b65b4343b 100644 --- a/FHEM/23_LUXTRONIK2.pm +++ b/FHEM/23_LUXTRONIK2.pm @@ -1,4 +1,4 @@ -################################################################ +############################################################### # # Copyright notice # @@ -37,9 +37,13 @@ use Time::HiRes qw/ time /; use POSIX; use Net::Telnet; -my $cc; # The Itmes Changed Counter +#List of firmware versions that are known to be compatible with this modul + my $testedFirmware = "#V1.54C#"; + my $compatibleFirmware = "#V1.54C#"; -sub +#my $cc; # The Itmes Changed Counter + +sub ######################################## LUXTRONIK2_Initialize($) { my ($hash) = @_; @@ -56,7 +60,7 @@ LUXTRONIK2_Initialize($) $readingFnAttributes; } -sub +sub ######################################## LUXTRONIK2_Define($$) { my ($hash, $def) = @_; @@ -88,7 +92,7 @@ LUXTRONIK2_Define($$) return undef; } -sub +sub ######################################## LUXTRONIK2_Undefine($$) { my ($hash, $arg) = @_; @@ -100,7 +104,7 @@ LUXTRONIK2_Undefine($$) return undef; } -sub +sub ######################################## LUXTRONIK2_Set($$@) { my ($hash, $name, $cmd, $val) = @_; @@ -165,7 +169,7 @@ LUXTRONIK2_Set($$@) return "Unknown argument $cmd, choose one of $list"; } -sub +sub ######################################## LUXTRONIK2_Attr(@) { my ($cmd,$name,$aName,$aVal) = @_; @@ -184,7 +188,7 @@ LUXTRONIK2_Attr(@) return undef; } -sub +sub ######################################## LUXTRONIK2_GetUpdate($) { my ($hash) = @_; @@ -205,7 +209,7 @@ LUXTRONIK2_GetUpdate($) } -sub +sub ######################################## LUXTRONIK2_DoUpdate($) { my ($string) = @_; @@ -409,7 +413,7 @@ SKIP_VISIBILITY_READING: $return_str .= "|1"; # 2 - currentOperatingStatus1 $return_str .= "|".$heatpump_values[117]; - # 3 - currentOperatingStatus2 + # 3 - currentOperatingStatus3 $return_str .= "|".$heatpump_values[119]; # 4 - Stufe - Value 121 $return_str .= "|".$heatpump_values[121]; @@ -487,12 +491,18 @@ SKIP_VISIBILITY_READING: $return_str .= "|".$heatpump_values[61]; # 39 - operatingHoursSecondHeatSource3 $return_str .= "|".$heatpump_values[62]; + # 40 - currentOperatingStatus2 + $return_str .= "|".$heatpump_values[118]; + # 41 - durationOperatingStatus + $return_str .= "|".$heatpump_values[120]; + # 42 - timeError0 + $return_str .= "|".$heatpump_values[95]; return $return_str; } -sub +sub ######################################## LUXTRONIK2_UpdateDone($) { my ($string) = @_; @@ -573,22 +583,32 @@ LUXTRONIK2_UpdateDone($) $counterRetry = 0; readingsBeginUpdate($hash); - #Operating status of heatpump - my $currentOperatingStatus1 = $wpOpStat1{$a[2]}; + #Operating status of heat pump + my $currentOperatingStatus1 = $wpOpStat1{$a[2]}; ############## $currentOperatingStatus1 = "unbekannt (".$a[2].")" unless $currentOperatingStatus1; readingsBulkUpdate($hash,"currentOperatingStatus1",$currentOperatingStatus1); - my $currentOperatingStatus2 = $wpOpStat2{$a[3]}; - # refine text of second state + my $currentOperatingStatus2 = "unknown ($a[40])"; ############## + my $prefix = ""; + if ($a[40] == 0 || $a[40] == 2) { $prefix = "seit ";} + elsif ($a[40] == 1) { $prefix = "in ";} + if ($a[40] == 2) { #Sonderbehandlung bei WP-Fehlern + $currentOperatingStatus2 = $prefix . strftime "%d.%m.%Y %H:%M:%S", localtime($a[42]); + } else { + $currentOperatingStatus2 = $prefix . LUXTRONIK2_FormatDuration($a[41]); + } + readingsBulkUpdate($hash,"currentOperatingStatus2",$currentOperatingStatus2); + my $currentOperatingStatus3 = $wpOpStat2{$a[3]}; ############## + # refine text of third state if ($a[3]==6) { - $currentOperatingStatus2 = "Stufe ".$a[4]." ".LUXTRONIK2_CalcTemp($a[5])." °C "; + $currentOperatingStatus3 = "Stufe ".$a[4]." ".LUXTRONIK2_CalcTemp($a[5])." °C "; } elsif ($a[3]==7) { - if ($a[6]==1) {$currentOperatingStatus2 = "Abtauen (Kreisumkehr)";} - else {$currentOperatingStatus2 = "Luftabtauen";} + if ($a[6]==1) {$currentOperatingStatus3 = "Abtauen (Kreisumkehr)";} + else {$currentOperatingStatus3 = "Luftabtauen";} } - $currentOperatingStatus2 = "unbekannt (".$a[3].")" unless $currentOperatingStatus2; - readingsBulkUpdate($hash,"currentOperatingStatus2",$currentOperatingStatus2); - + $currentOperatingStatus3 = "unbekannt (".$a[3].")" unless $currentOperatingStatus3; + readingsBulkUpdate($hash,"currentOperatingStatus3",$currentOperatingStatus3); + # Hot water operating mode $value = $wpMode{$a[7]}; $value = "unbekannt (".$a[7].")" unless $value; @@ -671,21 +691,21 @@ LUXTRONIK2_UpdateDone($) if ($a[33]>0) {readingsBulkUpdate($hash,"operatingHoursHeatPump",floor($a[33]/360+0.5)/10);} if ($a[34]>0) {readingsBulkUpdate($hash,"operatingHoursHeating",floor($a[34]/360+0.5)/10);} if ($a[35]>0) {readingsBulkUpdate($hash,"operatingHoursHotWater",floor($a[35]/360+0.5)/10);} - if ($a[36]>0) {readingsBulkUpdate($hash,"heatQuantityHeating",$a[36]);} - if ($a[37]>0) {readingsBulkUpdate($hash,"heatQuantityHotWater",$a[37]);} + if ($a[36]>0) {readingsBulkUpdate($hash,"heatQuantityHeating",$a[36]/10);} + if ($a[37]>0) {readingsBulkUpdate($hash,"heatQuantityHotWater",$a[37]/10);} if ($a[38]>0) {readingsBulkUpdate($hash,"operatingHoursSecondHeatSource2",floor($a[38]/360+0.5)/10);} if ($a[39]>0) {readingsBulkUpdate($hash,"operatingHoursSecondHeatSource3",floor($a[39]/360+0.5)/10);} #HTML for floorplan if(AttrVal($name, "statusHTML", "none") ne "none") { $value = "
" . $a[0] . "
"; - $value .= $currentOperatingStatus1 . "
"; - $value .= $currentOperatingStatus2 . "
"; + $value .= "$currentOperatingStatus1 $currentOperatingStatus2
"; + $value .= $currentOperatingStatus3 . "
"; $value .= "Brauchwasser: " . $hotWaterTemperature . "°C"; readingsBulkUpdate($hash,"floorplanHTML",$value); } - readingsBulkUpdate($hash,"state",$currentOperatingStatus1." - ".$currentOperatingStatus2); + readingsBulkUpdate($hash,"state","$currentOperatingStatus1 $currentOperatingStatus2 - $currentOperatingStatus3"); readingsEndUpdate($hash,1); @@ -723,7 +743,7 @@ LUXTRONIK2_UpdateDone($) } -sub +sub ######################################## LUXTRONIK2_UpdateAborted($) { my ($hash) = @_; @@ -733,7 +753,7 @@ LUXTRONIK2_UpdateAborted($) } -sub +sub ######################################## LUXTRONIK2_CalcTemp($) { my ($temp) = @_; @@ -743,8 +763,20 @@ LUXTRONIK2_CalcTemp($) return $temp; } +sub ######################################## +LUXTRONIK2_FormatDuration($) +{ + my ($value) = @_; + my $returnstr = sprintf "%02d:", int($value/3600); + $value %= 3600; + $returnstr .= sprintf "%02d:", int($value/60); + $value %= 60; + $returnstr .= sprintf "%02d", $value; + + return $returnstr; +} -sub +sub ######################################## LUXTRONIK2_SetParameter($$$) { my ($hash, $parameterName, $realValue) = @_; @@ -833,7 +865,7 @@ LUXTRONIK2_SetParameter($$$) } -sub +sub ######################################## LUXTRONIK2_synchronizeClock (@) { my ($hash,$maxDelta) = @_; @@ -881,14 +913,10 @@ LUXTRONIK2_synchronizeClock (@) return $returnStr; } - -sub -LUXTRONIK2_checkFirmware ($) +sub ######################################## +LUXTRONIK2_checkFirmware ($) { my ($myFirmware) = @_; - #List of firmware versions that are known to be compatible with this modul - my $testedFirmware = "#V1.54C#"; - my $compatibleFirmware = "#V1.54C#"; #Firmware not tested if (index("#".$myFirmware."#",$testedFirmware) == -1) { @@ -910,9 +938,11 @@ LUXTRONIK2_checkFirmware ($)

LUXTRONIK2


@@ -938,7 +965,7 @@ LUXTRONIK2_checkFirmware ($)
  • <statusRequest> - Update device information
  • <synchClockHeatPump> - Synchronizes controller clock with FHEM time. This change is lost in case of controller power off!!
  • - +
    Get
    @@ -968,12 +995,14 @@ LUXTRONIK2_checkFirmware ($) =end html =begin html_DE +

    LUXTRONIK2