mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 07:19:24 +00:00
FRITZBOX: New attribute fritzBoxIP, Bugfix "no TAM"
git-svn-id: https://svn.fhem.de/fhem/trunk@7170 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
16be2ac1e0
commit
2a914130bf
@ -135,6 +135,7 @@ sub FRITZBOX_Initialize($)
|
|||||||
$hash->{AttrList} = "disable:0,1 "
|
$hash->{AttrList} = "disable:0,1 "
|
||||||
."defaultCallerName "
|
."defaultCallerName "
|
||||||
."defaultUploadDir "
|
."defaultUploadDir "
|
||||||
|
."fritzBoxIP "
|
||||||
."INTERVAL "
|
."INTERVAL "
|
||||||
."ringWithIntern:0,1,2 "
|
."ringWithIntern:0,1,2 "
|
||||||
."telnetUser "
|
."telnetUser "
|
||||||
@ -157,10 +158,10 @@ sub FRITZBOX_Define($$)
|
|||||||
|
|
||||||
my $msg;
|
my $msg;
|
||||||
|
|
||||||
|
# unless (qx ( [ -f /usr/bin/ctlmgr_ctl ] && echo 1 || echo 0 ))
|
||||||
unless ( -X "/usr/bin/ctlmgr_ctl" )
|
unless ( -X "/usr/bin/ctlmgr_ctl" )
|
||||||
{
|
{
|
||||||
$hash->{REMOTE} = 1;
|
$hash->{REMOTE} = 1;
|
||||||
$hash->{HOST} = "fritz.box";
|
|
||||||
FRITZBOX_Log $hash, 4, "FRITZBOX runs in remote mode";
|
FRITZBOX_Log $hash, 4, "FRITZBOX runs in remote mode";
|
||||||
}
|
}
|
||||||
elsif ( $< != 0 )
|
elsif ( $< != 0 )
|
||||||
@ -219,6 +220,14 @@ FRITZBOX_Attr($@)
|
|||||||
|
|
||||||
if ($cmd eq "set")
|
if ($cmd eq "set")
|
||||||
{
|
{
|
||||||
|
if ($aName eq "fritzBoxIP" && $aVal ne "")
|
||||||
|
{
|
||||||
|
if ($hash->{REMOTE} == 0)
|
||||||
|
{
|
||||||
|
$hash->{REMOTE} = 1;
|
||||||
|
FRITZBOX_Log $hash, 3, "Changed to remote access because attribute 'fritzBoxIP' is defined.";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
@ -445,7 +454,7 @@ FRITZBOX_Readout_Run($)
|
|||||||
push @readoutArray, ["", "ctlmgr_ctl r tam settings/TAM/count" ];
|
push @readoutArray, ["", "ctlmgr_ctl r tam settings/TAM/count" ];
|
||||||
|
|
||||||
# Box model and firmware
|
# Box model and firmware
|
||||||
push @readoutArray, [ "box_model", 'echo $CONFIG_PRODUKT', "nounderline" ];
|
push @readoutArray, [ "box_model", 'echo $CONFIG_PRODUKT_NAME' ];
|
||||||
push @readoutArray, [ "box_fwVersion", "ctlmgr_ctl r logic status/nspver", "fwupdate" ];
|
push @readoutArray, [ "box_fwVersion", "ctlmgr_ctl r logic status/nspver", "fwupdate" ];
|
||||||
$resultArray = FRITZBOX_Readout_Query( $hash, \@readoutArray, \@readoutReadings);
|
$resultArray = FRITZBOX_Readout_Query( $hash, \@readoutArray, \@readoutReadings);
|
||||||
|
|
||||||
@ -573,7 +582,7 @@ FRITZBOX_Readout_Run($)
|
|||||||
for (0..$tamCount-1)
|
for (0..$tamCount-1)
|
||||||
{
|
{
|
||||||
$rName = "tam".($_+1);
|
$rName = "tam".($_+1);
|
||||||
if ( $resultArray->[$_] == 1 || defined $hash->{READINGS}{$rName} )
|
if ($resultArray->[$_] == 1 || defined $hash->{READINGS}{$rName} )
|
||||||
{
|
{
|
||||||
push @readoutArray, [ $rName, "ctlmgr_ctl r tam settings/TAM". $_ ."/Name" ];
|
push @readoutArray, [ $rName, "ctlmgr_ctl r tam settings/TAM". $_ ."/Name" ];
|
||||||
push @readoutArray, [ $rName."_state", "ctlmgr_ctl r tam settings/TAM".$_."/Active", "onoff" ];
|
push @readoutArray, [ $rName."_state", "ctlmgr_ctl r tam settings/TAM".$_."/Active", "onoff" ];
|
||||||
@ -601,7 +610,7 @@ FRITZBOX_Readout_Run($)
|
|||||||
}
|
}
|
||||||
|
|
||||||
# WLAN
|
# WLAN
|
||||||
push @readoutArray, [ "box_wlan_2GHz", "ctlmgr_ctl r wlan settings/ap_enabled", "onoff" ];
|
push @readoutArray, [ "box_wlan_2.4GHz", "ctlmgr_ctl r wlan settings/ap_enabled", "onoff" ];
|
||||||
# 2nd WLAN
|
# 2nd WLAN
|
||||||
push @readoutArray, [ "box_wlan_5GHz", "ctlmgr_ctl r wlan settings/ap_enabled_scnd", "onoff" ];
|
push @readoutArray, [ "box_wlan_5GHz", "ctlmgr_ctl r wlan settings/ap_enabled_scnd", "onoff" ];
|
||||||
# Gäste WLAN
|
# Gäste WLAN
|
||||||
@ -702,8 +711,8 @@ FRITZBOX_Readout_Aborted($)
|
|||||||
FRITZBOX_Log $hash, 1, "Timeout when reading Fritz!Box data.";
|
FRITZBOX_Log $hash, 1, "Timeout when reading Fritz!Box data.";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub ##########################################
|
##########################################
|
||||||
FRITZBOX_Readout_Query($$$)
|
sub FRITZBOX_Readout_Query($$$)
|
||||||
{
|
{
|
||||||
my ($hash, $readoutArray, $readoutReadings) = @_;
|
my ($hash, $readoutArray, $readoutReadings) = @_;
|
||||||
my @cmdArray;
|
my @cmdArray;
|
||||||
@ -1079,7 +1088,9 @@ sub FRITZBOX_Telnet_Open($)
|
|||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $host = $hash->{HOST};
|
|
||||||
|
my $host = AttrVal( $name, "fritzBoxIP", "fritz.box" );
|
||||||
|
|
||||||
my $pwdFile = "fb_pwd.txt";
|
my $pwdFile = "fb_pwd.txt";
|
||||||
my $pwd;
|
my $pwd;
|
||||||
my $msg;
|
my $msg;
|
||||||
@ -1165,8 +1176,8 @@ sub FRITZBOX_Telnet_Close($)
|
|||||||
} # end FRITZBOX_Telnet_Close
|
} # end FRITZBOX_Telnet_Close
|
||||||
|
|
||||||
# Executed the command on the FritzBox Shell
|
# Executed the command on the FritzBox Shell
|
||||||
sub ############################################
|
############################################
|
||||||
FRITZBOX_Exec($$)
|
sub FRITZBOX_Exec($$)
|
||||||
{
|
{
|
||||||
my ($hash, $cmd) = @_;
|
my ($hash, $cmd) = @_;
|
||||||
my $openedTelnet = 0;
|
my $openedTelnet = 0;
|
||||||
@ -1210,9 +1221,9 @@ FRITZBOX_Exec_Remote($$)
|
|||||||
}
|
}
|
||||||
elsif (ref \$cmd eq "REF")
|
elsif (ref \$cmd eq "REF")
|
||||||
{
|
{
|
||||||
|
my @resultArray = ();
|
||||||
if ( int (@{$cmd}) > 0 )
|
if ( int (@{$cmd}) > 0 )
|
||||||
{
|
{
|
||||||
my @resultArray;
|
|
||||||
FRITZBOX_Log $hash, 4, "Execute " . int ( @{$cmd} ) . " command(s)";
|
FRITZBOX_Log $hash, 4, "Execute " . int ( @{$cmd} ) . " command(s)";
|
||||||
|
|
||||||
# my $cmdStr = join "\n", @{$cmd};
|
# my $cmdStr = join "\n", @{$cmd};
|
||||||
@ -1256,16 +1267,17 @@ FRITZBOX_Exec_Remote($$)
|
|||||||
}
|
}
|
||||||
@{$cmd} = ();
|
@{$cmd} = ();
|
||||||
FRITZBOX_Log $hash, 4, "Received ".int(@resultArray)." answer(s)";
|
FRITZBOX_Log $hash, 4, "Received ".int(@resultArray)." answer(s)";
|
||||||
return \@resultArray;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FRITZBOX_Log $hash, 4, "No shell command to execute.";
|
FRITZBOX_Log $hash, 4, "No shell command to execute.";
|
||||||
}
|
}
|
||||||
|
return \@resultArray;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FRITZBOX_Log $hash, 1, "Error: wrong perl parameter";
|
FRITZBOX_Log $hash, 1, "Error: wrong perl parameter";
|
||||||
|
return undef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1486,6 +1498,10 @@ sub FRITZBOX_fritztris($)
|
|||||||
<br>
|
<br>
|
||||||
It needs to be the name of the path on the Fritz!Box. So, it should start with /var/InternerSpeicher if it equals in Windows \\ip-address\fritz.nas
|
It needs to be the name of the path on the Fritz!Box. So, it should start with /var/InternerSpeicher if it equals in Windows \\ip-address\fritz.nas
|
||||||
</li><br>
|
</li><br>
|
||||||
|
<li><code>fritzBoxIP</code>
|
||||||
|
<br>
|
||||||
|
IP address or URL of the Fritz!Box for remote telnet access. Default is "fritz.box".
|
||||||
|
</li><br>
|
||||||
<li><code>telnetUser <user name></code>
|
<li><code>telnetUser <user name></code>
|
||||||
<br>
|
<br>
|
||||||
User name that is used for telnet access. By default no user name is required to login.
|
User name that is used for telnet access. By default no user name is required to login.
|
||||||
@ -1537,4 +1553,4 @@ sub FRITZBOX_fritztris($)
|
|||||||
|
|
||||||
=end html
|
=end html
|
||||||
|
|
||||||
=cut
|
=cut-
|
Loading…
Reference in New Issue
Block a user