mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 01:46:08 +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:
parent
bfd9761a34
commit
3e3ee40144
@ -283,33 +283,14 @@ sub Wunderground_ReceiveCommand($$$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# state
|
# 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", "" ) );
|
my @stateReadings = split( /\s+/, AttrVal( $name, "stateReadings", "" ) );
|
||||||
foreach (@stateReadings) {
|
foreach (@stateReadings) {
|
||||||
$_ =~ /^(\w+):?(\w+)?$/;
|
$_ =~ /^(\w+):?(\w+)?$/;
|
||||||
my $r = $1;
|
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 );
|
my $v = ReadingsVal( $name, $r, undef );
|
||||||
if ($v) {
|
if ( defined($v) ) {
|
||||||
$state .= " " if ( $state ne "Initialized" );
|
$state .= " " if ( $state ne "Initialized" );
|
||||||
$state = "" if ( $state eq "Initialized" );
|
$state = "" if ( $state eq "Initialized" );
|
||||||
$state .= "$n: $v";
|
$state .= "$n: $v";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user