2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 07:16:03 +00:00

59_Wunderground: use UConv to get short reading names

git-svn-id: https://svn.fhem.de/fhem/trunk@12453 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2016-10-28 15:48:07 +00:00
parent bfd9761a34
commit 3e3ee40144

View File

@ -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";