diff --git a/59_Weather.pm b/59_Weather.pm index cc80c32..2137dc3 100755 --- a/59_Weather.pm +++ b/59_Weather.pm @@ -361,18 +361,6 @@ sub Weather_WriteReadings { 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 readingsBulkUpdate( $hash, 'lastError', '' ); foreach my $r ( keys %{$dataRef} ) { diff --git a/OpenWeatherMapAPI.pm b/OpenWeatherMapAPI.pm index d9a39db..4c8d897 100644 --- a/OpenWeatherMapAPI.pm +++ b/OpenWeatherMapAPI.pm @@ -488,11 +488,11 @@ sub _ProcessingRetrieveData { "%a, %e %b %Y %H:%M", 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') { @@ -539,6 +539,21 @@ sub _ProcessingRetrieveData { ) ) + 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' => $data->{hourly}->[$i] ->{humidity}, @@ -592,6 +607,12 @@ sub _ProcessingRetrieveData { $data->{hourly}->[$i]->{rain}->{'1h'}, 'snow1h' => $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 ) ), + 'moon_phase' => $data->{daily}->[$i] + ->{moon_phase} + ), 'moonset' => strftime( "%a, %H:%M", localtime( @@ -747,6 +771,8 @@ sub _ProcessingRetrieveData { $data->{daily}->[$i]->{weather} ->[0]->{description} ), + 'code' => $codes{ $data->{daily}->[$i]->{weather}->[0]->{id} }, + 'iconAPI' => $data->{daily}->[$i]->{weather}->[0]->{icon}, 'pressure' => int( sprintf( "%.1f", $data->{daily}->[$i]->{pressure} @@ -843,10 +869,11 @@ sub _ProcessingRetrieveData { ), }, ); - $i++; } } + + $self->{cached}->{current}->{dew_point} = $data->{current}->{dew_point} } } }