2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

11_OWDevice: bugfix for new attribute disable (forum #122563)

git-svn-id: https://svn.fhem.de/fhem/trunk@24882 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2021-08-28 16:40:02 +00:00
parent 2923683196
commit 4c74ebb96a
2 changed files with 16 additions and 23 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # Do not insert empty lines here, update check depends on it.
- bugfix: 11_OWDevice: bugfix for new attribute disable (forum #122563)
- feature: 57_Calendar: new attribute timeout - feature: 57_Calendar: new attribute timeout
- change: 10_KNX: major rewrite of the module. pls. check forum - change: 10_KNX: major rewrite of the module. pls. check forum
https://forum.fhem.de/index.php/topic,122582.0.html https://forum.fhem.de/index.php/topic,122582.0.html

View File

@ -378,8 +378,8 @@ OWDevice_Initialize($)
$hash->{GetFn} = "OWDevice_Get"; $hash->{GetFn} = "OWDevice_Get";
$hash->{SetFn} = "OWDevice_Set"; $hash->{SetFn} = "OWDevice_Set";
$hash->{DefFn} = "OWDevice_Define"; $hash->{DefFn} = "OWDevice_Define";
$hash->{NotifyFn} = "OWDevice_Notify"; #$hash->{NotifyFn} = "OWDevice_Notify";
$hash->{NotifyOrderPrefix}= "50b-"; #$hash->{NotifyOrderPrefix}= "50b-";
$hash->{UndefFn} = "OWDevice_Undef"; $hash->{UndefFn} = "OWDevice_Undef";
$hash->{AttrFn} = "OWDevice_Attr"; $hash->{AttrFn} = "OWDevice_Attr";
@ -580,11 +580,11 @@ OWDevice_Attr($@)
delete $hash->{fhem}{interfaces} if(defined($hash->{fhem}{interfaces})); delete $hash->{fhem}{interfaces} if(defined($hash->{fhem}{interfaces}));
Log3 $name, 5, "$name: no interfaces"; Log3 $name, 5, "$name: no interfaces";
} }
} } elsif($attrName eq "disable" && ($cmd eq 'del' || !$attrVal)) { # restart after disable
elsif($attrName eq "disable" && ($cmd eq 'del' || $attrVal == 0)) { # restart after disable $init_done ? RemoveInternalTimer($hash)
RemoveInternalTimer($hash); : RemoveInternalTimer("OWDevice_UpdateValues");# just to be sure...;
InternalTimer(int(gettimeofday()) + $hash->{fhem}{interval}, "OWDevice_UpdateValues", $hash, 0) InternalTimer(int(gettimeofday()) + $hash->{fhem}{interval}, "OWDevice_UpdateValues", $hash, 0)
if(defined($hash->{fhem}{interval})); if defined $hash->{fhem}{interval};
} }
} }
@ -702,27 +702,18 @@ OWDevice_Define($$)
$hash->{fhem}{alerting}= $alerting; $hash->{fhem}{alerting}= $alerting;
Log3 $name, 5, "$name: alerting: $alerting"; Log3 $name, 5, "$name: alerting: $alerting";
$hash->{NOTIFYDEV} = "global"; InternalTimer(int(gettimeofday())+ 12, 'OWDevice_Start', $hash, 0); # wait for fhem ready
if( $init_done ) {
OWDevice_InitValues($hash);
OWDevice_UpdateValues($hash) if(defined($hash->{fhem}{interval}));
}
return undef; return undef;
} }
sub sub
OWDevice_Notify($$) OWDevice_Start($$)
{ {
my ($hash,$dev) = @_; my ($hash,$dev) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $type = $hash->{TYPE}; my $type = $hash->{TYPE};
return if($dev->{NAME} ne "global"); return if IsDisabled( $name );
return if(!grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
return if($attr{$name} && $attr{$name}{disable} == 1);
OWDevice_InitValues($hash); OWDevice_InitValues($hash);
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
@ -731,8 +722,9 @@ OWDevice_Notify($$)
Log3 $name, 5, "$name: initial delay: $delay"; Log3 $name, 5, "$name: initial delay: $delay";
InternalTimer(int(gettimeofday())+$delay, "OWDevice_UpdateValues", $hash, 0) if(defined($hash->{fhem}{interval})); InternalTimer(int(gettimeofday())+$delay, "OWDevice_UpdateValues", $hash, 0) if(defined($hash->{fhem}{interval}));
return undef; return;
} }
sub sub
OWDevice_InitValues($) OWDevice_InitValues($)
{ {