mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 13:26:02 +00:00
FRITZBOX: WEBCM-API has prio by WLAN on/off
git-svn-id: https://svn.fhem.de/fhem/trunk@9324 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f7207452fc
commit
ca6336c993
@ -2212,7 +2212,14 @@ sub FRITZBOX_GuestWlan_Run_Web($)
|
|||||||
|
|
||||||
|
|
||||||
# Set guestWLAN, if necessary set also WLAN
|
# Set guestWLAN, if necessary set also WLAN
|
||||||
if ($hash->{SECPORT}) { #TR-064
|
if ( $hash->{WEBCM} ) { #webcm
|
||||||
|
push @webCmdArray, "wlan:settings/wlan_enable" => "1" if $state == 1;
|
||||||
|
# push @webCmdArray, "active" => "on";
|
||||||
|
# FRITZBOX_Web_CmdPost ($hash, \@webCmdArray, '/wlan/wlan_settings.lua');
|
||||||
|
push @webCmdArray, "wlan:settings/guest_ap_enabled" => $state;
|
||||||
|
$result = FRITZBOX_Web_CmdPost( $hash, \@webCmdArray );
|
||||||
|
}
|
||||||
|
elsif ( $hash->{SECPORT} ) { #TR-064
|
||||||
if ($state == 1) { # WLAN on when Guest WLAN on
|
if ($state == 1) { # WLAN on when Guest WLAN on
|
||||||
push @tr064CmdArray, ["WLANConfiguration:1", "wlanconfig1", "SetEnable", "NewEnable", "1"];
|
push @tr064CmdArray, ["WLANConfiguration:1", "wlanconfig1", "SetEnable", "NewEnable", "1"];
|
||||||
push @tr064CmdArray, ["WLANConfiguration:2", "wlanconfig2", "SetEnable", "NewEnable", "1"]
|
push @tr064CmdArray, ["WLANConfiguration:2", "wlanconfig2", "SetEnable", "NewEnable", "1"]
|
||||||
@ -2224,12 +2231,8 @@ sub FRITZBOX_GuestWlan_Run_Web($)
|
|||||||
push @tr064CmdArray, ["WLANConfiguration:".$gWlanNo, "wlanconfig".$gWlanNo, "SetEnable", "NewEnable", $state];
|
push @tr064CmdArray, ["WLANConfiguration:".$gWlanNo, "wlanconfig".$gWlanNo, "SetEnable", "NewEnable", $state];
|
||||||
$result = FRITZBOX_TR064_Cmd( $hash, 0, \@tr064CmdArray );
|
$result = FRITZBOX_TR064_Cmd( $hash, 0, \@tr064CmdArray );
|
||||||
}
|
}
|
||||||
else { #webcm
|
else { #no API
|
||||||
push @webCmdArray, "wlan:settings/wlan_enable" => "1" if $state == 1;
|
FRITZBOX_Log $hash, 2, "Error: No API available to switch WLAN.";
|
||||||
# push @webCmdArray, "active" => "on";
|
|
||||||
# FRITZBOX_Web_CmdPost ($hash, \@webCmdArray, '/wlan/wlan_settings.lua');
|
|
||||||
push @webCmdArray, "wlan:settings/guest_ap_enabled" => $state;
|
|
||||||
$result = FRITZBOX_Web_CmdPost( $hash, \@webCmdArray );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# push @webCmdArray, "autoupdate" => "on";
|
# push @webCmdArray, "autoupdate" => "on";
|
||||||
@ -2320,17 +2323,20 @@ sub FRITZBOX_Wlan_Run_Web($)
|
|||||||
$state =~ s/off/0/;
|
$state =~ s/off/0/;
|
||||||
|
|
||||||
# Set WLAN
|
# Set WLAN
|
||||||
if ($hash->{SECPORT}) { #TR-064
|
if ($hash->{WEBCM}) { #webcm
|
||||||
|
push @webCmdArray, "wlan:settings/wlan_enable" => $state;
|
||||||
|
FRITZBOX_Web_CmdPost ($hash, \@webCmdArray);
|
||||||
|
# push @webCmdArray, "active" => "on" if $val[0] eq "on";
|
||||||
|
# FRITZBOX_Web_CmdPost ($hash, \@webCmdArray, '/wlan/wlan_settings.lua');
|
||||||
|
}
|
||||||
|
elsif ($hash->{SECPORT}) { #TR-064
|
||||||
push @tr064CmdArray, ["WLANConfiguration:1", "wlanconfig1", "SetEnable", "NewEnable", $state];
|
push @tr064CmdArray, ["WLANConfiguration:1", "wlanconfig1", "SetEnable", "NewEnable", $state];
|
||||||
push @tr064CmdArray, ["WLANConfiguration:2", "wlanconfig2", "SetEnable", "NewEnable", $state]
|
push @tr064CmdArray, ["WLANConfiguration:2", "wlanconfig2", "SetEnable", "NewEnable", $state]
|
||||||
if $hash->{fhem}->{is_double_wlan} == 1;
|
if $hash->{fhem}->{is_double_wlan} == 1;
|
||||||
$result = FRITZBOX_TR064_Cmd( $hash, 0, \@tr064CmdArray );
|
$result = FRITZBOX_TR064_Cmd( $hash, 0, \@tr064CmdArray );
|
||||||
}
|
}
|
||||||
else { #webcm
|
else { #no API
|
||||||
push @webCmdArray, "wlan:settings/wlan_enable" => $state;
|
FRITZBOX_Log $hash, 2, "Error: No API available to switch WLAN.";
|
||||||
FRITZBOX_Web_CmdPost ($hash, \@webCmdArray);
|
|
||||||
# push @webCmdArray, "active" => "on" if $val[0] eq "on";
|
|
||||||
# FRITZBOX_Web_CmdPost ($hash, \@webCmdArray, '/wlan/wlan_settings.lua');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read WLAN-Status
|
# Read WLAN-Status
|
||||||
@ -4329,24 +4335,20 @@ sub FRITZBOX_readPassword($)
|
|||||||
FRITZBOX_Log $hash, 5, "Read FritzBox password from file";
|
FRITZBOX_Log $hash, 5, "Read FritzBox password from file";
|
||||||
($err, $password) = getKeyValue($index);
|
($err, $password) = getKeyValue($index);
|
||||||
|
|
||||||
if(defined($err))
|
if ( defined($err) ) {
|
||||||
{
|
|
||||||
FRITZBOX_Log $hash, 4, "unable to read FritzBox password from file: $err";
|
FRITZBOX_Log $hash, 4, "unable to read FritzBox password from file: $err";
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defined($password))
|
if ( defined($password) ) {
|
||||||
{
|
if ( eval "use Digest::MD5;1" ) {
|
||||||
if(eval "use Digest::MD5;1")
|
|
||||||
{
|
|
||||||
$key = Digest::MD5::md5_hex(unpack "H*", $key);
|
$key = Digest::MD5::md5_hex(unpack "H*", $key);
|
||||||
$key .= Digest::MD5::md5_hex($key);
|
$key .= Digest::MD5::md5_hex($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $dec_pwd = '';
|
my $dec_pwd = '';
|
||||||
|
|
||||||
for my $char (map { pack('C', hex($_)) } ($password =~ /(..)/g))
|
for my $char (map { pack('C', hex($_)) } ($password =~ /(..)/g)) {
|
||||||
{
|
|
||||||
my $decode=chop($key);
|
my $decode=chop($key);
|
||||||
$dec_pwd.=chr(ord($char)^ord($decode));
|
$dec_pwd.=chr(ord($char)^ord($decode));
|
||||||
$key=$decode.$key;
|
$key=$decode.$key;
|
||||||
@ -4354,8 +4356,7 @@ sub FRITZBOX_readPassword($)
|
|||||||
|
|
||||||
return $dec_pwd;
|
return $dec_pwd;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FRITZBOX_Log $hash, 4, "No password in file";
|
FRITZBOX_Log $hash, 4, "No password in file";
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user