From e0950429aebc2e7697edd9c70cead017e3cbd9ae Mon Sep 17 00:00:00 2001
From: tpoitzsch <>
Date: Sat, 1 Aug 2015 17:39:24 +0000
Subject: [PATCH] FRITZBOX: boxUser for lua,query
git-svn-id: https://svn.fhem.de/fhem/trunk@9009 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/72_FRITZBOX.pm | 40 ++++++++++++++++++++++++++++------------
1 file changed, 28 insertions(+), 12 deletions(-)
diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm
index 44f650f67..d0361bdb3 100644
--- a/fhem/FHEM/72_FRITZBOX.pm
+++ b/fhem/FHEM/72_FRITZBOX.pm
@@ -1450,7 +1450,7 @@ sub FRITZBOX_Readout_Process($$)
# Fill all handed over readings
my $x = 0;
while (my ($rName, $rValue) = each(%values) ) {
- #hash value
+ #hash values
if ($rName =~ /->/) {
# 3 levels
my ($rName1,$rName2,$rName3) = split /->/, $rName;
@@ -1487,22 +1487,25 @@ sub FRITZBOX_Readout_Process($$)
}
}
+ # Create state with wlan state
if ( defined $values{"box_wlan_2.4GHz"} ) {
my $newState = "WLAN: ";
if ( $values{"box_wlan_2.4GHz"} eq "on" ) {
$newState .= "on";
- } elsif ( $values{box_wlan_5GHz} ) {
+ }
+ elsif ( $values{box_wlan_5GHz} ) {
if ( $values{box_wlan_5GHz} eq "on") {
$newState .= "on";
} else {
$newState .= "off";
}
- } else {
+ }
+ else {
$newState .= "off";
}
$newState .=" gWLAN: ".$values{box_guestWlan} ;
$newState .=" (Remain: ".$values{box_guestWlanRemain}." min)"
- if $values{box_guestWlan} eq "on" && $values{box_guestWlanRemain} != 0;
+ if $values{box_guestWlan} eq "on" && $values{box_guestWlanRemain} > 0;
readingsBulkUpdate( $hash, "state", $newState);
FRITZBOX_Log $hash, 5, "SET state = '$newState'";
}
@@ -4096,7 +4099,8 @@ sub FRITZBOX_Web_OpenCon ($)
FRITZBOX_Log $hash, 2, "Error: No password set. Please define it with 'set $name password YourPassword'";
return undef;
}
- my $user = AttrVal( $name, "telnetUser", "" );
+ my $user = AttrVal( $name, "boxUser", "" );
+ $user = AttrVal( $name, "telnetUser", "" ) if $user eq "";
FRITZBOX_Log $hash, 4, "Open Web connection to $host";
$sid = (FB_doCheckPW($host, $user, $pwd));
@@ -4427,7 +4431,7 @@ sub FRITZBOX_fritztris($)
The modul switches in local mode if FHEM runs on a Fritz!Box (as root user!). Otherwise, it tries to open a web or telnet connection to "fritz.box", so telnet (#96*7*) has to be enabled on the Fritz!Box. For remote access the password must once be set.
- The box is partly controlled via the official TR-064 interface but also via undocumented interfaces between web interface and firmware kernel. The modul works best with Fritz!OS 6.24. AVM has removed internal interfaces from later Fritz!OS versions without replacement. For these versions, some modul functions are hence restricted or do not work at all.
+ The box is partly controlled via the official TR-064 interface but also via undocumented interfaces between web interface and firmware kernel. The modul works best with Fritz!OS 6.24. AVM has removed internal interfaces from later Fritz!OS versions without replacement. For these versions, some modul functions are hence restricted or do not work at all (see remarks to required API).
The modul was tested on Fritz!Box 7390 and 7490 with Fritz!OS 6.20 and higher.
@@ -4456,6 +4460,8 @@ sub FRITZBOX_fritztris($)
set <name> alarm <number> [on|off] [time] [once|daily|Mo|Tu|We|Th|Fr|Sa|So]
set <name> call <number> [duration] [say:text|play:MP3URL]
@@ -4474,13 +4480,13 @@ sub FRITZBOX_fritztris($)
set <name> dect <on|off>
set <name> diversity <number> <on|off>
set <name> startRadio <internalNumber> [name or number]
@@ -4612,7 +4620,7 @@ sub FRITZBOX_fritztris($)
boxUser <user name>
set <name> alarm <Nummer> [on|off] [time] [once|daily|Mo|Tu|We|Th|Fr|Sa|So]
set <name> call <number> [Dauer] [say:Text|play:MP3URL]
@@ -4805,13 +4816,15 @@ sub FRITZBOX_fritztris($)
set <name> dect <on|off>
set <name> diversity <number> <on|off>
set <name> startRadio <internalNumber> [Name oder Nummer]
@@ -4940,7 +4955,7 @@ sub FRITZBOX_fritztris($)
boxUser <user name>