mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 23:06:37 +00:00
36_LaCrosse.pm: added corr1 and corr2 correction offsets
git-svn-id: https://svn.fhem.de/fhem/trunk@7027 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1286f3041b
commit
a7e2740c65
@ -39,8 +39,8 @@ LaCrosse_Define($$)
|
|||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
|
|
||||||
if(@a != 3 ) {
|
if(int(@a) < 3 || int(@a) > 5) {
|
||||||
my $msg = "wrong syntax: define <name> LaCrosse <addr>";
|
my $msg = "wrong syntax: define <name> LaCrosse <addr> [corr1...corr2]";
|
||||||
Log3 undef, 2, $msg;
|
Log3 undef, 2, $msg;
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
@ -51,6 +51,12 @@ LaCrosse_Define($$)
|
|||||||
my $name = $a[0];
|
my $name = $a[0];
|
||||||
my $addr = $a[2];
|
my $addr = $a[2];
|
||||||
|
|
||||||
|
$hash->{corr1} = ((int(@a) > 3) ? $a[3] : 0);
|
||||||
|
$hash->{corr2} = ((int(@a) > 4) ? $a[4] : 0);
|
||||||
|
#$hash->{corr3} = ((int(@a) > 5) ? $a[5] : 0);
|
||||||
|
#$hash->{corr4} = ((int(@a) > 6) ? $a[6] : 0);
|
||||||
|
|
||||||
|
|
||||||
#return "$addr is not a 1 byte hex value" if( $addr !~ /^[\da-f]{2}$/i );
|
#return "$addr is not a 1 byte hex value" if( $addr !~ /^[\da-f]{2}$/i );
|
||||||
#return "$addr is not an allowed address" if( $addr eq "00" );
|
#return "$addr is not an allowed address" if( $addr eq "00" );
|
||||||
|
|
||||||
@ -263,12 +269,12 @@ LaCrosse_Parse($$)
|
|||||||
$temperature = int($temperature*10 + 0.5) / 10;
|
$temperature = int($temperature*10 + 0.5) / 10;
|
||||||
$humidity = int($humidity*10 + 0.5) / 10;
|
$humidity = int($humidity*10 + 0.5) / 10;
|
||||||
|
|
||||||
readingsBulkUpdate($rhash, "temperature$channel", $temperature);
|
readingsBulkUpdate($rhash, "temperature$channel", $temperature + $rhash->{corr1});
|
||||||
readingsBulkUpdate($rhash, "humidity$channel", $humidity) if( $humidity && $humidity <= 99 );
|
readingsBulkUpdate($rhash, "humidity$channel", $humidity + $rhash->{corr2} ) if( $humidity && $humidity <= 99 );
|
||||||
|
|
||||||
if( !$channel ) {
|
if( !$channel ) {
|
||||||
my $state = "T: $temperature";
|
my $state = "T: ". ($temperature + $rhash->{corr1});
|
||||||
$state .= " H: $humidity" if( $humidity && $humidity <= 99 );
|
$state .= " H: ". ($humidity + $rhash->{corr2}) if( $humidity && $humidity <= 99 );
|
||||||
$state .= " D: $dewpoint" if( $dewpoint );
|
$state .= " D: $dewpoint" if( $dewpoint );
|
||||||
readingsBulkUpdate($rhash, "state", $state) if( Value($rname) ne $state );
|
readingsBulkUpdate($rhash, "state", $state) if( Value($rname) ne $state );
|
||||||
}
|
}
|
||||||
@ -314,9 +320,10 @@ LaCrosse_Attr(@)
|
|||||||
<a name="LaCrosseDefine"></a>
|
<a name="LaCrosseDefine"></a>
|
||||||
<b>Define</b>
|
<b>Define</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> LaCrosse <addr></code> <br>
|
<code>define <name> LaCrosse <addr> [corr1...corr2]</code> <br>
|
||||||
<br>
|
<br>
|
||||||
addr is a 2 digit hex number to identify the LaCrosse device.<br><br>
|
addr is a 2 digit hex number to identify the LaCrosse device.<br>
|
||||||
|
corr1..corr2 are up to 2 numerical correction factors, which will be added to the respective value to calibrate the device.<br><br>
|
||||||
Note: devices are autocreated only if LaCrossePairForSec is active for the <a href="#JeeLink">JeeLink</a> IODevice device.<br>
|
Note: devices are autocreated only if LaCrossePairForSec is active for the <a href="#JeeLink">JeeLink</a> IODevice device.<br>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user