mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 12:58:13 +00:00
Maintainability approved acc. feedback of Oskar, returnTemperatureExtern added
git-svn-id: https://svn.fhem.de/fhem/trunk@1503 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
31d1cc9e8f
commit
efff0f35d3
@ -49,8 +49,9 @@ LUXTRONIK2_Define($$)
|
||||
return "Wrong syntax: use define <name> LUXTRONIK2 <ip-address> [<poll-interval>]" if(int(@a) <3 || int(@a) >4);
|
||||
$hash->{Host} = $a[2];
|
||||
$hash->{INTERVAL}=$a[3] || 300;
|
||||
|
||||
InternalTimer(gettimeofday() + $hash->{INTERVAL}, "LUXTRONIK2_GetStatus", $hash, 0);
|
||||
|
||||
#Get first data after 5 seconds
|
||||
InternalTimer(gettimeofday() + 5, "LUXTRONIK2_GetStatus", $hash, 0);
|
||||
|
||||
return undef;
|
||||
}
|
||||
@ -71,6 +72,7 @@ LUXTRONIK2_GetStatus($)
|
||||
my $name = $hash->{NAME};
|
||||
my $host = $hash->{Host};
|
||||
my $sensor = '';
|
||||
my $state = '';
|
||||
|
||||
InternalTimer(gettimeofday() + $hash->{INTERVAL}, "LUXTRONIK2_GetStatus", $hash, 0);
|
||||
|
||||
@ -83,7 +85,7 @@ LUXTRONIK2_GetStatus($)
|
||||
unless defined $socket;
|
||||
$socket->autoflush(1);
|
||||
|
||||
#Betriebswerte lesen
|
||||
#Read operational values
|
||||
|
||||
$socket->send(pack("l", 3004));
|
||||
$socket->send(pack("l", 0));
|
||||
@ -117,54 +119,92 @@ LUXTRONIK2_GetStatus($)
|
||||
|
||||
if($err_log ne "")
|
||||
{
|
||||
Log GetLogLevel($name,2), "LUXTRONIK2 ".$err_log;
|
||||
Log GetLogLevel($name,2), "LUXTRONIK2 ".$err_log;
|
||||
return("");
|
||||
}
|
||||
|
||||
|
||||
# Build string arrays
|
||||
my %wpOpStat1 = ( 0 => "Waermepumpe laeuft",
|
||||
1 => "Waermepumpe steht",
|
||||
2 => "Waermepumpe kommt",
|
||||
3 => "Fehler",
|
||||
4 => "Abtauen" );
|
||||
my %wpOpStat2 = ( 0 => "Heizbetrieb",
|
||||
1 => "Keine Anforderung",
|
||||
2 => "Netz Einschaltverzögerung",
|
||||
3 => "Schaltspielzeit",
|
||||
4 => "EVU Sperrzeit",
|
||||
5 => "Brauchwasser",
|
||||
6 => "Stufe",
|
||||
7 => "Abtauen",
|
||||
8 => "Pumpenvorlauf",
|
||||
9 => "Thermische Desinfektion",
|
||||
10 => "Kühlbetrieb",
|
||||
12 => "Schwimmbad",
|
||||
13 => "Heizen_Ext_En",
|
||||
14 => "Brauchw_Ext_En",
|
||||
16 => "Durchflussueberwachung",
|
||||
17 => "Elektrische Zusatzheizung" );
|
||||
my %wpMode = ( 0 => "Automatik",
|
||||
1 => "Zusatzheizung",
|
||||
2 => "Party",
|
||||
3 => "Ferien",
|
||||
4 => "Aus" );
|
||||
|
||||
# Erst die operativen Stati und Parameterenstellungen
|
||||
|
||||
$sensor = "currentOperatingStatus1";
|
||||
$switch = $heatpump_values[117];
|
||||
if ($switch==0) { $value = "Waermepumpe laeuft"; }
|
||||
elsif ($switch==1) { $value = "Waermepumpe steht"; }
|
||||
elsif ($switch==2) { $value = "Waermepumpe kommt"; }
|
||||
elsif ($switch==4) { $value = "Fehler"; }
|
||||
elsif ($switch==5) { $value = "Abtauen"; }
|
||||
else { $value = "unbekannt (".$switch.")"; }
|
||||
$value = $wpOpStat1{$switch};
|
||||
$value = "unbekannt (".$switch.")" unless $value;
|
||||
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
|
||||
my $state = $value;
|
||||
$state = $value;
|
||||
|
||||
$sensor = "currentOperatingStatus2";
|
||||
$switch = $heatpump_values[119];
|
||||
if ($switch==0) { $value = "Heizbetrieb"; }
|
||||
elsif ($switch==1) { $value = "Keine Anforderung"; }
|
||||
elsif ($switch==2) { $value = "Netz Einschaltverzögerung"; }
|
||||
elsif ($switch==3) { $value = "Schaltspielzeit"; }
|
||||
elsif ($switch==4) { $value = "EVU Sperrzeit"; }
|
||||
elsif ($switch==5) { $value = "Brauchwasser"; }
|
||||
elsif ($switch==6) { $value = "Stufe ".$heatpump_values[121]." ".($heatpump_values[122] / 10)." °C "; }
|
||||
elsif ($switch==7) {
|
||||
if ($heatpump_values[44]==1) {$value = "Abtauen (Kreisumkehr)";}
|
||||
else {$value = "Luftabtauen";}
|
||||
}
|
||||
elsif ($switch==8) { $value = "Pumpenvorlauf"; }
|
||||
elsif ($switch==9) { $value = "Thermische Desinfektion"; }
|
||||
elsif ($switch==10) { $value = "Kuhlbetrieb"; }
|
||||
elsif ($switch==12) { $value = "Schwimmbad"; }
|
||||
elsif ($switch==13) { $value = "Heizen_Ext_En"; }
|
||||
elsif ($switch==14) { $value = "Brauchw_Ext_En"; }
|
||||
elsif ($switch==15) { $value = "unbekannt"; }
|
||||
elsif ($switch==16) { $value = "Durchflussueberwachung"; }
|
||||
elsif ($switch==17) { $value = "Elektrische Zusatzheizung"; }
|
||||
else { $value = "unbekannt (".$switch.")"; }
|
||||
$value = $wpOpStat2{$switch};
|
||||
|
||||
# Special cases
|
||||
if ($switch==6) { $value = "Stufe ".$heatpump_values[121]." ".($heatpump_values[122] / 10)." °C "; }
|
||||
elsif ($switch==7) {
|
||||
if ($heatpump_values[44]==1) {$value = "Abtauen (Kreisumkehr)";}
|
||||
else {$value = "Luftabtauen";}
|
||||
}
|
||||
$value = "unbekannt (".$switch.")" unless $value;
|
||||
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
|
||||
$state = $state." - ".$value;
|
||||
$hash->{STATE} = $state;
|
||||
#$hash->{CHANGED}[0] = $state;
|
||||
|
||||
|
||||
$sensor = "hotWaterOperatingMode";
|
||||
$switch = $heatpump_parameters[4];
|
||||
|
||||
$value = $wpMode{$switch};
|
||||
if ($switch==0 && $heatpump_values[16]>=$heatpump_parameters[700] && $heatpump_parameters[699]==1) {$value = "Automatik - Sommerbetrieb (Aus)";}
|
||||
$value = "unbekannt (".$switch.")" unless $value;
|
||||
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
|
||||
|
||||
$sensor = "heatingOperatingMode";
|
||||
$switch = $heatpump_parameters[3];
|
||||
|
||||
$value = $wpMode{$switch};
|
||||
$value = "unbekannt (".$switch.")" unless $value;
|
||||
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
|
||||
#####################
|
||||
# Jetzt die aktuellen Betriebswerte auswerten.
|
||||
#####################
|
||||
|
||||
$sensor = "ambientTemperature";
|
||||
$value = $heatpump_values[15] / 10;
|
||||
@ -186,41 +226,8 @@ LUXTRONIK2_GetStatus($)
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
$hash->{CHANGED}[$i++] = "$sensor: $value";
|
||||
|
||||
$sensor = "hotWaterOperatingMode";
|
||||
$switch = $heatpump_parameters[4];
|
||||
|
||||
if ($switch==0) {
|
||||
if($heatpump_values[16]>=$heatpump_parameters[700] && $heatpump_parameters[699]==1) {
|
||||
$value = "Automatik - Sommerbetrieb (Aus)";
|
||||
} else {
|
||||
$value = "Automatik";
|
||||
}
|
||||
}
|
||||
elsif ($switch==1) { $value = "Zusatzheizung"; }
|
||||
elsif ($switch==2) { $value = "Party"; }
|
||||
elsif ($switch==3) { $value = "Ferien"; }
|
||||
elsif ($switch==4) { $value = "Aus"; }
|
||||
else { $value = "unbekannt (".$switch.")"; }
|
||||
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
|
||||
|
||||
$sensor = "heatingOperatingMode";
|
||||
$switch = $heatpump_parameters[3];
|
||||
|
||||
if ($switch==0) { $value = "Automatik"; }
|
||||
elsif ($switch==1) { $value = "Zusatzheizung"; }
|
||||
elsif ($switch==2) { $value = "Party"; }
|
||||
elsif ($switch==3) { $value = "Ferien"; }
|
||||
elsif ($switch==4) { $value = "Aus"; }
|
||||
else { $value = "unbekannt (".$switch.")"; }
|
||||
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
|
||||
$sensor = "inletTemperature";
|
||||
$sensor = "flowTemperature";
|
||||
$value = $heatpump_values[10] / 10;
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
@ -232,12 +239,19 @@ LUXTRONIK2_GetStatus($)
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
$hash->{CHANGED}[$i++] = "$sensor: $value";
|
||||
|
||||
$sensor = "returnTemperatureExtern";
|
||||
$value = $heatpump_values[13] / 10;
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
$hash->{CHANGED}[$i++] = "$sensor: $value";
|
||||
|
||||
$sensor = "returnTargetTemperature";
|
||||
$value = $heatpump_values[12] / 10;
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
$hash->{READINGS}{$sensor}{VAL} = $value;
|
||||
$hash->{CHANGED}[$i++] = "$sensor: $value";
|
||||
|
||||
# Durchfluss Wärmemengenzähler
|
||||
$sensor = "flowRate";
|
||||
$value = $heatpump_values[155];
|
||||
$hash->{READINGS}{$sensor}{TIME} = TimeNow();
|
||||
|
Loading…
x
Reference in New Issue
Block a user