Callmonitor für Anfänger

Begonnen von coolice, 25 Januar 2014, 13:07:36

Vorheriges Thema - Nächstes Thema

hyper2910

habe in 97 geändert

    my $meineFB = $defs{"fb_cmFritz_Box"};


und in 220

$tt = ReadingsVal( "fb_cmFritz_Box", $j . ( $i - 1 ), "-" );


wie angegeben.

Jedoch das gleiche auch nach neustart!


GRuss Dirk
Cubietruck mit FHEM, CUL V3 443MHz, 2 x CULV3 868MHz, Milights, Max Heizungssteuerung, Homematic, IT,

Zephyr

In was hast Du es geändert?
FHEM 5.5 auf Fritz!Box 7390 und Beagle Bone black mit RFXtrx433

hyper2910

In Fritz_Box

Gesendet von meinem SGP521 mit Tapatalk

Cubietruck mit FHEM, CUL V3 443MHz, 2 x CULV3 868MHz, Milights, Max Heizungssteuerung, Homematic, IT,

Zephyr

Hmmm... Tjaaaa. Die Funktion readingsBeginUpdate fehlt offensichtlich.
Aber wieso weiß ich leider so gar nicht.

Kannst Du FHEM in einer aktuellen SVN-Version auf einem Testrechner installieren und schauen ob es dort das gleiche Problem gibt?
FHEM 5.5 auf Fritz!Box 7390 und Beagle Bone black mit RFXtrx433

hyper2910

Hi,


also die allererste Version aus dem Thread funktioniert. Jedoch ohne die Icons


Alle anderen bringen keine Anzeige im Anrufmonitor

Hat jemand noch eine Ahnung wie man auch die Icons bekommt?


#########################################################################
############   Callmonitor mit rollierender Anruferliste:    ############
#########################################################################

###  http://forum.fhem.de/index.php/topic,19238.msg137848.html#msg137848



define Fritz_Box FB_CALLMONITOR 192.168.178.1:1012
attr Fritz_Box local-area-code 02xxx
attr Fritz_Box reverse-search all
attr Fritz_Box reverse-search-cache 1
attr Fritz_Box reverse-search-cache-file ./log/CallmonCache.txt
attr Fritz_Box reverse-search-phonebook-file ./log/Fritz_Box_Telefonbuch.xml
attr Fritz_Box room Telefon
attr Fritz_Box userReadings eing0 eing1 eing2 eing3 eing4 A0 A1 A2 A3 A4 B0 B1 B2 B3 B4 C0 C1 C2 C3 C4 D0 D1 D2 D3 D4 E0 E1 E2 E3 E4
attr Fritz_Box verbose 0

define FileLog_Fritz_Box FileLog ./log/Fritz_Box-%Y.log Fritz_Box
attr FileLog_Fritz_Box logtype text
attr FileLog_Fritz_Box room Telefon

#########################################################################
############            Anrufliste generieren:               ############

#########################################################################

# Telefonevents für Anrufliste abfangen:

define Call_Notify notify Fritz_Box:.* { \
  TelefonMonitor ($EVENT);; \
}
attr Call_Notify room Telefon

# Anzeige der Anrufliste generieren:

define Anrufliste readingsGroup Fritz_Box:A0,B0,C0,D0,E0 Fritz_Box:A1,B1,C1,D1,E1 Fritz_Box:A2,B2,C2,D2,E2 Fritz_Box:A3,B3,C3,D3,E3 Fritz_Box:A4,B4,C4,D4,E4
attr Anrufliste group Telefonliste
attr Anrufliste nameStyle style="font-weight:bold"
attr Anrufliste noheading 0
attr Anrufliste nolinks 1
attr Anrufliste nostate 1
attr Anrufliste notime 1
attr Anrufliste room Telefon
attr Anrufliste style style="font-size:20px"
attr Anrufliste valueIcon {'A0.out_connected' => 'phone_call_out@lightgreen', 'A0.out_notconnected' => 'phone_call_out@red','A0.in_connected' => 'phone_call_in@lightgreen','A0.in_notconnected' => 'phone_call_in@red', 'A0.AB' => 'audio_volume_mid@lightgreen', 'A1.out_connected' => 'phone_call_out@lightgreen', 'A1.out_notconnected' => 'phone_call_out@red','A1.in_connected' => 'phone_call_in@lightgreen','A1.in_notconnected' => 'phone_call_in@red', 'A1.AB' => 'audio_volume_mid@lightgreen','A2.out_connected' => 'phone_call_out@lightgreen', 'A2.out_notconnected' => 'phone_call_out@red','A2.in_connected' => 'phone_call_in@lightgreen','A2.in_notconnected' => 'phone_call_in@red', 'A2.AB' => 'audio_volume_mid@lightgreen','A3.out_connected' => 'phone_call_out@lightgreen', 'A3.out_notconnected' => 'phone_call_out@red','A3.in_connected' => 'phone_call_in@lightgreen','A3.in_notconnected' => 'phone_call_in@red', 'A3.AB' => 'audio_volume_mid@lightgreen','A4.out_connected' => 'phone_call_out@lightgreen', 'A4.out_notconnected' => 'phone_call_out@red','A4.in_connected' => 'phone_call_in@lightgreen','A4.in_notconnected' => 'phone_call_in@red', 'A4.AB' => 'audio_volume_mid@lightgreen'}
# Anzeige mit Icons




#################################################
# $Id: 99_myUtilsTelefon.pm 1932 2012-10-06 20:15:33Z ulimaass $
package main;

use strict;
use warnings;
use POSIX;
use FritzBoxUtils;


# fuer Telefonanrufe
our @A;
our @B;
our @C;
our @D;
our @E;
our %TelefonAktionsListe;


sub
myUtilsTelefon_Initialize($$)
{
  my ($hash) = @_;

 
  #...
 

}
################################################################


sub SendSMS ($$)
{
  my $adress = $_[0].'@sms.kundenserver.de';
   my $body = $_[1];
   Log (3,"SendSMS: $adress - $body");
   FB_mail($adress,"",$body);
# end sub SendSMS
}
#####################################
# Anruffunktionen ueber Fritzbox

sub
FBCall ($$)
{

my $callnr = $_[0];
my $duration = $_[1];

Log(3,"FBCall: $callnr mit Dauer $duration");


$callnr = "ATDT".$callnr."#";
my $ret = "ATD: " . `echo $callnr | nc 127.0.0.1 1011`;
InternalTimer(gettimeofday()+$duration, "FBHangOn", "", 0);
return;
}

sub FBHangOn ()
{
Log(3,"FBCallHangOn aufgerufen");

my $ret = " ATH: " . `echo "ATH" | nc 127.0.0.1 1011`;
$ret =~ s,[\r\n]*,,g;
return;
}

######################################

sub TelefonAktion($$)
{
# es wird der Name und die interne angerufene Nummer uebergeen

my ($caller) = split ('\(',$_[0]);
$caller = ltrim(rtrim($caller));

my $intern = $_[1];

# Log(3,"TelefonAktion: $caller $intern");
# Sound ausgeben

my $com = $main::TelefonAktionsListe{$caller};

if ($com)
{
    Log(3,"TelefonAktion: commando: $com");
   sig2_repeat($com,5,4);
} # falls commando vorhanden

} # end sub TelefonAktion

######################################
# EventZeit: Die Zeit wird nicht in der fhem-Reihenfolge, sondern für "human Interface" dargestellt
sub EventZeit()
{
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time());
return sprintf ("%2d:%02d:%02d %2d.%02d.%4d", $hour,$min,$sec,$mday,($mon+1),($year+1900));
} # end sub EventZeit

######################################


sub TelefonMonitor($)
{
our $extnum;
our $intnum;
our $extname;
our $callID;
our $callDuration;
our $stat;
my $i; my $j;
our $ab;
my $Fritz_Box = $defs{"Fritz_Box"};

my ($event,$arg) = split (':',$_[0]);
$arg = ltrim($arg);

# Log(3,"TM: event: $event arg: $arg");
if ($event eq "event")
{
$stat = $arg;
if ($arg eq "disconnect")
  {
#    fhem("set msg2_TVMarina MUTE 0");
#    fhem("set msg2_TVWohnzimmer MUTE 0");
#    sig2_break(); fiedel: -> Funktion um Anrufername auf FS20SIG2 auszugeben (nicht genutzt)
#    sig2(70); # ringout
  } # if disconnect
    return;
} # end if event

if ($stat eq "ring")
{
if ($event eq"external_number")
  {
    $extnum = $arg;
return;
} # if external number


if ($event eq "external_name")
  {
    $extname = $arg;
   return;
}
if ($event eq "internal_number")
  {
    $intnum = $arg;
   return;
   } # end if intnum


if ($event eq "call_id")
{
   $callID = $arg;
# hier koennen wir eine anrufgesteuerte Aktion starten
TelefonAktion($extname, $intnum);

$A[$callID] = "-> ";
   $B[$callID] = EventZeit();
   $C[$callID] = $extname;
   $D[$callID] = $extnum;
# fiedel: Folgende Dummys bzw. Funktionen in der CFG einrichten, wenn Samsung TV vorhanden!
#    fhem("set msg2_TVMarina MUTE 1");
#    fhem("set msg2_TVWohnzimmer MUTE 1");
#    fhem("set msg1_TVMarina call Anruf von $extname $extnum");
#    fhem("set msg1_TVWohnzimmer call Anruf von $extname $extnum");
   return;
   } # end if callid
return;
} # end if ring loop

if ($stat eq "connect")
{
if (($event eq"internal_connection") &&
     ($arg =~m/Answering_Machine_.*/))
    {
    $ab = "ab";
    } # end if internal_connection
if ($event eq "call_id")
{
   $callID = $arg;
if ($ab && ($ab eq "AB")) {$A[$callID] = "AB"; $ab; }
   $ab = undef; # zuruecksetzen
   } # end if  callID
   } # end if connect


if ($stat eq "call")
{
if ($event eq"external_number")
  {
    $extnum = $arg;
#sig2(70); # ringout
return;   
} # if external number

if ($event eq "external_name")
  {
    $extname = $arg;
   return;
}
if ($event eq "call_id")
{
   $callID = $arg;
$A[$callID] = "<-";
   $B[$callID] = EventZeit();
   $C[$callID] = $extname;
   $D[$callID] = $extnum;

   return;
   } # end if callid
return;
} # end if callloop



if ($stat eq "disconnect")
{


if ($event eq "call_duration")
{
  $callDuration = sprintf("%2d:%02d", ($arg/60),$arg%60);
  return;
} # if call_duration


if ($event eq "call_id")
   {
   $callID = $arg;
# shiften der alten Inhalte
   my $tt;
    readingsBeginUpdate($Fritz_Box);

    for ($i=4;$i>0; $i--)
    {
   foreach $j ('A'..'E')
   {
#   $defs{"Fritz_Box"}{READINGS}{$j.($i-1)}{VAL};

    $tt = ReadingsVal("Fritz_Box",$j.($i-1),"-");
   readingsBulkUpdate($Fritz_Box,$j.$i,$tt);
   } # end j
   } # end i
   $E[$callID] = $callDuration;
  readingsBulkUpdate($Fritz_Box,"A0",$A[$callID]);
  readingsBulkUpdate($Fritz_Box,"B0",$B[$callID]);
  readingsBulkUpdate($Fritz_Box,"C0",$C[$callID]);
  readingsBulkUpdate($Fritz_Box,"D0",$D[$callID]);
  readingsBulkUpdate($Fritz_Box,"E0",$E[$callID]);

  readingsEndUpdate($Fritz_Box, 1);
   $stat = "";

   return;
   } # end if callid


} # end if disconnect

##############################
} #end sub TelefonMonitor
1;
Cubietruck mit FHEM, CUL V3 443MHz, 2 x CULV3 868MHz, Milights, Max Heizungssteuerung, Homematic, IT,

Zephyr

Ooookay, ich versuche es mal weiter...

Könntest Du in der Zeile #Log(3,"event: $event; arg: $arg"); das # wegmachen, die 99_myUtilsTelefon mit reload 99_myUtilsTelefon neuladen, dann einen Anruf tätigen und den Inhalt des Logs bitte posten?

Es scheint, als würde bei Dir die Verzweigung
if ($event eq "call_id") { ... nicht ausgeführt werden. Daher wird kein readginsBeginUpdate gemacht und das readingsBulkUpdate schlägt fehl.

Aber das ist nur eine dunkle Vermutung.
FHEM 5.5 auf Fritz!Box 7390 und Beagle Bone black mit RFXtrx433

hyper2910

hi,


so habe die alte CFg wieder genommen,

hier das log, es wird wieder nichts in der Anrufliste angezeigt:

2014.05.26 16:07:02 1: readingsUpdate(,A4,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,B4,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,C4,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,D4,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,E4,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,A3,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,B3,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,C3,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,D3,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,E3,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,A2,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,B2,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,C2,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,D2,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,E2,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,A1,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,B1,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,C1,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,D1,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,E1,-) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,A0,in_connected) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,B0,16:06:26 26.05.2014) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,C0,Dirk) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,D0,xxxx20394949xxx) missed to call readingsBeginUpdate first.
2014.05.26 16:07:02 1: readingsUpdate(,E0, 0:27) missed to call readingsBeginUpdate first.
Cubietruck mit FHEM, CUL V3 443MHz, 2 x CULV3 868MHz, Milights, Max Heizungssteuerung, Homematic, IT,

Zephyr

was sagt denn der EventMonitor, wenn Du wieder auf die funktionierende Version zurückspringst und während eines Anrufes mal schaust und postet, was im EventMonitor angezeigt wird?
FHEM 5.5 auf Fritz!Box 7390 und Beagle Bone black mit RFXtrx433

hyper2910

Das hier kommt im eventmonitor bei der funktionierenden
ts:
2014-05-26 18:36:50 FB_CALLMONITOR Fritz_Box event: ring
2014-05-26 18:36:50 FB_CALLMONITOR Fritz_Box external_number: 010533
2014-05-26 18:36:50 FB_CALLMONITOR Fritz_Box external_name: Dirk
2014-05-26 18:36:50 FB_CALLMONITOR Fritz_Box internal_number: 750
2014-05-26 18:36:50 FB_CALLMONITOR Fritz_Box external_connection: SIP0
2014-05-26 18:36:50 FB_CALLMONITOR Fritz_Box call_id: 0
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box event: disconnect
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box call_duration: 0
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box missed_call: 0133 (Dirk)
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box missed_call_line: 750
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box call_id: 0
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box A4: ->
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box B4: 7:16:47 26.05.2014
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box C4: Dirk
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box D4: 0133
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box E4: 0:04
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box A3: <-
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box B3: 7:19:58 26.05.2014
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box C3: Dirk
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box D3: 0133
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box E3: 0:09
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box A2: ->
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box B2: 13:40:57 26.05.2014
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box C2: unknown
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box D2: 0176
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box E2: 0:11
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box A1: -> 
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box B1: 16:58:34 26.05.2014
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box C1: unknown
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box D1: 015676
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box E1: 6:14
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box A0: -> 
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box B0: 18:36:50 26.05.2014
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box C0: Dirk
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box D0: 0173
2014-05-26 18:36:56 FB_CALLMONITOR Fritz_Box E0: 0:00

Gesendet von meinem SGP521 mit Tapatalk

Cubietruck mit FHEM, CUL V3 443MHz, 2 x CULV3 868MHz, Milights, Max Heizungssteuerung, Homematic, IT,

Zephyr

Damit kann ich etwas anfangen, danke. Muss aber ein paar Tage warten. Habe ab nächster Woche Urlaub und kann dann in Ruhe reinschauen. Im Moment ist noch ein bisschen was abzugeben.
FHEM 5.5 auf Fritz!Box 7390 und Beagle Bone black mit RFXtrx433

Elektrolurch

Hallo,

eigentlich sieht der Auszug aus dem Eventmonitor ok aus. Nach Abschluss des Anrufes schiebt das Modul die Werte nach oben, dass sind die A4 - A0,..E4..E0 Einträge.
Die Meldung mit dem readingsBulkUpdate lässt eher darauf schliessen, dass der Name der Fritzbox-Instanz nicht in ein korrektes Hash für den ersten Parameter der readingsBeginUpdate/readingsBulkUpdate umgewandelt wird.

Dies erfolgt mit einer Anweisung der Art:

my $hash = $defs{'name-des-Objektes'};

und die readingsBeginUpdate wird dann mit($hash...
aufgerufen.

Bei mir im Original heisst die Instanz des CallMonitors 'meineFB'. Das muss natürlich dann im Modul angepast werden.

Werde das ganze bei Gelegenheit noch Mal etwas überarbeiten, denn der Name der Instanz des Callmonitors kommt auch im Event mit und kann so auch verwendet werden.

Gruß

Elektrolurch
configDB und Windows befreite Zone!

micomat

Auch auf die Gefahr aus dem Fred gejagt zu werden...  ;D
Welche Modulversion/Config ist denn nun die aktuellste und funktioniert auch noch?

Markus
Synology DS218+ with fhem+iobroker in docker, 2x RasPi w. ser2net, CUL433+868, IT, EGPM2LAN, THZ/LWZ, FB_Callmonitor, HMS100TF, Homematic, 2x TX3-TH, Pushover, USB-IR-SML-Head, SONOS, GHoma, MBus, KLF200

Elektrolurch

Hallo,

hatte da noch einen Fehler gefunden, und zwar wenn man die Box nicht "meineFB" genannt hatte.
Habe das gefixt und verwende nun über das notify den Namen der Box. Daher ist die Rotine nun mit zwei Parametern aufzurufen.
Außerdem wird der loglevel für die Routine nun durch den loglevel (attr verbose) der aufrufenden Fritzbox bestimmt.

notify:
define Call_Notify notify meineFB:.* { \
  TelefonMonitor ($NAME,$EVENT);; \
}


Noch ein Hinweis:
Für die Darstellung wird eine readingsGroup verwendet. Zur Ausgabe der Zeilennummer habe ich dort eine Änderung gemacht:
http://forum.fhem.de/index.php/topic,14608.msg172346/topicseen.html#msg172346

Gruß

Elektrolurch
configDB und Windows befreite Zone!

svemo

#163
Hallo

hier sind so viele schnipsel in den einzelnen Postings.

kann mir jemand mal eine Funktionierende komplette Posten bitte.

Steige bei den Treads nicht mehr durch.

DAnke

Nachtrag Keine Anzeige in der Anrufliste:

Fehler laut LOG:

2014.05.31 10:50:26 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 40) line 2.

2014.05.31 10:50:26 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 41) line 2.

2014.05.31 10:50:26 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 42) line 2.

2014.05.31 10:50:26 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 43) line 2.

2014.05.31 10:50:26 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 44) line 2.

2014.05.31 10:50:26 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 45) line 2.

2014.05.31 10:50:45 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 55) line 2.

2014.05.31 10:50:45 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 56) line 2.

2014.05.31 10:50:45 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 57) line 2.

2014.05.31 10:50:46 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 61) line 2.

2014.05.31 10:50:46 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 62) line 2.

2014.05.31 10:50:46 3: Call_Notify return value: Undefined subroutine &main::TelefonMonitor called at (eval 63) line 2.

Elektrolurch

Ein Post höher steht die Datei und die Erklärung!
Die Version ist aktuell.
configDB und Windows befreite Zone!