From b9ed47c838694eac90c0dcc9deb2b1503576040c Mon Sep 17 00:00:00 2001 From: risiko79 <> Date: Sun, 17 May 2015 07:32:22 +0000 Subject: [PATCH] 30_pilight_temp: attribut corrHumidity to correct humidity value git-svn-id: https://svn.fhem.de/fhem/trunk@8589 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/30_pilight_temp.pm | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 740058492..f2e76e2be 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - feature: 30_pilight_temp: attribut corrHumidity to correct humidity - feature: 76_MSGMail: Add attribute mailtype as suggested by Roger (forum #37206) - feature: 30_pilight_temp: reading battery state, attribut corrTemp to correct temperature diff --git a/fhem/FHEM/30_pilight_temp.pm b/fhem/FHEM/30_pilight_temp.pm index ce06d74ef..8c83c2ecf 100644 --- a/fhem/FHEM/30_pilight_temp.pm +++ b/fhem/FHEM/30_pilight_temp.pm @@ -1,5 +1,5 @@ ############################################## -# $Id: 20_pilight_temp.pm 0.12 2015-05-16 Risiko $ +# $Id: 30_pilight_temp.pm 0.13 2015-05-17 Risiko $ # # Usage # @@ -11,6 +11,7 @@ # V 0.11 2015-03-29 - FIX: $readingFnAttributes # V 0.12 2015-05-16 - NEW: reading battery # V 0.12 2015-05-16 - NEW: attribut corrTemp, a factor to modify temperatur +# V 0.13 2015-05-17 - NEW: attribut corrHumidity, a factor to modify humidity ############################################## package main; @@ -31,7 +32,7 @@ sub pilight_temp_Initialize($) $hash->{DefFn} = "pilight_temp_Define"; $hash->{Match} = "^PITEMP"; $hash->{ParseFn} = "pilight_temp_Parse"; - $hash->{AttrList} = "corrTemp ".$readingFnAttributes; + $hash->{AttrList} = "corrTemp corrHumidity ".$readingFnAttributes; } ##################################### @@ -90,7 +91,13 @@ sub pilight_temp_Parse($$) readingsBeginUpdate($chash); readingsBulkUpdate($chash,"state",$temp); readingsBulkUpdate($chash,"temperature",$temp); - readingsBulkUpdate($chash,"humidity",$humidity) if (defined($humidity) && $humidity ne ""); + + if (defined($humidity) && $humidity ne "") { + my $corrHumidity = AttrVal($chash->{NAME}, "corrHumidity",1); + $humidity = $humidity * $corrHumidity; + readingsBulkUpdate($chash,"humidity",$humidity); + } + readingsBulkUpdate($chash,"battery",$battery) if (defined($battery) && $battery ne ""); readingsEndUpdate($chash, 1); @@ -151,6 +158,9 @@ sub pilight_temp_Parse($$)