From 3e3ee401441a99ec8adc441098a5ffc08d1706d3 Mon Sep 17 00:00:00 2001 From: jpawlowski Date: Fri, 28 Oct 2016 15:48:07 +0000 Subject: [PATCH] 59_Wunderground: use UConv to get short reading names git-svn-id: https://svn.fhem.de/fhem/trunk@12453 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/59_Wunderground.pm | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/fhem/FHEM/59_Wunderground.pm b/fhem/FHEM/59_Wunderground.pm index e56676101..7e2354c5f 100644 --- a/fhem/FHEM/59_Wunderground.pm +++ b/fhem/FHEM/59_Wunderground.pm @@ -283,33 +283,14 @@ sub Wunderground_ReceiveCommand($$$) { } # state - my %shortnames = ( - "dewpoint" => "D", - "humidity" => "H", - "light" => "L", - "pressure" => "P", - "rain" => "R", - "rain_day" => "RD", - "rain_week" => "RW", - "rain_month" => "RM", - "rain_year" => "RY", - "solarradiation" => "SR", - "temp_c" => "T", - "wind_speed" => "W", - "wind_chill" => "WC", - "wind_gust" => "WG", - "wind_direction" => "WD", - "wind_dewpoint" => "D", - ); - my @stateReadings = split( /\s+/, AttrVal( $name, "stateReadings", "" ) ); foreach (@stateReadings) { $_ =~ /^(\w+):?(\w+)?$/; my $r = $1; - my $n = ( $2 ? $2 : ( $shortnames{$r} ? $shortnames{$r} : $1 ) ); + my $n = ( $2 ? $2 : UConv::rname2rsname($r) ); my $v = ReadingsVal( $name, $r, undef ); - if ($v) { + if ( defined($v) ) { $state .= " " if ( $state ne "Initialized" ); $state = "" if ( $state eq "Initialized" ); $state .= "$n: $v";