From 24aa1a55ba5d503c9938e2cea1cd8aec76e96570 Mon Sep 17 00:00:00 2001 From: risiko79 <> Date: Sun, 30 Aug 2015 18:13:55 +0000 Subject: [PATCH] 30_pilight_temp: added support for pressure, windavg, winddir, windgust git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@9179 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- CHANGED | 1 + FHEM/10_pilight_ctrl.pm | 11 +++++++++-- FHEM/30_pilight_temp.pm | 27 +++++++++++++++++++++++++-- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index 2fe69dccc..dd9d21bd8 100644 --- a/CHANGED +++ b/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: - Added support for pressure, windavg, winddir, windgust from weather stations - feature: 98_Text2Speech.pm: - Quality and Speed as new Parameter - Bugfixing with Google Download diff --git a/FHEM/10_pilight_ctrl.pm b/FHEM/10_pilight_ctrl.pm index 40775fc6d..72f17901c 100644 --- a/FHEM/10_pilight_ctrl.pm +++ b/FHEM/10_pilight_ctrl.pm @@ -1,5 +1,5 @@ ############################################## -# $Id: 10_pilight_ctrl.pm 1.09 2015-07-21 Risiko $ +# $Id: 10_pilight_ctrl.pm 1.10 2015-08-30 Risiko $ # # Usage # @@ -34,6 +34,7 @@ # V 1.08 2015-06-23 - FIX: clear send queue by reset # V 1.08 2015-06-23 - NEW: attribute SendTimeout for abort sending command non blocking # V 1.09 2015-07-21 - NEW: support submodule pilight_raw to send raw codes +# V 1.10 2015-08-30 - NEW: support pressure, windavg, winddir, windgust from weather stations and GPIO sensors ############################################## package main; @@ -844,7 +845,13 @@ sub pilight_ctrl_Parse($$) my $humidity = (defined($data->{$s}{humidity})) ? $data->{$s}{humidity} : ""; my $battery = (defined($data->{$s}{battery})) ? $data->{$s}{battery} : ""; - my $msg = "PITEMP,$proto,$id,$temp,$humidity,$battery"; + my $more = ""; + $more .= ",pressure:$data->{$s}{pressure}" if (defined($data->{$s}{pressure})); + $more .= ",windavg:$data->{$s}{windavg}" if (defined($data->{$s}{windavg})); + $more .= ",winddir:$data->{$s}{winddir}" if (defined($data->{$s}{winddir})); + $more .= ",windgust:$data->{$s}{windgust}" if (defined($data->{$s}{windgust})); + + my $msg = "PITEMP,$proto,$id,$temp,$humidity,$battery$more"; return Dispatch($hash, $msg,undef); } case 5 { return Dispatch($hash, "PISCREEN,$proto,$id,$unit,$state",undef); } diff --git a/FHEM/30_pilight_temp.pm b/FHEM/30_pilight_temp.pm index b38924f6a..2d24fdd6a 100644 --- a/FHEM/30_pilight_temp.pm +++ b/FHEM/30_pilight_temp.pm @@ -1,5 +1,5 @@ ############################################## -# $Id: 30_pilight_temp.pm 0.14 2015-05-30 Risiko $ +# $Id: 30_pilight_temp.pm 0.15 2015-08-30 Risiko $ # # Usage # @@ -13,6 +13,7 @@ # 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 # V 0.14 2015-05-30 - FIX: StateFn +# V 0.15 2015-08-30 - NEW: support pressure, windavg, winddir, windgust ############################################## package main; @@ -112,6 +113,12 @@ sub pilight_temp_Parse($$) } readingsBulkUpdate($chash,"battery",$battery) if (defined($battery) && $battery ne ""); + + foreach my $arg (@args){ + #pressure, windavg, winddir, windgust + my($feature,$value) = split(":",$arg); + readingsBulkUpdate($chash,$feature,$value); + } readingsEndUpdate($chash, 1); return $chash->{NAME}; @@ -127,7 +134,7 @@ sub pilight_temp_Parse($$)

pilight_temp