2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-07 16:59:18 +00:00

FB_CALLMONITOR: read phonebooks after all attributes are set from fhem.cfg. (Forum: #30244)

git-svn-id: https://svn.fhem.de/fhem/trunk@7647 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2015-01-20 22:29:55 +00:00
parent 4ad1b145d5
commit 7edb91224e
2 changed files with 25 additions and 10 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- bugfix: FB_CALLMONITOR: read phonebooks after all attributes are set
from fhem.cfg.
- feature: 70_XBMC.pm: clear readings when stopping media
- feature: 70_XBMC.pm: new reading is3DFile for 3D files
- bugfix: 70_XBMC.pm: improved JSON separator

View File

@ -81,14 +81,16 @@ FB_CALLMONITOR_Initialize($)
my ($hash) = @_;
# Provider
$hash->{ReadFn} = "FB_CALLMONITOR_Read";
$hash->{ReadyFn} = "FB_CALLMONITOR_Ready";
$hash->{GetFn} = "FB_CALLMONITOR_Get";
$hash->{SetFn} = "FB_CALLMONITOR_Set";
$hash->{DefFn} = "FB_CALLMONITOR_Define";
$hash->{UndefFn} = "FB_CALLMONITOR_Undef";
$hash->{AttrFn} = "FB_CALLMONITOR_Attr";
$hash->{AttrList}= "do_not_notify:0,1 disable:0,1 unique-call-ids:0,1 local-area-code remove-leading-zero:0,1 reverse-search-cache-file reverse-search:multiple-strict,phonebook,klicktel.de,dasoertliche.de,search.ch,dasschnelle.at reverse-search-cache:0,1 reverse-search-phonebook-file fritzbox-remote-phonebook:0,1 fritzbox-user ".
$hash->{ReadFn} = "FB_CALLMONITOR_Read";
$hash->{ReadyFn} = "FB_CALLMONITOR_Ready";
$hash->{GetFn} = "FB_CALLMONITOR_Get";
$hash->{SetFn} = "FB_CALLMONITOR_Set";
$hash->{DefFn} = "FB_CALLMONITOR_Define";
$hash->{UndefFn} = "FB_CALLMONITOR_Undef";
$hash->{AttrFn} = "FB_CALLMONITOR_Attr";
$hash->{NotifyFn} = "FB_CALLMONITOR_Notify";
$hash->{NOTIFYDEV} = "global";
$hash->{AttrList} = "do_not_notify:0,1 disable:0,1 unique-call-ids:0,1 local-area-code remove-leading-zero:0,1 reverse-search-cache-file reverse-search:multiple-strict,phonebook,klicktel.de,dasoertliche.de,search.ch,dasschnelle.at reverse-search-cache:0,1 reverse-search-phonebook-file fritzbox-remote-phonebook:0,1 fritzbox-user ".
$readingFnAttributes;
}
@ -334,7 +336,8 @@ FB_CALLMONITOR_Attr($@)
if($cmd eq "set")
{
if(($attrib eq "reverse-search" and $value =~ /(all|internal|phonebook)/) or $attrib eq "reverse-search-phonebook-file" or $attrib eq "fritzbox-remote-phonebook")
if((($attrib eq "reverse-search" and $value =~ /(all|internal|phonebook)/) or $attrib eq "reverse-search-phonebook-file" or $attrib eq "fritzbox-remote-phonebook") and $init_done == 1)
{
$attr{$name}{$attrib} = $value;
return FB_CALLMONITOR_readPhonebook($hash);
@ -380,6 +383,17 @@ FB_CALLMONITOR_Attr($@)
return undef;
}
sub
FB_CALLMONITOR_Notify($$)
{
my ($hash,$dev) = @_;
return if($dev->{NAME} ne "global");
return if(!grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
FB_CALLMONITOR_readPhonebook($hash);
}
############################################################################################################
#
# Begin of helper functions
@ -640,7 +654,6 @@ sub FB_CALLMONITOR_readPhonebook($;$$)
if(AttrVal($name, "fritzbox-remote-phonebook", "0") eq "1")
{
($err, $phonebook) = FB_CALLMONITOR_readRemotePhonebook($hash);
if(defined($err))