From a2f98e1c224975874300e607184b8ca1f1fd3c8b Mon Sep 17 00:00:00 2001
From: tpoitzsch <>
Date: Thu, 2 Jul 2015 19:34:37 +0000
Subject: [PATCH] FRITZBOX: mac_ inactive

git-svn-id: https://svn.fhem.de/fhem/trunk@8875 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
 fhem/FHEM/72_FRITZBOX.pm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fhem/FHEM/72_FRITZBOX.pm b/fhem/FHEM/72_FRITZBOX.pm
index ec13b01bd..a1ce5a82d 100644
--- a/fhem/FHEM/72_FRITZBOX.pm
+++ b/fhem/FHEM/72_FRITZBOX.pm
@@ -898,7 +898,6 @@ sub FRITZBOX_Readout_Run_Shell($)
 } # End FRITZBOX_Readout_Run_Shell
 
 # http://fritz.box/cgi-bin/webcm?wlan:settings/guest_ap_enabled=1&sid=
-#http://fritz.box/query.lua?sid=<enter_your_sid_here>&network=landevice:settings/landevice/list(name,ip,mac,UID,dhcp,wlan,ethernet,active,static_dhcp,manu_name,wakeup,deleteable,source,online,speed,wlan_UIDs,auto_wakeup,guest,url,wlan_station_type,vendorname,parentname,parentuid,ethernet_port,wlan_show_in_monitor,plc,ipv6_ifid,parental_control_abuse)
       # FRITZBOX_Log $hash, 3, "Web connection established with $sid";
       # my $urlcgi = 'http://'.$host.'/cgi-bin/webcm';
       # my $response = $agent->post( $urlcgi,
@@ -1079,9 +1078,14 @@ sub FRITZBOX_Readout_Run_Web($)
       if ($_->{active} == 1) {
          FRITZBOX_Readout_Add_Reading $hash, \@roReadings, $rName, $_->{name};
       }
-   # Delete the mac readings if the device is not online anymore
+   # if the device is not online anymore, set the mac readings to 'inactive' and delete at next readout
       elsif (exists $hash->{READINGS}{$rName}) {
-         FRITZBOX_Readout_Add_Reading $hash, \@roReadings, $rName, "";
+         if ($hash->{READINGS}{$rName}{VAL} ne "inactive") {
+            FRITZBOX_Readout_Add_Reading $hash, \@roReadings, $rName, "inactive";
+         }
+         else {
+            FRITZBOX_Readout_Add_Reading $hash, \@roReadings, $rName, "";
+         }
       }
    }