correction for negative values

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@2310 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
oskarfessel 2012-12-09 18:08:43 +00:00
parent e0c62793e1
commit 7b282904d9
2 changed files with 20 additions and 15 deletions

View File

@ -142,7 +142,7 @@ LUXTRONIK2_GetStatus($)
Log 1, "LUXTRONIK2_GetStatus status report length check: $name $host ".length($result)." should have been ". $count * 4; Log 1, "LUXTRONIK2_GetStatus status report length check: $name $host ".length($result)." should have been ". $count * 4;
return "Value read mismatch Lux2 ( $!)\n"; return "Value read mismatch Lux2 ( $!)\n";
} }
@heatpump_values = unpack("N$count", $result); @heatpump_values = unpack("N!$count", $result);
if(scalar(@heatpump_values) != $count) { if(scalar(@heatpump_values) != $count) {
Log 2, "LUXTRONIK2_GetStatus10: $name $host ".scalar(@heatpump_values)." -> ".$heatpump_values[10]; Log 2, "LUXTRONIK2_GetStatus10: $name $host ".scalar(@heatpump_values)." -> ".$heatpump_values[10];
return "Value unpacking problem"; return "Value unpacking problem";
@ -165,17 +165,19 @@ LUXTRONIK2_GetStatus($)
$socket->recv($result, $count*4+4); $socket->recv($result, $count*4+4);
if(length($result) != $count*4) { if(length($result) != $count*4) {
Log 3, "LUXTRONIK2_GetStatus parameter settings length check: $name $host "
. length($result) . " should have been " . $count * 4;
my $loop = 4; # safety net in case of communication problems my $loop = 4; # safety net in case of communication problems
while((length($result) < ($count * 4)) && ($loop-- > 0) ) { while((length($result) < ($count * 4)) && ($loop-- > 0) ) {
my $result2; my $result2;
my $newcnt = ($count * 4) - length($result); my $newcnt = ($count * 4) - length($result);
$socket->recv($result2, $newcnt); $socket->recv($result2, $newcnt);
$result .= $result2; $result .= $result2;
Log 3, "LUXTRONIK2_GetStatus read additional " . length($result2) # Log 3, "LUXTRONIK2_GetStatus read additional " . length($result2)
. " bytes of expected " . $newcnt . " bytes, total should be " # . " bytes of expected " . $newcnt . " bytes, total should be "
. $count * 4 . " buflen=" . length($result); # . $count * 4 . " buflen=" . length($result);
}
if($loop == 0) {
Log 3, "LUXTRONIK2_GetStatus parameter settings length check: $name $host "
. length($result) . " should have been " . $count * 4;
} }
} }
@heatpump_parameters = unpack("N$count", $result); @heatpump_parameters = unpack("N$count", $result);

View File

@ -20,14 +20,17 @@ set ylabel "Temperature in C"
#FileLog 4:flowTemperature:0: #FileLog 4:flowTemperature:0:
#FileLog 4:returnTemperatureTarget:0: #FileLog 4:returnTemperatureTarget:0:
#FileLog 4:returnTemperature:0: #FileLog 4:returnTemperature:0:
#FileLog 4:ambientTemperature:0:int #FileLog 4:ambientTemperature:0:
#FileLog 4:averageAmbientTemperature:0:
plot \ plot \
"< awk '/temperature/{print $1, $4}' <IN>"\ "< awk '/flowTemperature/{print $1, $4}' <IN>"\
using 1:2 axes x1y2 title 'Vorlauftemperatur' with lines,\ using 1:2 axes x1y1 title 'Vorlauftemperatur' with lines,\
"< awk '/desired/{print $1, $4}' <IN>"\ "< awk '/returnTemperatureTarget/{print $1, $4}' <IN>"\
using 1:2 axes x1y2 title 'Rücklauftemperatur SOLL' with lines,\ using 1:2 axes x1y1 title 'Rücklauftemperatur SOLL' with lines,\
"< awk '/humidity/ {print $1, $4+0}' <IN>"\ "< awk '/returnTemperature/ {print $1, $4+0}' <IN>"\
using 1:2 axes x1y2 title 'Rücklauftemperatur' with lines,\ using 1:2 axes x1y1 title 'Rücklauftemperatur' with lines,\
"< awk '/actuator/ {print $1, $4+0}' <IN>"\ "< awk '/ambientTemperature/ {print $1, $4+0}' <IN>"\
using 1:2 axes x1y2 title 'Außentemperatur' with lines lw2\ using 1:2 axes x1y1 title 'Außentemperatur' with lines lw2,\
"< awk '/averageAmbient/ {print $1, $4+0}' <IN>"\
using 1:2 axes x1y1 title 'durchschnittliche Außentemperatur' with lines lw2\