diff --git a/fhem/CHANGED b/fhem/CHANGED index 723d0ce3b..1be53788e 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: 59_WUup: add attribute round - bugfix: 72_FB_CALLMONITOR: fix not working get command showPhonebookEntries for remote phonebooks - bugfix: 73_GardenaSmartBridge: add commandref parts diff --git a/fhem/FHEM/59_WUup.pm b/fhem/FHEM/59_WUup.pm index 7429c50dd..b2c854041 100644 --- a/fhem/FHEM/59_WUup.pm +++ b/fhem/FHEM/59_WUup.pm @@ -32,7 +32,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use UConv; -my $version = "0.9.6"; +my $version = "0.9.7"; # Declare functions sub WUup_Initialize($); @@ -62,6 +62,7 @@ sub WUup_Initialize($) { . "disabledForIntervals " . "interval " . "unit_windspeed:km/h,m/s " + . "round " . "wubaromin wudailyrainin wudewptf wuhumidity wurainin wusoilmoisture " . "wusoiltempf wusolarradiation wutempf wuUV wuwinddir wuwinddir_avg2m " . "wuwindgustdir wuwindgustdir_10m wuwindgustmph wuwindgustmph_10m " @@ -95,6 +96,7 @@ sub WUup_Define($$$) { $attr{$name}{room} = "Weather" if ( !defined( $attr{$name}{room} ) ); $attr{$name}{unit_windspeed} = "km/h" if ( !defined( $attr{$name}{unit_windspeed} ) ); + $attr{$name}{round} = 4 if ( !defined( $attr{$name}{round} ) ); RemoveInternalTimer($hash); @@ -228,8 +230,11 @@ sub WUup_send($) { $attr{$name}{unit_windspeed} = "km/h" if ( !defined( $attr{$name}{unit_windspeed} ) ); + $attr{$name}{round} = 4 if ( !defined( $attr{$name}{round} ) ); + my ( $data, $d, $r, $o ); - my $a = $attr{$name}; + my $a = $attr{$name}; + my $rnd = $attr{$name}{round}; while ( my ( $key, $value ) = each(%$a) ) { next if substr( $key, 0, 2 ) ne 'wu'; $key = substr( $key, 2, length($key) - 2 ); @@ -239,24 +244,25 @@ sub WUup_send($) { $value = ReadingsVal( $d, $r, 0 ) + $o; } if ( $key =~ /\w+f$/ ) { - $value = UConv::c2f( $value, 4 ); + $value = UConv::c2f( $value, $rnd ); } elsif ( $key =~ /\w+mph.*/ ) { if ( $attr{$name}{unit_windspeed} eq "m/s" ) { Log3 $name, 5, "WUup ($name) - windspeed unit is m/s"; - $value = UConv::kph2mph( ( UConv::mps2kph( $value, 4 ) ), 4 ); + $value = + UConv::kph2mph( ( UConv::mps2kph( $value, $rnd ) ), $rnd ); } else { Log3 $name, 5, "WUup ($name) - windspeed unit is km/h"; - $value = UConv::kph2mph( $value, 4 ); + $value = UConv::kph2mph( $value, $rnd ); } } elsif ( $key eq "baromin" ) { - $value = UConv::hpa2inhg( $value, 4 ); + $value = UConv::hpa2inhg( $value, $rnd ); } elsif ( $key =~ /.*rainin$/ ) { - $value = UConv::mm2in( $value, 4 ); + $value = UConv::mm2in( $value, $rnd ); } elsif ( $key eq "solarradiation" ) { $value = ( $value / 126.7 ); @@ -347,6 +353,7 @@ sub WUup_receive($) { # 2017-10-16 fixed attributes # 2017-10-19 added set-command "update" # 2018-03-19 solarradiation calculated from lux to W/m² (thanks to dieter114) +# 2018-04-10 added attribute round # ################################################################################ @@ -400,6 +407,7 @@ sub WUup_receive($) {
  • disable - disables the module
  • disabledForIntervals
  • unit_windspeed - change the units of your windspeed readings (m/s or km/h)
  • +
  • round - round values to this number of decimals for calculation (default 4)
  • wu.... - Attribute name corresponding to parameter name from api. Each of these attributes contains information about weather data to be sent @@ -500,6 +508,7 @@ sub WUup_receive($) {
  • disabledForIntervals
  • unit_windspeed - gibt die Einheit der Readings für die Windgeschwindigkeiten an (m/s oder km/h)
  • +
  • round - Anzahl der Nachkommastellen zur Berechnung (Standard 4)
  • wu.... - Attributname entsprechend dem Parameternamen aus der API.
    Jedes dieser Attribute enthält Informationen über zu sendende Wetterdaten