2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 11:26:55 +00:00

OWX_ASYNC add attribute 'buspower' to support devices stealing power from data-line

git-svn-id: https://svn.fhem.de/fhem/trunk@6338 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess 2014-07-31 20:29:24 +00:00
parent 1f20b538e0
commit 012b859739
2 changed files with 51 additions and 9 deletions

View File

@ -237,7 +237,7 @@ sub OWX_ASYNC_Attr(@) {
my $ret; my $ret;
if ( $do eq "set") { if ( $do eq "set") {
ARGUMENT_HANDLER: { SET_HANDLER: {
$key eq "interval" and do { $key eq "interval" and do {
$hash->{interval} = $value; $hash->{interval} = $value;
if ($main::init_done) { if ($main::init_done) {
@ -245,6 +245,44 @@ sub OWX_ASYNC_Attr(@) {
} }
last; 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; return $ret;
@ -780,7 +818,7 @@ sub OWX_ASYNC_Kick($) {
my ($thread) = @_; my ($thread) = @_;
PT_BEGIN($thread); PT_BEGIN($thread);
#-- Only if we have the dokick attribute set to 1 #-- 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"; Log3 $hash->{NAME},5,"OWX_ASYNC_PT_Kick: kicking DS14B20 temperature conversion";
#-- issue the skip ROM command \xCC followed by start conversion command \x44 #-- issue the skip ROM command \xCC followed by start conversion command \x44
$thread->{pt_execute} = OWX_ASYNC_PT_Execute($hash,1,undef,"\x44",0); $thread->{pt_execute} = OWX_ASYNC_PT_Execute($hash,1,undef,"\x44",0);
@ -1225,9 +1263,13 @@ sub OWX_ASYNC_RunTasks($) {
<li><a name="OWX_ASYNCdokick"><code>attr &lt;name&gt; dokick 0|1</code></a> <li><a name="OWX_ASYNCdokick"><code>attr &lt;name&gt; dokick 0|1</code></a>
<br />1 if the interface regularly kicks thermometers on the bus to do a temperature conversion, <br />1 if the interface regularly kicks thermometers on the bus to do a temperature conversion,
and to perform an alarm check, 0 if not</li> and to perform an alarm check, 0 if not</li>
<li><a name="OWX_ASYNCbuspower"><code>attr &lt;name&gt; buspower real|parasitic</code></a>
<br />parasitic if there are any devices on the bus that steal power from the data line.
<br />Ensures that never more than a single device on the bus is talked to (throughput is throttled noticable!)
<br />Automatically disables attribute 'dokick'.</li>
<li><a name="OWX_ASYNCIODev"><code>attr &lt;name&gt; IODev &lt;FRM-device&gt;</code></a> <li><a name="OWX_ASYNCIODev"><code>attr &lt;name&gt; IODev &lt;FRM-device&gt;</code></a>
<br />assignes a specific FRM-device to OWX_ASYNC when working through an Arduino. <br />assignes a specific FRM-device to OWX_ASYNC when working through an Arduino.
Required only if there is more than one FRM defined.</li> <br />Required only if there is more than one FRM defined.</li>
<li><a name="OWX_ASYNCmaxtimeouts"><code>attr &lt;name&gt; maxtimeouts &lt;number&gt;</code></a> <li><a name="OWX_ASYNCmaxtimeouts"><code>attr &lt;name&gt; maxtimeouts &lt;number&gt;</code></a>
<br />maximum number of timeouts (in a row) before OWX_ASYNC disconnects itself from the <br />maximum number of timeouts (in a row) before OWX_ASYNC disconnects itself from the
busmaster and tries to establish a new connection</li> busmaster and tries to establish a new connection</li>

View File

@ -86,7 +86,7 @@ no warnings 'deprecated';
sub Log3($$$); sub Log3($$$);
sub AttrVal($$$); sub AttrVal($$$);
my $owx_version="5.23"; my $owx_version="5.24";
my %gets = ( my %gets = (
"id" => "", "id" => "",
@ -627,8 +627,8 @@ sub OWTHERM_InitializeDevice($) {
#-- Check if temperature conversion is consistent #-- Check if temperature conversion is consistent
if( $interface =~ /^OWX/ ){ if( $interface =~ /^OWX/ ){
if( defined($attr{$name}{tempConv}) && ( $attr{$name}{tempConv} eq "onkick") ){ if( defined($attr{$name}{tempConv}) && ( $attr{$name}{tempConv} eq "onkick") ){
if( !(defined($attr{$hash->{IODev}->{NAME}}{dokick})) || if( !(defined($hash->{IODev}->{dokick})) ||
( defined($attr{$hash->{IODev}->{NAME}}{dokick}) && ($attr{$hash->{IODev}->{NAME}}{dokick} eq "0") )){ ( defined($hash->{IODev}->{dokick}) && ($hash->{IODev}->{dokick} ne "1") )){
Log3 $name, 1,"OWTHERM: Attribute tempConv=onkick changed to onread for $name because interface is not kicking"; Log3 $name, 1,"OWTHERM: Attribute tempConv=onkick changed to onread for $name because interface is not kicking";
$attr{$name}{tempConv}="onread"; $attr{$name}{tempConv}="onread";
} }