mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-25 09:55:38 +00:00
72_FRITZBOX.pm: Version 08.00.02
git-svn-id: https://svn.fhem.de/fhem/trunk@29247 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
439cb1a4a7
commit
38316c7504
@ -45,7 +45,7 @@ use warnings;
|
||||
use Blocking;
|
||||
use HttpUtils;
|
||||
|
||||
my $ModulVersion = "08.00.01";
|
||||
my $ModulVersion = "08.00.02";
|
||||
my $missingModul = "";
|
||||
my $FRITZBOX_TR064pwd;
|
||||
my $FRITZBOX_TR064user;
|
||||
@ -629,7 +629,7 @@ sub FRITZBOX_Initialize($)
|
||||
."shdeviceID_model,shdeviceID_status,shdeviceID_tempOffset,shdeviceID_temperature,shdeviceID_type,"
|
||||
."shdeviceID_voltage,shdeviceID_power,shdeviceID_current,shdeviceID_consumtion,shdeviceSD_ledState,shdeviceSH_state "
|
||||
."enableBoxReadings:multiple-strict,"
|
||||
."box_energyMode,box_globalFilter,box_led,box_vdsl,box_dns_Srv,box_pwr,box_guestWlan "
|
||||
."box_energyMode,box_globalFilter,box_led,box_vdsl,box_dns_Srv,box_pwr,box_guestWlan,box_usb "
|
||||
."enableLogReadings:multiple-strict,"
|
||||
."box_sys_Log,box_wlan_Log,box_fon_Log "
|
||||
."disableBoxReadings:multiple-strict,"
|
||||
@ -881,12 +881,12 @@ sub FRITZBOX_Attr($@)
|
||||
}
|
||||
|
||||
# if ($aName eq "enableReadingsFilter") {
|
||||
# my $inList = AttrVal($name, "enableReadingsFilter", "");
|
||||
# my @reading_list = split(/\,/, "box_led,box_energyMode,box_globalFilter,box_vdsl");
|
||||
# my @reading_list = qw(box_led box_energyMode box_globalFilter box_vdsl");
|
||||
# if ($cmd eq "set") {
|
||||
# $aVal =~ s/\,/\|/g;
|
||||
# foreach ( @reading_list ) {
|
||||
# if ( $_ !~ /$inList/ ) {
|
||||
# my $boxDel = $_;
|
||||
# my $boxDel = $_;
|
||||
# if ( $boxDel !~ /${aVal}/ ) {
|
||||
# foreach (keys %{ $hash->{READINGS} }) {
|
||||
# readingsDelete($hash, $_) if $_ =~ /^${boxDel}.*/ && defined $hash->{READINGS}{$_}{VAL};
|
||||
# }
|
||||
@ -904,8 +904,7 @@ sub FRITZBOX_Attr($@)
|
||||
# }
|
||||
|
||||
if ($aName eq "enableBoxReadings") {
|
||||
my $inList = AttrVal($name, "enableBoxReadings", "");
|
||||
my @reading_list = split(/\,/, "box_led,box_energyMode,box_globalFilter,box_vdsl,box_dns_Srv,box_pwr,box_guestWlan");
|
||||
my @reading_list = qw(box_led box_energyMode box_globalFilter box_vdsl box_dns_Srv box_pwr box_guestWlan box_usb);
|
||||
if ($cmd eq "set") {
|
||||
if ( ("box_dns_Srv" =~ /$aVal/) && $hash->{fhem}{fwVersion} <= 731 ) {
|
||||
return "box_dns_Srv not available for Fritz!OS: $hash->{fhem}{fwVersionStr}";
|
||||
@ -931,13 +930,18 @@ sub FRITZBOX_Attr($@)
|
||||
if ( ("box_guestWlan" =~ /$aVal/) && $hash->{fhem}{fwVersion} < 700 ) {
|
||||
return "box_guestWlan not available for Fritz!OS: $hash->{fhem}{fwVersionStr}";
|
||||
}
|
||||
if ( ("box_usb" =~ /$aVal/) && $hash->{fhem}{fwVersion} < 700 ) {
|
||||
return "box_usb not available for Fritz!OS: $hash->{fhem}{fwVersionStr}";
|
||||
}
|
||||
|
||||
$aVal =~ s/\,/\|/g;
|
||||
foreach ( @reading_list ) {
|
||||
if ( $_ !~ /$inList/ ) {
|
||||
my $boxDel = $_;
|
||||
my $boxDel = $_;
|
||||
if ( $boxDel !~ /${aVal}/ ) {
|
||||
foreach (keys %{ $hash->{READINGS} }) {
|
||||
readingsDelete($hash, $_) if $_ =~ /^${boxDel}.*/ && defined $hash->{READINGS}{$_}{VAL};
|
||||
}
|
||||
readingsDelete($hash, "box_powerLine") if $_ =~ /box_guestWlan/ && defined $hash->{READINGS}{box_powerLine}{VAL};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -948,16 +952,17 @@ sub FRITZBOX_Attr($@)
|
||||
readingsDelete($hash, $_) if $_ =~ /^${boxDel}.*/ && defined $hash->{READINGS}{$_}{VAL};
|
||||
}
|
||||
}
|
||||
readingsDelete($hash, "box_powerLine") if defined $hash->{READINGS}{box_powerLine}{VAL};
|
||||
}
|
||||
}
|
||||
|
||||
if ($aName eq "enableLogReadings") {
|
||||
my $inList = AttrVal($name, "enableLogReadings", "");
|
||||
my @reading_list = split(/\,/, "box_sys_Log,box_wlan_Log,box_fon_Log");
|
||||
my @reading_list = qw(box_sys_Log box_wlan_Log box_fon_Log);
|
||||
if ($cmd eq "set") {
|
||||
$aVal =~ s/\,/\|/g;
|
||||
foreach ( @reading_list ) {
|
||||
if ( $_ !~ /$inList/ ) {
|
||||
my $boxDel = $_;
|
||||
my $boxDel = $_;
|
||||
if ( $boxDel !~ /${aVal}/ ) {
|
||||
foreach (keys %{ $hash->{READINGS} }) {
|
||||
readingsDelete($hash, $_) if $_ =~ /^${boxDel}.*/ && defined $hash->{READINGS}{$_}{VAL};
|
||||
}
|
||||
@ -965,8 +970,8 @@ sub FRITZBOX_Attr($@)
|
||||
}
|
||||
}
|
||||
if ($cmd eq "del") {
|
||||
foreach ( @reading_list ) {
|
||||
my $boxDel = $_;
|
||||
if ( $boxDel !~ /${aVal}/ ) {
|
||||
foreach (keys %{ $hash->{READINGS} }) {
|
||||
readingsDelete($hash, $_) if $_ =~ /^${boxDel}.*/ && defined $hash->{READINGS}{$_}{VAL};
|
||||
}
|
||||
@ -4710,7 +4715,7 @@ sub FRITZBOX_Readout_Run_Web_LuaData($$$$)
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_guestWlan_groupAccess", $resultData->{data}->{guestAccess}->{guestGroupAccess}, "onoff";
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_guestWlan_tmoActive", $resultData->{data}->{guestAccess}->{isTimeoutActive}, "onoff";
|
||||
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_powerLine", $resultData->{data}->{guestAccess}->{isPowerline}, "onoff";
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_powerLine", $resultData->{data}->{guestAccess}->{isPowerline} * 1, "onoff";
|
||||
|
||||
FRITZBOX_Log $hash, 4, "WLAN detailed info - end getting data";
|
||||
} else {
|
||||
@ -4859,13 +4864,78 @@ sub FRITZBOX_Readout_Run_Web_LuaData($$$$)
|
||||
# xhrId all
|
||||
# xhr 1 lang de page dslOv xhrId all
|
||||
|
||||
#-------------------------------------------------------------------------------------
|
||||
# USB Storage
|
||||
|
||||
# xhr 1 lang de page usbOv xhrId all
|
||||
|
||||
if ( ($hash->{fhem}{fwVersion} >= 700) && ($enableBoxReading =~ /box_usb/) ) {
|
||||
|
||||
FRITZBOX_Log $hash, 4, "USB Information - start getting data";
|
||||
|
||||
@webCmdArray = ();
|
||||
push @webCmdArray, "xhr" => "1";
|
||||
push @webCmdArray, "lang" => "de";
|
||||
push @webCmdArray, "page" => "usbOv";
|
||||
push @webCmdArray, "xhrId" => "all";
|
||||
|
||||
$resultData = FRITZBOX_read_LuaData($hash, "data", \@webCmdArray) ;
|
||||
|
||||
# Abbruch wenn Fehler beim Lesen der Fritzbox-Antwort
|
||||
return FRITZBOX_Readout_Response($hash, $resultData, $roReadings) if ( defined $resultData->{Error} || defined $resultData->{AuthorizationRequired});
|
||||
|
||||
$$sidNew += $resultData->{sidNew} if defined $resultData->{sidNew};
|
||||
|
||||
$resultData->{data}->{usbOverview}->{isFTPStorageEnabled} = 0 unless $resultData->{data}->{usbOverview}->{isFTPStorageEnabled};
|
||||
$resultData->{data}->{usbOverview}->{isFTPServerEnabled} = 0 unless $resultData->{data}->{usbOverview}->{isFTPServerEnabled};
|
||||
$resultData->{data}->{usbOverview}->{isNASEnabled} = 0 unless $resultData->{data}->{usbOverview}->{isNASEnabled};
|
||||
$resultData->{data}->{usbOverview}->{isSMBv1Enabled} = 0 unless $resultData->{data}->{usbOverview}->{isSMBv1Enabled};
|
||||
$resultData->{data}->{usbOverview}->{isWebdavEnabled} = 0 unless $resultData->{data}->{usbOverview}->{isWebdavEnabled};
|
||||
$resultData->{data}->{usbOverview}->{isAutoIndexingEnabled} = 0 unless $resultData->{data}->{usbOverview}->{isAutoIndexingEnabled};
|
||||
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_FTP_activ", $resultData->{data}->{usbOverview}->{isFTPStorageEnabled} * 1, "onoff";
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_FTP_enabled", $resultData->{data}->{usbOverview}->{isFTPServerEnabled} * 1, "onoff";
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_NAS_enabled", $resultData->{data}->{usbOverview}->{isNASEnabled} * 1, "onoff";
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_SMB_enabled", $resultData->{data}->{usbOverview}->{isSMBv1Enabled} * 1, "onoff";
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_webDav", $resultData->{data}->{usbOverview}->{isWebdavEnabled} * 1, "onoff";
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_autoIndex", $resultData->{data}->{usbOverview}->{isAutoIndexingEnabled} * 1, "onoff";
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_indexStatus", $resultData->{data}->{usbOverview}->{indexingStatus};
|
||||
|
||||
$nbViews = 0;
|
||||
if (defined $resultData->{data}->{usbOverview}->{devices}) {
|
||||
$views = $resultData->{data}->{usbOverview}->{devices};
|
||||
$nbViews = scalar @$views;
|
||||
}
|
||||
|
||||
if ($nbViews > 0) {
|
||||
my $i = 0;
|
||||
eval {
|
||||
for( $i = 0; $i <= $nbViews - 1; $i++) {
|
||||
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_${i}_devID", $resultData->{data}->{usbOverview}->{devices}->[$i]->{id};
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_${i}_devType", $resultData->{data}->{usbOverview}->{devices}->[$i]->{deviceType};
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_${i}_devName", $resultData->{data}->{usbOverview}->{devices}->[$i]->{deviceName};
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_${i}_devStatus", $resultData->{data}->{usbOverview}->{devices}->[$i]->{storageStatus};
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_${i}_devConType", $resultData->{data}->{usbOverview}->{devices}->[$i]->{connectionType};
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_${i}_devEject", $resultData->{data}->{usbOverview}->{devices}->[$i]->{isEjectable} * 1, "onoff";
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_${i}_devStorageUsed", $resultData->{data}->{usbOverview}->{devices}->[$i]->{partitions}->[0]->{usedStorageInBytes};
|
||||
FRITZBOX_Readout_Add_Reading $hash, $roReadings, "box_usb_${i}_devStorageTotal", $resultData->{data}->{usbOverview}->{devices}->[$i]->{partitions}->[0]->{totalStorageInBytes};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FRITZBOX_Log $hash, 4, "USB Information - end getting data";
|
||||
} else {
|
||||
|
||||
FRITZBOX_Log $hash, 4, "wrong Fritz!OS for USB Information: $hash->{fhem}{fwVersionStr}" if $enableBoxReading =~ /box_usb/;
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------------
|
||||
# INET Monitor
|
||||
|
||||
# xhr 1
|
||||
# lang de
|
||||
# page netMoni
|
||||
# xhrId all
|
||||
# xhr 1 lang de page netMoni xhrId all
|
||||
|
||||
if ( ($hash->{fhem}{fwVersion} >= 731) && ($enableBoxReading =~ /box_dns_Srv/)) {
|
||||
@ -6143,7 +6213,7 @@ sub FRITZBOX_Readout_Process($$)
|
||||
."shdeviceID_model,shdeviceID_status,shdeviceID_tempOffset,shdeviceID_temperature,shdeviceID_type,"
|
||||
."shdeviceID_voltage,shdeviceID_power,shdeviceID_current,shdeviceID_consumtion,shdeviceID_ledState,shdeviceID_state "
|
||||
."enableBoxReadings:multiple-strict,"
|
||||
."box_energyMode,box_globalFilter,box_led,box_dns_Srv,box_pwr,box_guestWlan "
|
||||
."box_energyMode,box_globalFilter,box_led,box_dns_Srv,box_pwr,box_guestWlan,box_usb "
|
||||
."enableLogReadings:multiple-strict,"
|
||||
."box_sys_Log,box_wlan_Log,box_fon_Log "
|
||||
."disableBoxReadings:multiple-strict,"
|
||||
@ -6948,6 +7018,7 @@ sub FRITZBOX_Set_check_APIs($)
|
||||
$response = FRITZBOX_call_Lua_Query( $hash, $queryStr, "", "luaQuery") ;
|
||||
|
||||
if ( !defined $response->{sid} || defined $response->{Error} || defined $response->{AuthorizationRequired} ) {
|
||||
FRITZBOX_Readout_Add_Reading $hash, \@roReadings, "->APICHECKED", -1;
|
||||
$apiError = "luaQuery: error query string";
|
||||
FRITZBOX_Log $hash, 4, "$queryStr: not Ok";
|
||||
} else {
|
||||
@ -12248,6 +12319,7 @@ sub FRITZBOX_Helper_Url_Regex {
|
||||
<b>box_dns_Srv</b> -> activates all readings <b>box_dns_Srv</b><i>n</i> FritzOS > 7.31<br>
|
||||
<b>box_pwr</b> -> activates all readings <b>box_pwr</b><i>...</i> FritzOS >= 7.00. ! not available for Cable with FritzOS 8.00<br>
|
||||
<b>box_guestWlan</b> -> activates all readings <b>box_guestWlan</b><i>...</i> FritzOS >= 7.00<br>
|
||||
<b>box_usb</b> -> activates all readings <b>box_usb</b><i>...</i> FritzOS >= 7.00<br>
|
||||
</li><br>
|
||||
|
||||
<li><a name="enableLogReadings"></a>
|
||||
@ -12442,6 +12514,21 @@ sub FRITZBOX_Helper_Url_Regex {
|
||||
<li><b>box_sys_LogNewest</b> - newest system event: ID Date Time </li>
|
||||
<li><b>box_tr064</b> - application interface TR-064 (needed by this modul)</li>
|
||||
<li><b>box_tr069</b> - provider remote access TR-069 (safety issue!)</li>
|
||||
<li><b>box_usb_FTP_activ</b></li>
|
||||
<li><b>box_usb_FTP_enabled</b></li>
|
||||
<li><b>box_usb_NAS_enabled</b></li>
|
||||
<li><b>box_usb_SMB_enabled</b></li>
|
||||
<li><b>box_usb_autoIndex</b></li>
|
||||
<li><b>box_usb_indexStatus</b></li>
|
||||
<li><b>box_usb_webDav</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devConType</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devEject</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devID</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devName</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devStatus</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devStorageTotal</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devStorageUsed</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devType</b></li>
|
||||
<li><b>box_vdsl_downStreamRate</b> - Current down stream data rate (MBit/s)</li>
|
||||
<li><b>box_vdsl_downStreamMaxRate</b> - Max down stream data rate (MBit/s)</li>
|
||||
<li><b>box_vdsl_upStreamRate</b> - Current up stream data rate (MBit/s)</li>
|
||||
@ -13200,6 +13287,7 @@ sub FRITZBOX_Helper_Url_Regex {
|
||||
<b>box_dns_Srv</b> -> aktiviert alle Readings <b>box_dns_Srv</b><i>n</i> FritzOS > 7.31<br>
|
||||
<b>box_pwr</b> -> aktiviert alle Readings <b>box_pwr</b><i>...</i> FritzOS >= 7.00. Nicht verfügbar für Cable mit FritzOS 8.00<br>
|
||||
<b>box_guestWlan</b> -> aktiviert alle Readings <b>box_guestWlan</b><i>...</i> FritzOS > 7.00<br>
|
||||
<b>box_usb</b> -> aktiviert alle Readings <b>box_usb</b><i>...</i> FritzOS > 7.00<br>
|
||||
</li><br>
|
||||
|
||||
<li><a name="enableLogReadings"></a>
|
||||
@ -13391,6 +13479,23 @@ sub FRITZBOX_Helper_Url_Regex {
|
||||
<li><b>box_stdDialPort</b> - Anschluss der geräteseitig von der Wählhilfe genutzt wird</li>
|
||||
<li><b>box_tr064</b> - Status der Anwendungsschnittstelle TR-064 (wird auch von diesem Modul benötigt)</li>
|
||||
<li><b>box_tr069</b> - Provider-Fernwartung TR-069 (sicherheitsrelevant!)</li>
|
||||
|
||||
<li><b>box_usb_FTP_activ</b></li>
|
||||
<li><b>box_usb_FTP_enabled</b></li>
|
||||
<li><b>box_usb_NAS_enabled</b></li>
|
||||
<li><b>box_usb_SMB_enabled</b></li>
|
||||
<li><b>box_usb_autoIndex</b></li>
|
||||
<li><b>box_usb_indexStatus</b></li>
|
||||
<li><b>box_usb_webDav</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devConType</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devEject</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devID</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devName</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devStatus</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devStorageTotal</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devStorageUsed</b></li>
|
||||
<li><b>box_usb_</b><i>n</i><b>_devType</b></li>
|
||||
|
||||
<li><b>box_vdsl_downStreamRate</b> - Aktuelle DownStream Datenrate (MBit/s)</li>
|
||||
<li><b>box_vdsl_downStreamMaxRate</b> - Maximale DownStream Datenrate (MBit/s)</li>
|
||||
<li><b>box_vdsl_upStreamRate</b> - Aktuelle UpStream Datenrate (MBit/s)</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user