change day_of_week language handling
This commit is contained in:
@@ -138,7 +138,7 @@ sub Weather_Initialize($) {
|
||||
$hash->{UndefFn} = "Weather_Undef";
|
||||
$hash->{GetFn} = "Weather_Get";
|
||||
$hash->{SetFn} = "Weather_Set";
|
||||
$hash->{AttrList}= "disable " . $readingFnAttributes;
|
||||
$hash->{AttrList}= "disable:0,1 " . $readingFnAttributes;
|
||||
$hash->{NotifyFn}= "Weather_Notify";
|
||||
|
||||
#Weather_DebugCodes('de');
|
||||
@@ -416,7 +416,7 @@ sub Weather_WriteReadings($$) {
|
||||
my $wdir= degrees_to_direction($dataRef->{forecast}->{hourly}[$i-1]{wind_direction}, @directions_txt_i18n);
|
||||
readingsBulkUpdate($hash, $f . 'wind_condition', 'Wind: ' . $wdir . ' ' . $dataRef->{forecast}->{hourly}[$i-1]{wind_speed} . ' km/h');
|
||||
}
|
||||
# readingsBulkUpdate($hash, $f . 'day_of_week', $wdays_txt_i18n{substr($dataRef->{forecast}->{hourly}[$i-1]{date},0,3)});
|
||||
readingsBulkUpdate($hash, $f . 'day_of_week', ( length((split(',', $dataRef->{forecast}->{hourly}[$i-1]{pubDate}))[0]) > 2 ? $wdays_txt_i18n{substr($dataRef->{forecast}->{hourly}[$i-1]{pubDate},0,3)} : substr($dataRef->{forecast}->{hourly}[$i-1]{pubDate},0,2) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ sub Weather_WriteReadings($$) {
|
||||
my $wdir= degrees_to_direction($dataRef->{forecast}->{daily}[$i-1]{wind_direction}, @directions_txt_i18n);
|
||||
readingsBulkUpdate($hash, $f . 'wind_condition', 'Wind: ' . $wdir . ' ' . $dataRef->{forecast}->{daily}[$i-1]{wind_speed} . ' km/h');
|
||||
}
|
||||
# readingsBulkUpdate($hash, $f . 'day_of_week', $wdays_txt_i18n{substr($dataRef->{forecast}->{daily}[$i-1]{date},0,3)});
|
||||
readingsBulkUpdate($hash, $f . 'day_of_week', ( length((split(',', $dataRef->{forecast}->{daily}[$i-1]{pubDate}))[0]) > 2 ? $wdays_txt_i18n{substr($dataRef->{forecast}->{daily}[$i-1]{pubDate},0,3)} : substr($dataRef->{forecast}->{daily}[$i-1]{pubDate},0,2) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -267,14 +267,8 @@ sub _ProcessingRetrieveData($$) {
|
||||
push(
|
||||
@{ $self->{cached}->{forecast}->{daily} },
|
||||
{
|
||||
'date' => strftime(
|
||||
"%a, %d.%m.%Y",
|
||||
localtime(
|
||||
$data->{daily}->{data}->[$i]->{'time'}
|
||||
)
|
||||
),
|
||||
'day_of_week' => strftime(
|
||||
"%a",
|
||||
'pubDate' => strftime(
|
||||
"%a, %e %b %Y %H:%M %p",
|
||||
localtime(
|
||||
$data->{daily}->{data}->[$i]->{'time'}
|
||||
)
|
||||
|
@@ -334,6 +334,12 @@ sub _ProcessingRetrieveData($$) {
|
||||
push(
|
||||
@{ $self->{cached}->{forecast}->{hourly} },
|
||||
{
|
||||
'pubDate' => strftime(
|
||||
"%a, %e %b %Y %H:%M %p",
|
||||
localtime(
|
||||
( $data->{list}->[$i]->{dt} ) - 3600
|
||||
)
|
||||
),
|
||||
'temperature' => int(
|
||||
sprintf(
|
||||
"%.1f",
|
||||
@@ -416,12 +422,6 @@ sub _ProcessingRetrieveData($$) {
|
||||
->{id} },
|
||||
'iconAPI' =>
|
||||
$data->{list}->[$i]->{weather}->[0]->{icon},
|
||||
'pubDate' => strftime(
|
||||
"%a,%e %b %Y %H:%M %p",
|
||||
localtime(
|
||||
( $data->{list}->[$i]->{dt} ) - 3600
|
||||
)
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user