testing #29

Merged
marko merged 73 commits from testing into main 2023-01-07 12:49:01 +00:00
2 changed files with 32 additions and 17 deletions
Showing only changes of commit fdd6f0964a - Show all commits

View File

@ -361,18 +361,6 @@ sub Weather_WriteReadings {
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
# delete some unused readings
delete( $hash->{READINGS}->{temp_f} )
if ( defined( $hash->{READINGS}->{temp_f} ) );
delete( $hash->{READINGS}->{unit_distance} )
if ( defined( $hash->{READINGS}->{unit_distance} ) );
delete( $hash->{READINGS}->{unit_speed} )
if ( defined( $hash->{READINGS}->{unit_speed} ) );
delete( $hash->{READINGS}->{unit_pressuree} )
if ( defined( $hash->{READINGS}->{unit_pressuree} ) );
delete( $hash->{READINGS}->{unit_temperature} )
if ( defined( $hash->{READINGS}->{unit_temperature} ) );
# housekeeping information # housekeeping information
readingsBulkUpdate( $hash, 'lastError', '' ); readingsBulkUpdate( $hash, 'lastError', '' );
foreach my $r ( keys %{$dataRef} ) { foreach my $r ( keys %{$dataRef} ) {

View File

@ -488,11 +488,11 @@ sub _ProcessingRetrieveData {
"%a, %e %b %Y %H:%M", "%a, %e %b %Y %H:%M",
localtime( $data->{dt} ) localtime( $data->{dt} )
), ),
}; 'visibility' => int( sprintf(
"%.1f", $data->{visibility} ) + 0.5
),
$self->{cached}->{current}->{'visibility'} = };
int( sprintf( "%.1f", $data->{visibility} ) + 0.5 )
if ( exists $data->{visibility} );
} }
when ('onecall') { when ('onecall') {
@ -539,6 +539,21 @@ sub _ProcessingRetrieveData {
) )
) + 0.5 ) + 0.5
), ),
'tempFeelsLike' => int(
sprintf(
"%.1f",
(
$data->{hourly}->[$i]
->{feels_like}
)
) + 0.5
),
'dew_point' => int(
sprintf(
"%.1f",
$data->{hourly}->[$i]->{dew_point}
) + 0.5
),
'humidity' => 'humidity' =>
$data->{hourly}->[$i] $data->{hourly}->[$i]
->{humidity}, ->{humidity},
@ -592,6 +607,12 @@ sub _ProcessingRetrieveData {
$data->{hourly}->[$i]->{rain}->{'1h'}, $data->{hourly}->[$i]->{rain}->{'1h'},
'snow1h' => 'snow1h' =>
$data->{hourly}->[$i]->{snow}->{'1h'}, $data->{hourly}->[$i]->{snow}->{'1h'},
'uvi' =>
$data->{hourly}->[$i]->{uvi},
'visibility' => int( sprintf(
"%.1f", $data->{hourly}->[$i]->{visibility} )
+ 0.5
),
}, },
); );
@ -648,6 +669,9 @@ sub _ProcessingRetrieveData {
) - 3600 ) - 3600
) )
), ),
'moon_phase' => $data->{daily}->[$i]
->{moon_phase}
),
'moonset' => strftime( 'moonset' => strftime(
"%a, %H:%M", "%a, %H:%M",
localtime( localtime(
@ -747,6 +771,8 @@ sub _ProcessingRetrieveData {
$data->{daily}->[$i]->{weather} $data->{daily}->[$i]->{weather}
->[0]->{description} ->[0]->{description}
), ),
'code' => $codes{ $data->{daily}->[$i]->{weather}->[0]->{id} },
'iconAPI' => $data->{daily}->[$i]->{weather}->[0]->{icon},
'pressure' => int( 'pressure' => int(
sprintf( "%.1f", sprintf( "%.1f",
$data->{daily}->[$i]->{pressure} $data->{daily}->[$i]->{pressure}
@ -843,10 +869,11 @@ sub _ProcessingRetrieveData {
), ),
}, },
); );
$i++; $i++;
} }
} }
$self->{cached}->{current}->{dew_point} = $data->{current}->{dew_point}
} }
} }
} }