diff --git a/FHEM/00_OWX_ASYNC.pm b/FHEM/00_OWX_ASYNC.pm index 8a97b63ae..9207a786c 100644 --- a/FHEM/00_OWX_ASYNC.pm +++ b/FHEM/00_OWX_ASYNC.pm @@ -232,12 +232,12 @@ sub OWX_ASYNC_Define ($$) { sub OWX_ASYNC_Attr(@) { my ($do,$name,$key,$value) = @_; - + my $hash = $main::defs{$name}; my $ret; - + if ( $do eq "set") { - ARGUMENT_HANDLER: { + SET_HANDLER: { $key eq "interval" and do { $hash->{interval} = $value; if ($main::init_done) { @@ -245,6 +245,44 @@ sub OWX_ASYNC_Attr(@) { } last; }; + $key eq "buspower" and do { + if ($value eq "parasitic" and (defined $hash->{dokick}) and $hash->{dokick} ne "ignored") { + $hash->{dokick} = "ignored"; + Log3($name,3,"OWX_ASYNC: ignoring attribute dokick because buspower is parasitic"); + } elsif ($value eq "real" and (defined $hash->{dokick}) and $hash->{dokick} eq "ignored") { + $hash->{dokick} = $main::attr{$name}{dokick}; + } + last; + }; + $key eq "dokick" and do { + if ($main::attr{$name}{"buspower"} and $main::attr{$name}{"buspower"} eq "parasitic" and ((!defined $hash->{dokick}) or $hash->{dokick} ne "ignored")) { + $hash->{dokick} = "ignored"; + Log3($name,3,"OWX_ASYNC: ignoring attribute dokick because buspower is parasitic"); + } else { + $hash->{dokick} = $value; + } + last; + }; + } + } elsif ( $do eq "del" ) { + DEL_HANDLER: { + $key eq "interval" and do { + $hash->{interval} = 300; + if ($main::init_done) { + OWX_ASYNC_Kick($hash); + } + last; + }; + $key eq "buspower" and do { + if ((defined $hash->{dokick}) and $hash->{dokick} eq "ignored") { + $hash->{dokick} = $main::attr{$name}{dokick}; + } + last; + }; + $key eq "dokick" and do { + delete $hash->{dokick}; + last; + }; } } return $ret; @@ -780,7 +818,7 @@ sub OWX_ASYNC_Kick($) { my ($thread) = @_; PT_BEGIN($thread); #-- Only if we have the dokick attribute set to 1 - if (main::AttrVal($hash->{NAME},"dokick",0)) { + if ((defined $hash->{dokick}) and $hash->{dokick} eq "1") { Log3 $hash->{NAME},5,"OWX_ASYNC_PT_Kick: kicking DS14B20 temperature conversion"; #-- issue the skip ROM command \xCC followed by start conversion command \x44 $thread->{pt_execute} = OWX_ASYNC_PT_Execute($hash,1,undef,"\x44",0); @@ -1224,10 +1262,14 @@ sub OWX_ASYNC_RunTasks($) {