From c53e0c5c326bb544c0775c3118b1416c2a9500fa Mon Sep 17 00:00:00 2001 From: risiko79 <> Date: Sat, 16 May 2015 08:54:47 +0000 Subject: [PATCH] 30_pilight_temp: new reading battery, attribut corrTemp git-svn-id: https://svn.fhem.de/fhem/trunk@8585 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/10_pilight_ctrl.pm | 7 +++++-- fhem/FHEM/30_pilight_temp.pm | 25 +++++++++++++++++++++---- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 2c2d4ba42..d60b8e2a9 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: reading battery state, attribut corrTemp to correct temperature - change: 73_km200: Wrong SwitchProgram time format fixed - feature: 73_km200: SwitchPrograms can be written/changed - change: MSGMail: Improve error logging to assist problem solving diff --git a/fhem/FHEM/10_pilight_ctrl.pm b/fhem/FHEM/10_pilight_ctrl.pm index a841cdb5a..8f019e7c7 100644 --- a/fhem/FHEM/10_pilight_ctrl.pm +++ b/fhem/FHEM/10_pilight_ctrl.pm @@ -1,5 +1,5 @@ ############################################## -# $Id: 10_pilight_ctrl.pm 1.00 2015-05-09 Risiko $ +# $Id: 10_pilight_ctrl.pm 1.02 2015-05-16 Risiko $ # # Usage # @@ -25,6 +25,7 @@ # V 0.51 2015-04-29 - CHG: rename attribute ignore to ignoreProtocol because with ignore the whole device is ignored in FHEMWEB # V 1.00 2015-05-09 - NEW: white list for defined submodules activating by ignoreProtocol * # V 1.01 2015-05-09 - NEW: add quigg_gt* protocol (e.q quigg_gt7000) +# V 1.02 2015-05-16 - NEW: battery state for temperature sensors ############################################## package main; @@ -718,7 +719,9 @@ sub pilight_ctrl_Parse($$) return if ($temp eq ""); my $humidity = (defined($data->{$s}{humidity})) ? $data->{$s}{humidity} : ""; - my $msg = "PITEMP,$proto,$id,$temp,$humidity"; + my $battery = (defined($data->{$s}{battery})) ? $data->{$s}{battery} : ""; + + my $msg = "PITEMP,$proto,$id,$temp,$humidity,$battery"; return Dispatch($hash, $msg,undef); } else {Log3 $me, 3, "$me(Parse): unknown protocol -> $proto"; return;} diff --git a/fhem/FHEM/30_pilight_temp.pm b/fhem/FHEM/30_pilight_temp.pm index fa35b8ebb..ce06d74ef 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.11 2015-03-29 Risiko $ +# $Id: 20_pilight_temp.pm 0.12 2015-05-16 Risiko $ # # Usage # @@ -9,6 +9,8 @@ # # V 0.10 2015-03-29 - initial beta version # 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 ############################################## package main; @@ -29,7 +31,7 @@ sub pilight_temp_Initialize($) $hash->{DefFn} = "pilight_temp_Define"; $hash->{Match} = "^PITEMP"; $hash->{ParseFn} = "pilight_temp_Parse"; - $hash->{AttrList} = $readingFnAttributes; + $hash->{AttrList} = "corrTemp ".$readingFnAttributes; } ##################################### @@ -67,7 +69,7 @@ sub pilight_temp_Parse($$) Log3 $backend, 4, "pilight_temp_Parse: RCV -> $rmsg"; - my ($dev,$protocol,$id,$temp,$humidity,@args) = split(",",$rmsg); + my ($dev,$protocol,$id,$temp,$humidity,$battery,@args) = split(",",$rmsg); return () if($dev ne "PITEMP"); my $chash; @@ -82,10 +84,14 @@ sub pilight_temp_Parse($$) return () if (!defined($chash->{NAME})); + my $corrTemp = AttrVal($chash->{NAME}, "corrTemp",1); + $temp = $temp * $corrTemp; + readingsBeginUpdate($chash); readingsBulkUpdate($chash,"state",$temp); readingsBulkUpdate($chash,"temperature",$temp); - readingsBulkUpdate($chash,"humidity",$humidity) if (defined($humidity) && $humidity ne ""); + readingsBulkUpdate($chash,"humidity",$humidity) if (defined($humidity) && $humidity ne ""); + readingsBulkUpdate($chash,"battery",$battery) if (defined($battery) && $battery ne ""); readingsEndUpdate($chash, 1); return $chash->{NAME}; @@ -133,8 +139,19 @@ sub pilight_temp_Parse($$) humidity
present the current humidity (if sensor support it) +
  • + battery
    + present the battery state of the senor (if sensor support it) +

  • + + Attributes + =end html