WhoIsAtHome: http://fhemwiki.de/wiki/FritzBox:_WhoIsAtHome

652 views
Skip to first unread message

Rene

unread,
Aug 17, 2012, 8:49:45 AM8/17/12
to fhem-...@googlegroups.com
Hallo,

ich nutze FHEM auf einer 7390 und wollte die Funktion WhoIsAtHome aus dem Wiki nutzen.

Ich habe alles nach der Anleitung gemacht, trotzdem ist immer der Status "Abwesend". Auf der Fritzbox läuft die Firmware 84.05.22.

Gibt es da Änderungen, so das es nicht laufen kann?


Gruß, René 

Rene

unread,
Aug 17, 2012, 9:04:18 AM8/17/12
to fhem-...@googlegroups.com
also definiert habe ich folgendes:

define iPhone_Rene dummy
attr iPhone_Rene icon icoHouse.png
attr iPhone_Rene room WhoIsAtHome
attr iPhone_Rene setList Anwesend Abwesend
define WLAN_iPhone_Rene notify WLAN {FBWlanStat('iPhone-Rene', "iPhone_Rene")}
define search_for_iPhone_Rene at +*00:05:00 trigger WLAN
attr search_for_iPhone_Rene room WhoIsAtHome

Und in der Fritzbox ist unter WLAN auch der Name "iPhone-Rene" drin. Auch wenn ich nur nach "iPhone" suche ist immer Abwesend angesagt...

puschel74

unread,
Aug 17, 2012, 9:58:48 AM8/17/12
to fhem-...@googlegroups.com
Hallo,

war da nicht ein Problem mit den - und _ ??
Ich meine irgendsowas spuckt in der FB rum.

Grüße

Rene

unread,
Aug 17, 2012, 10:10:02 AM8/17/12
to fhem-...@googlegroups.com
jetzt habe ich mal das probiert: http://fhemwiki.de/wiki/FritzBox:_ActiveDevices

Laut der Beschreibung soll es mit dem "-" umgehen können. Geht aber auch nicht.

ist das in den utils denn noch richtig:

qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/name);


oder hat sich das mit einer Firmware verändert?

Sebastian

unread,
Aug 17, 2012, 10:11:52 AM8/17/12
to fhem-...@googlegroups.com
Das ist klar, das er iPhone nicht findet, weil er schon den kompletten Namen suchen muss, bzw. finden.

Ja, das Netzwerkgerät darf keine _ haben.

In der While-Schleife ist die Anzahl auf 15 begrenzt. Setz mal den Wert höher, vielleicht ändert sich dann der Wert...

Lg

Rene

unread,
Aug 17, 2012, 10:19:48 AM8/17/12
to fhem-...@googlegroups.com
ne, leider nicht...  Und ich habe schon testweise auf 150 gesetzt...

dudler

unread,
Aug 17, 2012, 10:36:43 AM8/17/12
to fhem-...@googlegroups.com
It should work. Can you post your exact call for  FBWLanDevActive and the exact name your iphone is showing up in your Fritzbox. Take care of capitals in the names. Post them exactly as they are shown in the Fritzbox.

{HT}

Op vrijdag 17 augustus 2012 16:19:48 UTC+2 schreef Rene het volgende:

Tapir Fink

unread,
Aug 17, 2012, 11:04:44 AM8/17/12
to fhem-...@googlegroups.com
Das Problem hatte ich auch.
Im IPhone unter Einstellungen/Info/Name den Namen ändern in z.B iPhoneRene ( einfach ohne Leerzeichen und Sonderzeichen ). Das dann auch auf der FB aktualisieren.
In der Sub die Anzahl der zu Netzwerkgeräte von 15 auf 30 oder So viele wie maximal an der FB bisher angemeldet waren erhöhen
Und es geht seit dem ohne Probleme. Nur das 4S meiner Frau bucht sich bei Nichtnutzung aus dem WLan aus, mein IPhone 4 bleibt drin, solange ich daheim bin. Das ist etwas ärgerlich, da ich einige Dinge in Abhängigkeit von dem Zu Hause Status schalte.

Lg det.

puschel74

unread,
Aug 17, 2012, 11:17:36 AM8/17/12
to fhem-...@googlegroups.com
Hallo,

eine Frage.
Ich hab fhem auf einer 7390 laufen welche NICHT der Router ist.
Kann ich mit dem WhoIsAtHome auch die Router-FB (auch eine 7390) abfragen?
Danke schonmal für die Antwort.

Grüße

Rene

unread,
Aug 17, 2012, 12:03:43 PM8/17/12
to fhem-...@googlegroups.com
In the Fritzbox i have:

iPhone-Rene192.168.21.31XX:XX:XX:XX:XX:XX58 Mbit/s2,4 GHz, WPA2, WMM
and my FBWLanDevActive call is:

{FBWLanDevActive('iPhone-Rene', "iPhone_Rene")}


and the definition:

define iPhone_Rene dummy
attr iPhone_Rene icon icoHouse.png
attr iPhone_Rene room WhoIsAtHome
attr iPhone_Rene setList Anwesend Abwesend
define WLAN_iPhone_Rene notify WLAN {FBWLanDevActive('iPhone-Rene', "iPhone_Rene")}
define search_for_iPhone_Rene at +*00:05:00 trigger WLAN
attr search_for_iPhone_Rene room WhoIsAtHome


does it help?

Rudolf Koenig

unread,
Aug 17, 2012, 12:12:12 PM8/17/12
to fhem-...@googlegroups.com
> Kann ich mit dem WhoIsAtHome auch die Router-FB (auch eine 7390) abfragen?

Nein, da die Loesung aus fhemwiki ein Kommando absetzt.

Theoretisch muesste das auch ueber Web-Abfrage klappen (zum Anmelden kann man
FB_getPage aus FritzBoxUtils.pm verwenden), ist aber einiges an Arbeit, und es
gibts nichts fertiges zum abschreiben.

puschel74

unread,
Aug 17, 2012, 12:22:28 PM8/17/12
to fhem-...@googlegroups.com
Hallo,

danke Rudi.
Wär ja zu schön gewesen wenn man für die Abfrage nur die IP-Adresse angeben müsste.

Grüße

Carsten

unread,
Aug 17, 2012, 12:38:19 PM8/17/12
to fhem-...@googlegroups.com
Hallo,

ich bin ja nach wie vor ahnungslos, aber vielleicht tuts das hier?

Gruß

Carsten

Rene

unread,
Aug 17, 2012, 4:06:36 PM8/17/12
to fhem-...@googlegroups.com
@Carsten

interessant! Das habe ich gleich mal ausprobiert und mich per telnet auf FHEM Port 7072 eingeloggt. Dann

{qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice15/name)}

eingeben. Aber es passiert nichts? Keine Ausgabe, egal was für eine Zahl ich verwende...


Merkwürdig...

dudler

unread,
Aug 17, 2012, 4:33:17 PM8/17/12
to fhem-...@googlegroups.com
I still don see what is wrong.  Could you try
{FBWLanDevActive('iPhone', "iPhone_Rene")}

in the command line from the web interface? It should check for at least 1 device which name starts with "iPhone". And set the variable iPhone_Rene according to its findings. For testing purposes set the number of loops to 150.

{HT}

Op vrijdag 17 augustus 2012 18:03:43 UTC+2 schreef Rene het volgende:
Message has been deleted

Sebastian

unread,
Aug 17, 2012, 4:40:16 PM8/17/12
to fhem-...@googlegroups.com
@puschel74

Ja, es ist in der Art machbar, unter bestimmten Vorraussetzungen!

Fhem läuft bei mir auf einer FritzBox 7270, meine WLAN-Geräte buchen sich aber bei meiner FritzBox 6360 ein. Da meine Netzwerkgeräte dann aber auch in der 7270 als "online" angezeigt werden ist es so wiederrum möglich. Der Nachteil ist halt nur, das es nach verlassen des WLANs etwa 15 min dauert, bis die 7270 dies registriert und das Gerät wieder als "offline" setzt.
Also ist es mit zwei FirtzBoxen schon mal möglich, so wie oben geschrieben...

Lg

Rene

unread,
Aug 18, 2012, 2:26:02 AM8/18/12
to fhem-...@googlegroups.com
@dudler

i try that. I did a shutdown restart and after that i put {FBWLanDevActive('iPhone', "iPhone_Rene")} in the commandline and press "save" -> nothing change! The state of my iPhone is "???"

When i set this command via telnet:7072 the state changes to "Abwesend".  Can it be that some access-rights are not correct set?




UliM

unread,
Aug 18, 2012, 3:26:43 AM8/18/12
to fhem-...@googlegroups.com
instead of hitting the save-button (which only saves the config-files, but does not execute what is in the commandfield), just type the command into the commandline field and hit <ENTER> .

Rene

unread,
Aug 18, 2012, 3:29:08 AM8/18/12
to fhem-...@googlegroups.com
ok, i try that - but the result is the same. 

UliM

unread,
Aug 18, 2012, 4:01:38 AM8/18/12
to fhem-...@googlegroups.com
"The same" meaning "nothing"?
Did you check the log - any entries? Try putting some log-stuff into your code, e.g. add a line at the beginning like
Log 1, "Routine wurde gestartet";
then reload your .pm, re-execute the command and check the log. So you can see if the routine was excuted at all.
If that works, put the log-line further down in your routine, e.g. within a relevant if-statement to see if that part is executes..

Did you post the code of your routine yet?

Otherwise, set verbose 5, enter the command as before and post the log content here, maybe someone can help based on that.

Best, Uli

Rene

unread,
Aug 18, 2012, 4:17:18 AM8/18/12
to fhem-...@googlegroups.com
Deutsch oder englisch? Uli klingt irgendwie deutsch :-)

es sieht so aus, als wenn das Script abbricht?

sub 
FBWLanDevActive($$)
{
 my ($net_device1)=@_[0];
 my $myLength=length($net_device1);
 my $number=0;
 my $status=0;
 my $net_device="";
 my $net_device2="";
 my $attendance="";
 while($number <= 25){
   $net_device=qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/name);
   Log $number, $net_device;
   $net_device2=substr($net_device, 0, $myLength);
   if($net_device2 eq $net_device1){
     $status=qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/active);
     if ($status == 1) {last;}
   }
   $number++;
 }
 if ($status == 1) {$attendance="Anwesend";}else{$attendance="Abwesend";}
 if(Value("@_[1]") ne $attendance){fhem "set @_[1] $attendance"}
}


Damit müssten doch zumindest 25 Logeinträge kommen und in $netdevice sollte auch was drin stehen, oder? Sind es aber nicht...

2012.08.18 10:11:59 0: Server started (version 5.2 from 2011-12-31 ($Id: fhem.pl 1402 2012-03-31 11:20:42Z rudolfkoenig $), AVM Build: 84.05.21, pid 16400)
2012.08.18 10:12:00 4: Connection accepted from FHEMWEB:192.168.21.20:64797
2012.08.18 10:12:01 5: Loading ./FHEM/98_SVG.pm
2012.08.18 10:12:01 4: HTTP FHEMWEB:192.168.21.20:64797 GET /fhem/
2012.08.18 10:12:02 4: /fhem/ / RL: 699 / text/html; charset=UTF-8 / Content-Encoding: gzip
 / 
2012.08.18 10:12:09 4: HTTP FHEMWEB:192.168.21.20:64797 GET /fhem?cmd=%7BFBWLanDevActive%28%27iPhone%27%2C+%22iPhone_Rene%22%29%7D
2012.08.18 10:12:09 5: Cmd: >{FBWLanDevActive('iPhone', "iPhone_Rene")}<
2012.08.18 10:12:09 0: 
2012.08.18 10:12:09 1: 
2012.08.18 10:12:09 2: 
2012.08.18 10:12:09 3: 
2012.08.18 10:12:09 4: 
2012.08.18 10:12:09 5: 
2012.08.18 10:12:09 4: HTTP FHEMWEB:192.168.21.20:64797 GET /fhem
2012.08.18 10:12:09 4: /fhem / RL: 699 / text/html; charset=UTF-8 / Content-Encoding: gzip
 / 
2012.08.18 10:13:07 4: Connection closed for FHEMWEB:192.168.21.20:64797



Eine Idee?

UliM

unread,
Aug 18, 2012, 4:28:01 AM8/18/12
to fhem-...@googlegroups.com
Syntax von Log anschauen:
Log <loglevel>, <message>

also zB
Log 1, "$number $text";
oder
Log 1, "Beschriftung: " . $text;

Harry Thijssen

unread,
Aug 18, 2012, 9:26:53 AM8/18/12
to fhem-...@googlegroups.com
I can perfectly read german but not write it. So don´t bother about
english or german.

The script stops if the searched string is found. So it seems it is
found at the 5 th iteration. Like Uli wrote, change
Log $number, $net_device;
in
Log 1 "$number, $net_device";
to see what is happening. But it looks as for some reason the result
is not written to the variable.

It could als help if you can put
Log 1, "$attendance, @_[1], $value{@_[1]}";
as the last line in the procedure.

btw you did a "shutdown restart"or a reload of your perl script before testing?

{HT}
2012/8/18 Rene <rene.bar...@gmx.de>:
> --
> To unsubscribe from this group, send email to
> fhem-users+...@googlegroups.com

Rene

unread,
Aug 19, 2012, 8:18:31 AM8/19/12
to fhem-...@googlegroups.com
Hi,

i did a "shutdown restart" and today a "rereadcfg" every test. Not i have following:

sub FBWLanDevActive($$) {
 my ($net_device1)=@_[0];
 my $myLength=length($net_device1);
 my $number=0;
 my $status=0;
 my $net_device="";
 my $net_device2="";
 my $attendance="";
 while($number <= 25){
   $net_device=qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/name);
   $net_device2=substr($net_device, 0, $myLength);
   Log 1,"$number, $net_device";
   if($net_device2 eq $net_device1){
    $status=qx(/usr/bin/ctlmgr_ctl r landevice settings/landevice$number/active);
     if ($status == 1) {last;}
   }
   $number++;
 }
 if ($status == 1) {$attendance="Anwesend";}else{$attendance="Abwesend";}
 if(Value("@_[1]") ne $attendance){fhem "set @_[1] $attendance"}
}

And the log is:

2012.08.19 14:11:40 0: Server started (version 5.2 from 2011-12-31 ($Id: fhem.pl 1402 2012-03-31 11:20:42Z rudolfkoenig $), AVM Build: 84.05.21, pid 21590)
2012.08.19 14:11:57 1: 0, 
2012.08.19 14:11:57 1: 1, 
2012.08.19 14:11:57 1: 2, 
2012.08.19 14:11:57 1: 3, 
2012.08.19 14:11:57 1: 4, 
2012.08.19 14:11:57 1: 5, 
2012.08.19 14:11:57 1: 6, 
2012.08.19 14:11:57 1: 7, 
2012.08.19 14:11:57 1: 8, 
2012.08.19 14:11:57 1: 9, 
2012.08.19 14:11:57 1: 10, 
2012.08.19 14:11:57 1: 11, 
2012.08.19 14:11:57 1: 12, 
2012.08.19 14:11:57 1: 13, 
2012.08.19 14:11:57 1: 14, 
2012.08.19 14:11:57 1: 15, 
2012.08.19 14:11:57 1: 16, 
2012.08.19 14:11:57 1: 17, 
2012.08.19 14:11:57 1: 18, 
2012.08.19 14:11:57 1: 19, 
2012.08.19 14:11:57 1: 20, 
2012.08.19 14:11:57 1: 21, 
2012.08.19 14:11:57 1: 22, 
2012.08.19 14:11:57 1: 23, 
2012.08.19 14:11:57 1: 24, 
2012.08.19 14:11:57 1: 25, 


Seems, there is no output from the net device - also when i change the counter value to 125...    Strange...


Bye, René

Harry Thijssen

unread,
Aug 19, 2012, 8:29:32 AM8/19/12
to fhem-...@googlegroups.com
Hi Rene

Thanks. I think the issue is that you seem to use the AVM version of
FHEM. As far as I know you have less control on the Fritzbox
functionalities with that version. So I guess you will never be able
to use it unless you switch to the FHEM software provided by FHEM.

{HT}

Btw "reload 99_myUtils.pm" should be sufficient fot this tests.


2012/8/19 Rene <rene.bar...@gmx.de>:

Rene

unread,
Aug 19, 2012, 8:41:07 AM8/19/12
to fhem-...@googlegroups.com
Hi,

ok... is it necessary to make a new complete flash or did a updatefhem the same?

Bye and thanks!

René

Harry Thijssen

unread,
Aug 19, 2012, 8:49:46 AM8/19/12
to fhem-...@googlegroups.com
Hi

I am sorry, that is beyond my knowledge. People with more knowledge
about FHEM as I have to answer that.

{HT}

2012/8/19 Rene <rene.bar...@gmx.de>:

Rudolf Koenig

unread,
Aug 19, 2012, 1:30:22 PM8/19/12
to fhem-...@googlegroups.com
> > ok... is it necessary to make a new complete flash or did a updatefhem the
> > same?

You have to reinstall it, as updatefhem won't upgrade the startup scripts and
won't convert from the AVM directory structure to the fhem.de structure.

The fhem.de installation script tries to preserve your logfiles and to convert
your fhem.cfg.

Rene

unread,
Aug 20, 2012, 2:38:31 AM8/20/12
to fhem-...@googlegroups.com
@Rudolf

ich hab das nun gemacht. Es läuft alles!!!  Nun hab ich aber auf der Fritzbox diese tolle Meldung "Vom Hersteller nicht unterstützte Änderungen: Weitere Informationen.
"  Ich denke das ist nun normal und lässt sich auch nicht beseitigen, oder?

Gruß, René

Carsten

unread,
Aug 20, 2012, 4:21:49 AM8/20/12
to fhem-...@googlegroups.com
Hallo,

die Meldung ist normal, wenn man ein inoffizielles Image einspielt.

Mittel und Wege, um die Meldung wieder loszuwerden, finden sich unter anderem hier.

Nötig ist das aber nur, wenn einen die Meldung nervt. Weitere Auswirkungen hat sie nicht.

Sebastian

unread,
Aug 20, 2012, 8:19:04 AM8/20/12
to fhem-...@googlegroups.com
@Rene

Hallo,
die Meldung kommt auch bei offiziellen Images, wenn man z.B Telnet anschaltet,..

Lg

Sebastian 

Brice

unread,
Aug 28, 2012, 1:52:40 AM8/28/12
to fhem-...@googlegroups.com



Am Freitag, 17. August 2012 17:04:44 UTC+2 schrieb Tapir Fink:
Nur das 4S meiner Frau bucht sich bei Nichtnutzung aus dem WLan aus, mein IPhone 4 bleibt drin, solange ich daheim bin. Das ist etwas ärgerlich, da ich einige Dinge in Abhängigkeit von dem Zu Hause Status schalte.

Ist beim 4S in iTunes WLanSync gesetzt? Das fehlende Flag war bei meinem iPhone der Grund, warum es sich bei Nichtbenutzung aus dem WLan ausgebucht hat.

Stefan

Tapir Fink

unread,
Aug 28, 2012, 3:02:16 PM8/28/12
to fhem-...@googlegroups.com
Hallo Stefan,

genau das war es - danke!!! Das Flag lässt sich erst setzen, wenn das iPhone per Kabel am Rechner steckt - und danach Kabel abziehen - es synchronisiert  weiter über Wlan und macht in Zukunft was es soll. Bei mehrfachem googlen fand ich immer nur Leute, welche sich aufgeregt haben, dass sich Ihre iPhone's sich nicht aus dem Wlan ausgebucht haben...
Jetzt kann ich die Funktionalität Home Status weiter ausbauen.

lg det.
Reply all
Reply to author
Forward
0 new messages