diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm index 059e6b48a..ffcec4e22 100644 --- a/fhem/FHEM/72_FRITZBOX.pm +++ b/fhem/FHEM/72_FRITZBOX.pm @@ -1366,8 +1366,9 @@ sub FRITZBOX_Readout_Run_Web($) } FRITZBOX_Readout_Add_Reading $hash, \@roReadings, "fhem->radioCount", $runNo; -# LanDevice-Liste erzeugen +# Create LanDevice list %landevice = (); + my $wlanCount = 0; foreach ( @{ $result->{lanDevice} } ) { my $dIp = $_->{ip}; my $dName = $_->{name}; @@ -1376,11 +1377,12 @@ sub FRITZBOX_Readout_Run_Web($) $landevice{$dIp}=$dName; my $rName = "mac_".$_->{mac}; $rName =~ s/:/_/g; -# Create a reading if a landevice is connected + # Create a reading if a landevice is connected if ($_->{active} == 1) { - FRITZBOX_Readout_Add_Reading $hash, \@roReadings, $rName, $dName; + FRITZBOX_Readout_Add_Reading $hash, \@roReadings, $rName, $dName; + $wlanCount++ if $_->{wlan} == 1; } - # if the device is not online anymore, set the mac readings to 'inactive' and delete at next readout + # else if the device is not online anymore, set the mac readings to 'inactive' and delete at next readout elsif (exists $hash->{READINGS}{$rName}) { if ($hash->{READINGS}{$rName}{VAL} ne "inactive") { FRITZBOX_Readout_Add_Reading $hash, \@roReadings, $rName, "inactive"; @@ -1390,6 +1392,7 @@ sub FRITZBOX_Readout_Run_Web($) } } } + FRITZBOX_Readout_Add_Reading ($hash, \@roReadings, "box_wlanCount", $wlanCount); # Remove Guest WLAN devices that are not online anymore foreach ( @{ $result->{wlanList} } ) { @@ -1581,22 +1584,23 @@ sub FRITZBOX_Readout_Process($$) $valueLow = $values{".box_TodayBytesReceivedLow"}; $valueHigh = $values{".box_TodayBytesReceivedHigh"}; } - # FRITZBOX_Log $hash, 5, "valueHigh $valueHigh"; $valueHigh *= 2**22; - # FRITZBOX_Log $hash, 5, "valueHigh $valueHigh"; - # FRITZBOX_Log $hash, 5, "valueLow $valueLow"; $valueLow /= 2**10; - # FRITZBOX_Log $hash, 5, "valueLow $valueLow"; - # FRITZBOX_Log $hash, 5, "valueHigh+valueLow: ". ($valueHigh+$valueLow); my $time = time()-time_str2num($hash->{READINGS}{".box_TodayBytesReceivedLow"}{TIME}); - # FRITZBOX_Log $hash, 5, "time: $time"; $values{ "box_rateDown" } = sprintf ("%.3f", ($valueHigh+$valueLow) / $time ); } - if ( defined $values{".box_TodayBytesSentLow"} && defined $hash->{READINGS}{".box_TodayBytesSentLow"}) { + if ( defined $values{".box_TodayBytesSentLow"} && defined $hash->{READINGS}{".box_TodayBytesSentLow"} ) { my $valueHigh = $values{".box_TodayBytesSentHigh"} - $hash->{READINGS}{".box_TodayBytesSentHigh"}{VAL}; + my $valueLow = $values{".box_TodayBytesSentLow"} - $hash->{READINGS}{".box_TodayBytesSentLow"}{VAL}; + # Consider reset of day counter + if ($valueHigh < 0 || $valueHigh == 0 && $valueLow < 0) { + $valueLow = $values{".box_TodayBytesSentLow"}; + $valueHigh = $values{".box_TodayBytesSentHigh"}; + } + $valueHigh *= 2**22; + $valueLow /= 2**10; my $time = time()-time_str2num($hash->{READINGS}{".box_TodayBytesSentLow"}{TIME}); - my $valueLow = $values{".box_TodayBytesSentLow"} - $hash->{READINGS}{".box_TodayBytesSentLow"}{VAL};; - $values{ "box_rateUp" } = sprintf ("%.3f", ( $valueHigh * 2**22 + $valueLow / 2**10 ) / $time ); + $values{ "box_rateUp" } = sprintf ("%.3f", ($valueHigh+$valueLow) / $time ); } # Fill all handed over readings @@ -4892,6 +4896,7 @@ sub FRITZBOX_fritztris($)
  • box_stdDialPort - standard caller port when using the dial function of the box
  • box_tr064 - application interface TR-064 (needed by this modul)
  • box_tr069 - provider remote access TR-069 (safety issue!)
  • +
  • box_wlanCount - Number of devices connected via WLAN
  • box_wlan_2.4GHz - Current state of the 2.4 GHz WLAN
  • box_wlan_5GHz - Current state of the 5 GHz WLAN

  • @@ -5236,8 +5241,10 @@ sub FRITZBOX_fritztris($)
  • box_stdDialPort - Anschluss der geräteseitig von der Wählhilfe genutzt wird
  • box_tr064 - Anwendungsschnittstelle TR-064 (wird auch von diesem Modul benötigt)
  • box_tr069 - Provider-Fernwartung TR-069 (sicherheitsrelevant!)
  • +
  • box_wlanCount - Anzahl der Geräte die über WLAN verbunden sind
  • box_wlan_2.4GHz - Aktueller Status des 2.4-GHz-WLAN
  • box_wlan_5GHz - Aktueller Status des 5-GHz-WLAN
  • +
  • dect1 - Name des DECT Telefons 1
  • dect1_alarmRingTone - Klingelton beim Wecken über das DECT Telefon 1