2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 02:10:32 +00:00

use NOTIFYDEV

git-svn-id: https://svn.fhem.de/fhem/trunk@4730 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2014-01-24 19:38:03 +00:00
parent 64927fb3e2
commit c00730d6d8
4 changed files with 12 additions and 32 deletions

View File

@ -26,6 +26,7 @@ sub HUEBridge_Initialize($)
#Consumer
$hash->{DefFn} = "HUEBridge_Define";
$hash->{NOTIFYDEV} = "global";
$hash->{NotifyFn} = "HUEBridge_Notify";
$hash->{SetFn} = "HUEBridge_Set";
$hash->{GetFn} = "HUEBridge_Get";
@ -91,7 +92,6 @@ HUEBridge_Define($$)
}
if( $init_done ) {
delete $modules{$hash->{TYPE}}{NotifyFn};
HUEBridge_OpenDev( $hash );
}
@ -109,13 +109,7 @@ HUEBridge_Notify($$)
return if($attr{$name} && $attr{$name}{disable});
delete $modules{$type}{NotifyFn};
delete $hash->{NTFY_ORDER} if($hash->{NTFY_ORDER});
foreach my $d (keys %defs) {
next if($defs{$d}{TYPE} ne "$type");
HUEBridge_OpenDev($defs{$d});
}
HUEBridge_OpenDev($hash);
return undef;
}

View File

@ -32,6 +32,7 @@ mailcheck_Initialize($)
$hash->{ReadFn} = "mailcheck_Read";
$hash->{DefFn} = "mailcheck_Define";
$hash->{NOTIFYDEV} = "global";
$hash->{NotifyFn} = "mailcheck_Notify";
$hash->{UndefFn} = "mailcheck_Undefine";
#$hash->{SetFn} = "mailcheck_Set";
@ -80,7 +81,6 @@ mailcheck_Define($$)
$hash->{HAS_MIME} = $mailcheck_hasMIME;
if( $init_done ) {
delete $modules{mailcheck}->{NotifyFn};
mailcheck_Disconnect($hash);
mailcheck_Connect($hash);
} elsif( $hash->{STATE} ne "???" ) {
@ -98,12 +98,7 @@ mailcheck_Notify($$)
return if($dev->{NAME} ne "global");
return if(!grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
delete $modules{$hash->{TYPE}}->{NotifyFn};
foreach my $d (keys %defs) {
next if($defs{$d}{TYPE} ne $hash->{TYPE});
mailcheck_Connect($defs{$d});
}
mailcheck_Connect($hash);
}
sub

View File

@ -40,6 +40,7 @@ withings_Initialize($)
my ($hash) = @_;
$hash->{DefFn} = "withings_Define";
$hash->{NOTIFYDEV} = "global";
$hash->{NotifyFn} = "withings_Notify";
$hash->{UndefFn} = "withings_Undefine";
#$hash->{SetFn} = "withings_Set";
@ -117,7 +118,6 @@ withings_Define($$)
$hash->{STATE} = "Initialized";
if( $init_done ) {
delete $modules{withings}->{NotifyFn};
withings_initUser($hash) if( $hash->{SUBTYPE} eq "USER" );
withings_connect($hash) if( $hash->{SUBTYPE} eq "ACCOUNT" );
withings_initDevice($hash) if( $hash->{SUBTYPE} eq "DEVICE" );
@ -134,14 +134,9 @@ withings_Notify($$)
return if($dev->{NAME} ne "global");
return if(!grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
delete $modules{$hash->{TYPE}}->{NotifyFn};
foreach my $d (keys %defs) {
next if($defs{$d}{TYPE} ne $hash->{TYPE});
withings_initUser($defs{$d}) if( $defs{$d}->{SUBTYPE} eq "USER" );
withings_connect($defs{$d}) if( $defs{$d}->{SUBTYPE} eq "ACCOUNT" );
withings_initDevice($defs{$d}) if( $defs{$d}->{SUBTYPE} eq "DEVICE" );
}
withings_initUser($hash) if( $hash->{SUBTYPE} eq "USER" );
withings_connect($hash) if( $hash->{SUBTYPE} eq "ACCOUNT" );
withings_initDevice($hash) if( $hash->{SUBTYPE} eq "DEVICE" );
}
sub

View File

@ -16,6 +16,7 @@ CO20_Initialize($)
my ($hash) = @_;
$hash->{DefFn} = "CO20_Define";
$hash->{NOTIFYDEV} = "global";
$hash->{NotifyFn} = "CO20_Notify";
$hash->{UndefFn} = "CO20_Undefine";
#$hash->{SetFn} = "CO20_Set";
@ -47,7 +48,6 @@ CO20_Define($$)
$hash->{NAME} = $name;
if( $init_done ) {
delete $modules{CO20}->{NotifyFn};
CO20_Disconnect($hash);
CO20_Connect($hash);
} elsif( $hash->{STATE} ne "???" ) {
@ -62,14 +62,10 @@ CO20_Notify($$)
{
my ($hash,$dev) = @_;
if( grep(m/^INITIALIZED$/, @{$dev->{CHANGED}}) ) {
delete $modules{CO20}->{NotifyFn};
return if($dev->{NAME} ne "global");
return if(!grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
foreach my $d (keys %defs) {
next if($defs{$d}{TYPE} ne "CO20");
CO20_Connect($defs{$d});
}
}
CO20_Connect($hash);
}
my $VENDOR = 0x03eb;