mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-25 03:39:21 +00:00
FRITZBOX: bugfix undefined luaQuery
LUXTRONIK2: docu git-svn-id: https://svn.fhem.de/fhem/trunk@16448 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7628fcaa18
commit
4153d26910
@ -630,9 +630,9 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
LUXTRONIK2_Log $hash, 4, $string;
|
LUXTRONIK2_Log $hash, 4, $string;
|
||||||
|
|
||||||
#Define Status Messages
|
#Define Status Messages
|
||||||
my %wpOpStat1 = ( 0 => "Waermepumpe laeuft",
|
my %wpOpStat1 = ( 0 => "Wärmepumpe läuft",
|
||||||
1 => "Waermepumpe steht",
|
1 => "Wärmepumpe steht",
|
||||||
2 => "Waermepumpe kommt",
|
2 => "Wärmepumpe kommt",
|
||||||
4 => "Fehler",
|
4 => "Fehler",
|
||||||
5 => "Abtauen",
|
5 => "Abtauen",
|
||||||
6 => "Warte auf LIN-Verbindung",
|
6 => "Warte auf LIN-Verbindung",
|
||||||
@ -641,7 +641,7 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
|
|
||||||
my %wpOpStat2 = ( 0 => "Heizbetrieb",
|
my %wpOpStat2 = ( 0 => "Heizbetrieb",
|
||||||
1 => "Keine Anforderung",
|
1 => "Keine Anforderung",
|
||||||
2 => "Netz Einschaltverzoegerung",
|
2 => "Netz Einschaltverzögerung",
|
||||||
3 => "Schaltspielzeit",
|
3 => "Schaltspielzeit",
|
||||||
4 => "EVU Sperrzeit",
|
4 => "EVU Sperrzeit",
|
||||||
5 => "Brauchwasser",
|
5 => "Brauchwasser",
|
||||||
@ -649,11 +649,11 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
7 => "Abtauen",
|
7 => "Abtauen",
|
||||||
8 => "Pumpenvorlauf",
|
8 => "Pumpenvorlauf",
|
||||||
9 => "Thermische Desinfektion",
|
9 => "Thermische Desinfektion",
|
||||||
10 => "Kuehlbetrieb",
|
10 => "Kühlbetrieb",
|
||||||
12 => "Schwimmbad/Photovoltaik",
|
12 => "Schwimmbad/Photovoltaik",
|
||||||
13 => "Heizen_Ext_En",
|
13 => "Heizen_Ext_En",
|
||||||
14 => "Brauchw_Ext_En",
|
14 => "Brauchw_Ext_En",
|
||||||
16 => "Durchflussueberwachung",
|
16 => "Durchflussüberwachung",
|
||||||
17 => "Elektrische Zusatzheizung" );
|
17 => "Elektrische Zusatzheizung" );
|
||||||
|
|
||||||
my %wpMode = ( 0 => "Automatik",
|
my %wpMode = ( 0 => "Automatik",
|
||||||
@ -726,7 +726,7 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
readingsSingleUpdate($hash,"state","Error: Reading skipped after $counterRetry tries",1);
|
readingsSingleUpdate($hash,"state","Error: Reading skipped after $counterRetry tries",1);
|
||||||
LUXTRONIK2_Log $hash, 2, "Device reading skipped after $counterRetry tries with parameter change on target";
|
LUXTRONIK2_Log $hash, 2, "Device readout skipped after $counterRetry tries with parameter change on target";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Update readings
|
# Update readings
|
||||||
@ -766,17 +766,17 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
my $heatPumpPower = 0;
|
my $heatPumpPower = 0;
|
||||||
my $heatRodPower = AttrVal($name, "heatRodElectricalPowerWatt", 0);
|
my $heatRodPower = AttrVal($name, "heatRodElectricalPowerWatt", 0);
|
||||||
|
|
||||||
#WM[kW] = delta_Temp [K] * Durchfluss [l/h] / ( 3.600 [kJ/kWh] / ( 4,179 [kJ/(kg*K)] (H2O Wärmekapazität bei 30 & 40°C) * 0,994 [kg/l] (H2O Dichte bei 35°C) )
|
#WM[kW] = delta_Temp [K] * Durchfluss [l/h] / ( 3.600 [kJ/kWh] / ( 4,179 [kJ/(kg*K)] (H2O Wärmekapazität bei 30 & 40°C) * 0,994 [kg/l] (H2O Dichte bei 35°C) )
|
||||||
my $thermalPower = 0;
|
my $thermalPower = 0;
|
||||||
# 0=Heizen, 5=Brauchwasser, 7=Abtauen, 16=Durchflussüberwachung
|
# 0=Heizen, 5=Brauchwasser, 7=Abtauen, 16=Durchflussüberwachung
|
||||||
if ($opStateHeatPump3 =~ /^(0|5|16)$/) {
|
if ($opStateHeatPump3 =~ /^(0|5|16)$/) {
|
||||||
if ($flowRate !~ /no|inconsistent/) { $thermalPower = abs($flowTemperature - $returnTemperature) * $flowRate / 866.65; } #Nur bei Wärmezählern
|
if ($flowRate !~ /no|inconsistent/) { $thermalPower = abs($flowTemperature - $returnTemperature) * $flowRate / 866.65; } #Nur bei Wärmezählern
|
||||||
$heatPumpPower = AttrVal($name, "heatPumpElectricalPowerWatt", -1);
|
$heatPumpPower = AttrVal($name, "heatPumpElectricalPowerWatt", -1);
|
||||||
$heatPumpPower *= (1 + ($flowTemperature-35) * AttrVal($name, "heatPumpElectricalPowerFactor", 0));
|
$heatPumpPower *= (1 + ($flowTemperature-35) * AttrVal($name, "heatPumpElectricalPowerFactor", 0));
|
||||||
}
|
}
|
||||||
if ($flowRate !~ /no|inconsistent/) { readingsBulkUpdate( $hash, "thermalPower", sprintf "%.1f", $thermalPower); } #Nur bei Wärmezählern
|
if ($flowRate !~ /no|inconsistent/) { readingsBulkUpdate( $hash, "thermalPower", sprintf "%.1f", $thermalPower); } #Nur bei Wärmezählern
|
||||||
if ($heatPumpPower >-1 ) { readingsBulkUpdate( $hash, "heatPumpElectricalPowerEstimated", sprintf "%.0f", $heatPumpPower); }
|
if ($heatPumpPower >-1 ) { readingsBulkUpdate( $hash, "heatPumpElectricalPowerEstimated", sprintf "%.0f", $heatPumpPower); }
|
||||||
if ($heatPumpPower > 0 && $flowRate !~ /no|inconsistent/) { #Nur bei Wärmezählern
|
if ($heatPumpPower > 0 && $flowRate !~ /no|inconsistent/) { #Nur bei Wärmezählern
|
||||||
$cop = $thermalPower * 1000 / $heatPumpPower;
|
$cop = $thermalPower * 1000 / $heatPumpPower;
|
||||||
readingsBulkUpdate( $hash, "COP", sprintf "%.2f", $cop);
|
readingsBulkUpdate( $hash, "COP", sprintf "%.2f", $cop);
|
||||||
}
|
}
|
||||||
@ -869,28 +869,30 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
# Heating operating state
|
# Heating operating state
|
||||||
# Consider also heating limit
|
# Consider also heating limit
|
||||||
if ($a[10] == 0 && $a[11] == 1
|
if ($a[10] == 0 && $a[11] == 1
|
||||||
&& $averageAmbientTemperature >= $thresholdHeatingLimit
|
&& $averageAmbientTemperature >= $thresholdHeatingLimit
|
||||||
&& ($returnTemperatureTarget eq $returnTemperatureTargetMin || $returnTemperatureTarget == 20 && $ambientTemperature<10)
|
&& ($returnTemperatureTarget eq $returnTemperatureTargetMin || $returnTemperatureTarget == 20 && $ambientTemperature<10)
|
||||||
) {
|
) {
|
||||||
if ($ambientTemperature>=10 ) {
|
if ($ambientTemperature>=10 ) {
|
||||||
$value = "Heizgrenze (Soll ".$returnTemperatureTargetMin." C)";
|
$value = "Heizgrenze (Soll ".$returnTemperatureTargetMin."°C)";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$value = "Frostschutz (Soll 20 C)";
|
$value = "Frostschutz (Soll 20°C)";
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$value = $heatingState{$a[46]};
|
$value = $heatingState{$a[46]};
|
||||||
$value = "unbekannt (".$a[46].")" unless $value;
|
$value = "unbekannt (".$a[46].")" unless $value;
|
||||||
# Consider heating reduction limit
|
# Consider heating reduction limit
|
||||||
if ($a[46] == 0) {
|
if ($a[46] == 0) {
|
||||||
if ($thresholdTemperatureSetBack <= $ambientTemperature) {
|
if ($thresholdTemperatureSetBack <= $ambientTemperature) {
|
||||||
$value .= " ".LUXTRONIK2_CalcTemp($a[47])." C"; #° ° ° °
|
$value .= " ".LUXTRONIK2_CalcTemp($a[47])."°C"; #° ° ° °
|
||||||
} else {
|
}
|
||||||
$value = "Normal da < ".$thresholdTemperatureSetBack." C";
|
else {
|
||||||
|
$value = "Normal da < ".$thresholdTemperatureSetBack."°C";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
readingsBulkUpdate($hash,"opStateHeating",$value);
|
readingsBulkUpdate($hash,"opStateHeating",$value);
|
||||||
|
|
||||||
# Ventilation operating mode
|
# Ventilation operating mode
|
||||||
if ( $a[79] !~ /no/ ) {
|
if ( $a[79] !~ /no/ ) {
|
||||||
@ -913,7 +915,7 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
$hash->{fhem}{defrost}{hsIn} = $heatSourceIN;
|
$hash->{fhem}{defrost}{hsIn} = $heatSourceIN;
|
||||||
$hash->{fhem}{defrost}{hsOut} = $heatSourceOUT;
|
$hash->{fhem}{defrost}{hsOut} = $heatSourceOUT;
|
||||||
}
|
}
|
||||||
# Defrost-Readings erstellen
|
# Defrost-Readings creation
|
||||||
elsif ( $hash->{fhem}{defrost}{mode} ne "none" ) {
|
elsif ( $hash->{fhem}{defrost}{mode} ne "none" ) {
|
||||||
my $value = "Mode: " . $hash->{fhem}{defrost}{mode} . " Time: ";
|
my $value = "Mode: " . $hash->{fhem}{defrost}{mode} . " Time: ";
|
||||||
$value .= strftime ( "%M:%S", localtime( time() - $hash->{fhem}{defrost}{startTime} ) );
|
$value .= strftime ( "%M:%S", localtime( time() - $hash->{fhem}{defrost}{startTime} ) );
|
||||||
@ -931,7 +933,7 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
|
|
||||||
$hash->{fhem}{defrost}{mode} = "none";
|
$hash->{fhem}{defrost}{mode} = "none";
|
||||||
|
|
||||||
# 16 => "Durchflussueberwachung"
|
# 16 => "Durchflussüberwachung"
|
||||||
if ($opStateHeatPump3 == 16) {
|
if ($opStateHeatPump3 == 16) {
|
||||||
readingsBulkUpdate( $hash, "heatSourceDefrostLastTimeout", "Amb: ".$hash->{fhem}{defrost}{amb}." hsIN: ".$hash->{fhem}{defrost}{hsIn}." hsOUT: ".$hash->{fhem}{defrost}{hsOut});
|
readingsBulkUpdate( $hash, "heatSourceDefrostLastTimeout", "Amb: ".$hash->{fhem}{defrost}{amb}." hsIN: ".$hash->{fhem}{defrost}{hsIn}." hsOUT: ".$hash->{fhem}{defrost}{hsOut});
|
||||||
}
|
}
|
||||||
@ -1040,10 +1042,10 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
my $firmware = $a[20];
|
my $firmware = $a[20];
|
||||||
readingsBulkUpdate($hash,"firmware",$firmware);
|
readingsBulkUpdate($hash,"firmware",$firmware);
|
||||||
my $firmwareCheck = LUXTRONIK2_checkFirmware($firmware);
|
my $firmwareCheck = LUXTRONIK2_checkFirmware($firmware);
|
||||||
# if unknown firmware, ask at each startup to inform comunity
|
# if unknown firmware, ask at each startup to inform community
|
||||||
if ($hash->{fhem}{alertFirmware} != 1 && $firmwareCheck eq "fwNotTested") {
|
if ($hash->{fhem}{alertFirmware} != 1 && $firmwareCheck eq "fwNotTested") {
|
||||||
$hash->{fhem}{alertFirmware} = 1;
|
$hash->{fhem}{alertFirmware} = 1;
|
||||||
LUXTRONIK2_Log $hash, 2, "Alert: Host uses untested Firmware '$a[20]'. Please inform FHEM comunity about compatibility.";
|
LUXTRONIK2_Log $hash, 2, "Alert: Host uses untested Firmware '$a[20]'. Please inform FHEM community about compatibility.";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Type of Heatpump
|
# Type of Heatpump
|
||||||
@ -1064,7 +1066,7 @@ LUXTRONIK2_UpdateDone($)
|
|||||||
$value .= "$opStateHeatPump1<br>\n";
|
$value .= "$opStateHeatPump1<br>\n";
|
||||||
$value .= "$opStateHeatPump2<br>\n";
|
$value .= "$opStateHeatPump2<br>\n";
|
||||||
$value .= "$opStateHeatPump3Txt<br>\n";
|
$value .= "$opStateHeatPump3Txt<br>\n";
|
||||||
$value .= "Brauchwasser: ".$hotWaterTemperature."°C";
|
$value .= "Brauchwasser: ".$hotWaterTemperature."°C";
|
||||||
readingsBulkUpdate($hash,"floorplanHTML",$value);
|
readingsBulkUpdate($hash,"floorplanHTML",$value);
|
||||||
}
|
}
|
||||||
# State update
|
# State update
|
||||||
@ -1719,7 +1721,7 @@ LUXTRONIK2_doStatisticThermalPower ($$$$$$$$$)
|
|||||||
$last[6] = $targetTemp;
|
$last[6] = $targetTemp;
|
||||||
$last[7] = $electricalPower;
|
$last[7] = $electricalPower;
|
||||||
|
|
||||||
} elsif ($last[0] == $MonitoredOpState && ($currOpState == $MonitoredOpState || $currOpState == 16) ) { #16=Durchflussüberwachung
|
} elsif ($last[0] == $MonitoredOpState && ($currOpState == $MonitoredOpState || $currOpState == 16) ) { #16=Durchflussüberwachung
|
||||||
# Store intermediate values as long as the correct opMode runs
|
# Store intermediate values as long as the correct opMode runs
|
||||||
$save = 1;
|
$save = 1;
|
||||||
$last[3] += $currAmbTemp;
|
$last[3] += $currAmbTemp;
|
||||||
@ -1727,7 +1729,7 @@ LUXTRONIK2_doStatisticThermalPower ($$$$$$$$$)
|
|||||||
$last[5]++;
|
$last[5]++;
|
||||||
$last[7] += $electricalPower;
|
$last[7] += $electricalPower;
|
||||||
|
|
||||||
} elsif ($last[0] == $MonitoredOpState && $currOpState != $MonitoredOpState && $currOpState != 16 ) { #16=Durchflussüberwachung
|
} elsif ($last[0] == $MonitoredOpState && $currOpState != $MonitoredOpState && $currOpState != 16 ) { #16=Durchflussüberwachung
|
||||||
# Do statistics at the end of the monitored operation if it run at least 9.5 minutes
|
# Do statistics at the end of the monitored operation if it run at least 9.5 minutes
|
||||||
$save = 1;
|
$save = 1;
|
||||||
$last[0] = $currOpState;
|
$last[0] = $currOpState;
|
||||||
|
@ -584,8 +584,15 @@ sub FRITZBOX_Get($@)
|
|||||||
my $result = FRITZBOX_Web_Query( $hash, $queryStr) ;
|
my $result = FRITZBOX_Web_Query( $hash, $queryStr) ;
|
||||||
|
|
||||||
my $tmp;
|
my $tmp;
|
||||||
if (ref $result->{result} eq "") { $tmp = $result->{result}; }
|
if (defined $result->{Error} ) {
|
||||||
else { $tmp = Dumper ($result->{result}); }
|
$tmp = "ERROR:\n".Dumper ($result->{Error});
|
||||||
|
}
|
||||||
|
elsif (ref $result->{result} ) {
|
||||||
|
$tmp = Dumper ($result->{result} );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$tmp = "Unexpected result: " . Dumper ($result);
|
||||||
|
}
|
||||||
return $returnStr . $tmp;
|
return $returnStr . $tmp;
|
||||||
}
|
}
|
||||||
elsif( lc $cmd eq "ringtones" ) {
|
elsif( lc $cmd eq "ringtones" ) {
|
||||||
@ -4637,16 +4644,24 @@ sub FRITZBOX_Web_Query($$@)
|
|||||||
return \%retHash;
|
return \%retHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($response->content =~ /<html>|"pid": "logout"/) {
|
my $jsonText = $response->content;
|
||||||
|
|
||||||
|
if ($jsonText =~ /<html>|"pid": "logout"/) {
|
||||||
my %retHash = ("Error" => "Old SID not valid anymore.", "ResetSID" => "1");
|
my %retHash = ("Error" => "Old SID not valid anymore.", "ResetSID" => "1");
|
||||||
return \%retHash;
|
return \%retHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $jsonText !~ /{"/ ) {
|
||||||
|
chop $jsonText;
|
||||||
|
my %retHash = ("Error" => "no json string returned (".$jsonText.")", "ResetSID" => "1");
|
||||||
|
return \%retHash;
|
||||||
|
}
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# FRITZBOX_Log $hash, 3, "Response: ".$response->content;
|
#FRITZBOX_Log $hash, 3, "Response: ".$response->content;
|
||||||
#################
|
#################
|
||||||
|
|
||||||
my $jsonText = $response->content;
|
|
||||||
# Remove illegal escape sequences
|
# Remove illegal escape sequences
|
||||||
$jsonText =~ s/\\'/'/g; #Hochkomma
|
$jsonText =~ s/\\'/'/g; #Hochkomma
|
||||||
$jsonText =~ s/\\x\{[0-9a-f]\}//g; #delete control codes (as hex numbers)
|
$jsonText =~ s/\\x\{[0-9a-f]\}//g; #delete control codes (as hex numbers)
|
||||||
@ -4659,6 +4674,8 @@ sub FRITZBOX_Web_Query($$@)
|
|||||||
else {
|
else {
|
||||||
$jsonResult = JSON->new->latin1->decode( $jsonText );
|
$jsonResult = JSON->new->latin1->decode( $jsonText );
|
||||||
}
|
}
|
||||||
|
#Not a HASH reference at ./FHEM/72_FRITZBOX.pm line 4662.
|
||||||
|
# 2018.03.19 18:43:28 3: FRITZBOX: get Fritzbox luaQuery settings/sip
|
||||||
$jsonResult->{sid} = $sid;
|
$jsonResult->{sid} = $sid;
|
||||||
$jsonResult->{Error} = $jsonResult->{error} if defined $jsonResult->{error};
|
$jsonResult->{Error} = $jsonResult->{error} if defined $jsonResult->{error};
|
||||||
return $jsonResult;
|
return $jsonResult;
|
||||||
@ -4815,7 +4832,7 @@ sub FRITZBOX_fritztris($)
|
|||||||
|
|
||||||
=pod
|
=pod
|
||||||
=item device
|
=item device
|
||||||
=item summary Controls some features of AVM's Fritz!Box router and repeater and Fritz!Fon.
|
=item summary Controls some features of AVM's Fritz!Box, FRITZ!Repeater and Fritz!Fon.
|
||||||
=item summary_DE Steuert einige Funktionen von AVM's Fritz!Box, Fritz!Repeater und Fritz!Fon.
|
=item summary_DE Steuert einige Funktionen von AVM's Fritz!Box, Fritz!Repeater und Fritz!Fon.
|
||||||
|
|
||||||
=begin html
|
=begin html
|
||||||
|
Loading…
x
Reference in New Issue
Block a user