mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-25 22:09:21 +00:00
59_Wunderground: fix hourly forecast readings, add rain_daytime and snow_daytime
git-svn-id: https://svn.fhem.de/fhem/trunk@15171 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
603b5b3cb8
commit
b4d2e02514
@ -585,6 +585,7 @@ sub Wunderground_Hash2Readings($$;$) {
|
|||||||
{
|
{
|
||||||
my $period = $r;
|
my $period = $r;
|
||||||
$period =~ s/[^\d]//g;
|
$period =~ s/[^\d]//g;
|
||||||
|
$period++;
|
||||||
$reading = "hfc" . $period . "_";
|
$reading = "hfc" . $period . "_";
|
||||||
|
|
||||||
readingsBulkUpdate( $hash, $reading . "condition",
|
readingsBulkUpdate( $hash, $reading . "condition",
|
||||||
@ -613,12 +614,18 @@ sub Wunderground_Hash2Readings($$;$) {
|
|||||||
$hash,
|
$hash,
|
||||||
$reading . "heatindex_c",
|
$reading . "heatindex_c",
|
||||||
$h->{heatindex}{metric}
|
$h->{heatindex}{metric}
|
||||||
);
|
) if ( $h->{heatindex}{metric} ne "-9999" );
|
||||||
|
readingsBulkUpdateIfChanged( $hash, $reading . "heatindex_c",
|
||||||
|
"-" )
|
||||||
|
if ( $h->{heatindex}{metric} eq "-9999" );
|
||||||
readingsBulkUpdate(
|
readingsBulkUpdate(
|
||||||
$hash,
|
$hash,
|
||||||
$reading . "heatindex_f",
|
$reading . "heatindex_f",
|
||||||
$h->{heatindex}{english}
|
$h->{heatindex}{english}
|
||||||
);
|
) if ( $h->{heatindex}{english} ne "-9999" );
|
||||||
|
readingsBulkUpdateIfChanged( $hash, $reading . "heatindex_f",
|
||||||
|
"-" )
|
||||||
|
if ( $h->{heatindex}{english} eq "-9999" );
|
||||||
readingsBulkUpdate( $hash, $reading . "humidity",
|
readingsBulkUpdate( $hash, $reading . "humidity",
|
||||||
$h->{humidity} );
|
$h->{humidity} );
|
||||||
readingsBulkUpdate( $hash, $reading . "icon", $h->{icon} );
|
readingsBulkUpdate( $hash, $reading . "icon", $h->{icon} );
|
||||||
@ -674,12 +681,18 @@ sub Wunderground_Hash2Readings($$;$) {
|
|||||||
$hash,
|
$hash,
|
||||||
$reading . "wind_chill",
|
$reading . "wind_chill",
|
||||||
$h->{windchill}{metric}
|
$h->{windchill}{metric}
|
||||||
);
|
) if ( $h->{windchill}{metric} ne "-9999" );
|
||||||
|
readingsBulkUpdateIfChanged( $hash, $reading . "wind_chill",
|
||||||
|
"-" )
|
||||||
|
if ( $h->{windchill}{metric} eq "-9999" );
|
||||||
readingsBulkUpdate(
|
readingsBulkUpdate(
|
||||||
$hash,
|
$hash,
|
||||||
$reading . "wind_chill_f",
|
$reading . "wind_chill_f",
|
||||||
$h->{windchill}{english}
|
$h->{windchill}{english}
|
||||||
);
|
) if ( $h->{windchill}{english} ne "-9999" );
|
||||||
|
readingsBulkUpdateIfChanged( $hash, $reading . "wind_chill_f",
|
||||||
|
"-" )
|
||||||
|
if ( $h->{windchill}{english} eq "-9999" );
|
||||||
readingsBulkUpdate(
|
readingsBulkUpdate(
|
||||||
$hash,
|
$hash,
|
||||||
$reading . "wind_speed",
|
$reading . "wind_speed",
|
||||||
@ -748,6 +761,16 @@ sub Wunderground_Hash2Readings($$;$) {
|
|||||||
$reading . "rain_day_in",
|
$reading . "rain_day_in",
|
||||||
$h->{qpf_allday}{in}
|
$h->{qpf_allday}{in}
|
||||||
);
|
);
|
||||||
|
readingsBulkUpdate(
|
||||||
|
$hash,
|
||||||
|
$reading . "rain_daytime",
|
||||||
|
$h->{qpf_day}{mm}
|
||||||
|
);
|
||||||
|
readingsBulkUpdate(
|
||||||
|
$hash,
|
||||||
|
$reading . "rain_daytime_in",
|
||||||
|
$h->{qpf_day}{in}
|
||||||
|
);
|
||||||
readingsBulkUpdate(
|
readingsBulkUpdate(
|
||||||
$hash,
|
$hash,
|
||||||
$reading . "rain_night",
|
$reading . "rain_night",
|
||||||
@ -768,6 +791,16 @@ sub Wunderground_Hash2Readings($$;$) {
|
|||||||
$reading . "snow_day_in",
|
$reading . "snow_day_in",
|
||||||
$h->{snow_allday}{in}
|
$h->{snow_allday}{in}
|
||||||
);
|
);
|
||||||
|
readingsBulkUpdate(
|
||||||
|
$hash,
|
||||||
|
$reading . "snow_daytime",
|
||||||
|
$h->{snow_day}{cm}
|
||||||
|
);
|
||||||
|
readingsBulkUpdate(
|
||||||
|
$hash,
|
||||||
|
$reading . "snow_daytime_in",
|
||||||
|
$h->{snow_day}{in}
|
||||||
|
);
|
||||||
readingsBulkUpdate(
|
readingsBulkUpdate(
|
||||||
$hash,
|
$hash,
|
||||||
$reading . "snow_night",
|
$reading . "snow_night",
|
||||||
@ -808,7 +841,7 @@ sub Wunderground_Hash2Readings($$;$) {
|
|||||||
$reading . "wind_speed_max_mph",
|
$reading . "wind_speed_max_mph",
|
||||||
$h->{maxwind}{mph}
|
$h->{maxwind}{mph}
|
||||||
);
|
);
|
||||||
|
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -843,16 +876,18 @@ sub Wunderground_Hash2Readings($$;$) {
|
|||||||
my $symbol_f =
|
my $symbol_f =
|
||||||
Encode::encode_utf8( chr(0x202F) . chr(0x00B0) . 'F' );
|
Encode::encode_utf8( chr(0x202F) . chr(0x00B0) . 'F' );
|
||||||
my $symbol_pct = Encode::encode_utf8( chr(0x202F) . '%' );
|
my $symbol_pct = Encode::encode_utf8( chr(0x202F) . '%' );
|
||||||
# my $symbol_kmh = Encode::encode_utf8(chr(0x00A0) . 'km/h');
|
|
||||||
# my $symbol_mph = Encode::encode_utf8(chr(0x00A0) . 'mph');
|
# my $symbol_kmh = Encode::encode_utf8(chr(0x00A0) . 'km/h');
|
||||||
|
# my $symbol_mph = Encode::encode_utf8(chr(0x00A0) . 'mph');
|
||||||
$h->{fcttext_metric} =~ s/(\d+)C/$1$symbol_c/g;
|
$h->{fcttext_metric} =~ s/(\d+)C/$1$symbol_c/g;
|
||||||
$h->{fcttext} =~ s/(\d+)F/$1$symbol_f/g;
|
$h->{fcttext} =~ s/(\d+)F/$1$symbol_f/g;
|
||||||
$h->{fcttext_metric} =~ s/(\d+)\s*%/$1$symbol_pct/g;
|
$h->{fcttext_metric} =~ s/(\d+)\s*%/$1$symbol_pct/g;
|
||||||
$h->{fcttext} =~ s/(\d+)\s*%/$1$symbol_pct/g;
|
$h->{fcttext} =~ s/(\d+)\s*%/$1$symbol_pct/g;
|
||||||
# $h->{fcttext_metric} =~ s/(\d)\s*km\/h/$1$symbol_kmh/g;
|
|
||||||
# $h->{fcttext} =~ s/(\d+)\s*km\/h/$1$symbol_kmh/g;
|
# $h->{fcttext_metric} =~ s/(\d)\s*km\/h/$1$symbol_kmh/g;
|
||||||
# $h->{fcttext_metric} =~ s/(\d)\s*mph/$1$symbol_mph/g;
|
# $h->{fcttext} =~ s/(\d+)\s*km\/h/$1$symbol_kmh/g;
|
||||||
# $h->{fcttext} =~ s/(\d+)\s*mph/$1$symbol_mph/g;
|
# $h->{fcttext_metric} =~ s/(\d)\s*mph/$1$symbol_mph/g;
|
||||||
|
# $h->{fcttext} =~ s/(\d+)\s*mph/$1$symbol_mph/g;
|
||||||
|
|
||||||
readingsBulkUpdate( $hash, $reading . "icon$night",
|
readingsBulkUpdate( $hash, $reading . "icon$night",
|
||||||
$h->{icon} );
|
$h->{icon} );
|
||||||
@ -869,7 +904,7 @@ sub Wunderground_Hash2Readings($$;$) {
|
|||||||
$hash->{readingDesc}{"title$night"}{lang} = $lang if ($lang);
|
$hash->{readingDesc}{"title$night"}{lang} = $lang if ($lang);
|
||||||
$hash->{readingDesc}{"text$night"}{lang} = $lang if ($lang);
|
$hash->{readingDesc}{"text$night"}{lang} = $lang if ($lang);
|
||||||
$hash->{readingDesc}{"text_f$night"}{lang} = $lang if ($lang);
|
$hash->{readingDesc}{"text_f$night"}{lang} = $lang if ($lang);
|
||||||
|
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user