From 89229a4d6f9520e48ca6f639505b19ae41f3f310 Mon Sep 17 00:00:00 2001 From: borisneubert Date: Thu, 4 Aug 2011 19:31:23 +0000 Subject: [PATCH] bugfix: enabled logging for 59_Weather.pm (Boris) git-svn-id: https://svn.fhem.de/fhem/trunk@967 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/59_Weather.pm | 25 +++++++++++++++---------- fhem/HISTORY | 5 ++++- fhem/docs/USF1000.txt | 4 ++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 606826f1c..24c57b4ed 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -3,6 +3,7 @@ - feature: CUL_TX added (thanks to Peterp) - feature: TCM120 / EnOcean parser added - feature: eventMap enhanced + - bugfix: enabled logging for 59_Weather.pm (Boris) - 2011-07-08 (5.1) - feature: smallscreen optimizations for iPhone diff --git a/fhem/FHEM/59_Weather.pm b/fhem/FHEM/59_Weather.pm index 280b76e2a..3afc063d0 100755 --- a/fhem/FHEM/59_Weather.pm +++ b/fhem/FHEM/59_Weather.pm @@ -37,9 +37,9 @@ sub f_to_c($) { } ################################### -sub Weather_UpdateReading($$$$$) { +sub Weather_UpdateReading($$$$$$) { - my ($hash,$prefix,$key,$tn,$value)= @_; + my ($hash,$prefix,$key,$tn,$value,$n)= @_; return 0 if(!defined($value) || $value eq ""); return 0 if($key eq "unit_system"); @@ -59,7 +59,14 @@ sub Weather_UpdateReading($$$$$) { my $r= $hash->{READINGS}; $r->{$reading}{TIME}= $tn; $r->{$reading}{VAL} = $value; - Log 5, "Weather $hash->{NAME}: $reading= $value"; + + my $name= $hash->{NAME}; + Log 1, "Weather $name: $reading= $value"; + + #if(!$hash->{LOCAL}) { + DoTrigger($name, ReadingsVal($name, $reading, "")); # if($init_done); + #} + return 1; } @@ -75,6 +82,8 @@ sub Weather_GetUpdate($) my $name = $hash->{NAME}; + my $n= 0; + # time my $tn = TimeNow(); @@ -97,14 +106,14 @@ sub Weather_GetUpdate($) my $current = $WeatherObj->current_conditions; foreach my $condition ( keys ( %$current ) ) { my $value= $current->{$condition}; - Weather_UpdateReading($hash,"",$condition,$tn,$value); + Weather_UpdateReading($hash,"",$condition,$tn,$value,$n); } my $fci= $WeatherObj->forecast_information; foreach my $i ( keys ( %$fci ) ) { my $reading= $i; my $value= $fci->{$i}; - Weather_UpdateReading($hash,"",$i,$tn,$value); + Weather_UpdateReading($hash,"",$i,$tn,$value,$n); } for(my $t= 0; $t<= 3; $t++) { @@ -112,14 +121,10 @@ sub Weather_GetUpdate($) my $prefix= sprintf("fc%d_", $t); foreach my $condition ( keys ( %$fcc ) ) { my $value= $fcc->{$condition}; - Weather_UpdateReading($hash,$prefix,$condition,$tn,$value); + Weather_UpdateReading($hash,$prefix,$condition,$tn,$value,$n); } } - if(!$hash->{LOCAL}) { - DoTrigger($name, undef) if($init_done); - } - return 1; } diff --git a/fhem/HISTORY b/fhem/HISTORY index 7869cdab9..e9405efcc 100644 --- a/fhem/HISTORY +++ b/fhem/HISTORY @@ -477,4 +477,7 @@ on-till and on-for-timer commands (Boris) - Thu Jun 30 2011 (Maz Rashid) - - Introducing 00_TUL.pm and 10_EIB.pm modules for connecting FHEM on EIB. \ No newline at end of file + - Introducing 00_TUL.pm and 10_EIB.pm modules for connecting FHEM on EIB. + +- Thu Aug 04 2011 (Boris) + - enabled logging for 59_Weather.pm \ No newline at end of file diff --git a/fhem/docs/USF1000.txt b/fhem/docs/USF1000.txt index 260cc8475..726b6bc62 100755 --- a/fhem/docs/USF1000.txt +++ b/fhem/docs/USF1000.txt @@ -20,7 +20,7 @@ xx: measured distance in cm code: hex bin - 37 00110111 30s message interval, normal operation + 37 00110111 30min message interval, normal operation B7 10110111 3s message interval, normal operation F7 11110111 3s message interval, battery low |||+++++-- 0x17 always 0x17 @@ -38,4 +38,4 @@ measured distance from ultrasound sender/transmitter: 2.00 m 0xC4 196 It is assumed that xx is the distance in centimeters from the top of the box -(4 cm box height + 1 cm height of ultrasound sender/transmitter). \ No newline at end of file +(4 cm box height + 1 cm height of ultrasound sender/transmitter).