diff --git a/fhem/CHANGED b/fhem/CHANGED index 1f36ca088..6d51cf247 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: DarkSkyAPI: OpenWeatherMapAPI, Weather - fix bugs, change + day_of_week formated, delete deprecated readings - bugfixe: DarkSkyAPI: fix hourly wind at factor 3.6 - new: 44_ROLLO: Universal module to precisely control shutters/blinds which support only open/close/stop diff --git a/fhem/FHEM/59_Weather.pm b/fhem/FHEM/59_Weather.pm index 95260768f..a65529c21 100755 --- a/fhem/FHEM/59_Weather.pm +++ b/fhem/FHEM/59_Weather.pm @@ -286,10 +286,10 @@ sub Weather_WriteReadings($$) { } } - my $val= 'T: ' . $dataRef->{current}->{temperature} . '°C' - .' ' . substr($status_items_txt_i18n{1}, 0, 1) . ': ' . $dataRef->{current}->{humidity} . '%' - .' ' . substr($status_items_txt_i18n{0}, 0, 1) . ': ' . $dataRef->{current}->{wind} . 'km/h' - .' P: ' . $dataRef->{current}->{pressure} . 'hPa'; + my $val= 'T: ' . $dataRef->{current}->{temperature} . ' °C' + .' ' . substr($status_items_txt_i18n{1}, 0, 1) . ': ' . $dataRef->{current}->{humidity} . ' %' + .' ' . substr($status_items_txt_i18n{0}, 0, 1) . ': ' . $dataRef->{current}->{wind} . ' km/h' + .' P: ' . $dataRef->{current}->{pressure} . ' hPa'; Log3 $hash, 4, "$name: $val"; readingsBulkUpdate($hash, 'state', $val); diff --git a/fhem/FHEM/DarkSkyAPI.pm b/fhem/FHEM/DarkSkyAPI.pm index 6eae07d48..e96f9b19b 100644 --- a/fhem/FHEM/DarkSkyAPI.pm +++ b/fhem/FHEM/DarkSkyAPI.pm @@ -208,7 +208,7 @@ sub _ProcessingRetrieveData($$) { # print Dumper $data; ## für Debugging $self->{cached}->{current_date_time} = - strftime( "%a, %e %b %Y %H:%M %p", + strftime( "%a, %e %b %Y %H:%M", localtime( $self->{fetchTime} ) ); $self->{cached}->{timezone} = $data->{timezone}; $self->{cached}->{license}{text} = @@ -236,7 +236,7 @@ sub _ProcessingRetrieveData($$) { ), 'wind_direction' => $data->{currently}->{windBearing}, 'windGust' => int( - sprintf( "%.1f", $data->{currently}->{windGust} ) + 0.5 + sprintf( "%.1f", ($data->{currently}->{windGust} * 3.6) ) + 0.5 ), 'cloudCover' => $data->{currently}->{cloudCover} * 100, 'uvIndex' => $data->{currently}->{uvIndex}, @@ -247,7 +247,7 @@ sub _ProcessingRetrieveData($$) { 'code' => $codes{ $data->{currently}->{icon} }, 'iconAPI' => $data->{currently}->{icon}, 'pubDate' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{currently}->{'time'} ) ), 'precipProbability' => $data->{currently}->{precipProbability}, @@ -271,7 +271,7 @@ sub _ProcessingRetrieveData($$) { @{ $self->{cached}->{forecast}->{daily} }, { 'pubDate' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i]->{'time'} ) @@ -292,37 +292,13 @@ sub _ProcessingRetrieveData($$) { $data->{daily}->{data}->[$i] ->{temperatureHigh} ) + 0.5 ), - 'tempMin' => int( - sprintf( "%.1f", - $data->{daily}->{data}->[$i] - ->{temperatureMin} ) + 0.5 - ), - 'tempMinTime' => strftime( - "%a, %e %b %Y %H:%M %p", - localtime( - $data->{daily}->{data}->[$i] - ->{temperatureMinTime} - ) - ), - 'tempMax' => int( - sprintf( "%.1f", - $data->{daily}->{data}->[$i] - ->{temperatureMax} ) + 0.5 - ), - 'tempMaxTime' => strftime( - "%a, %e %b %Y %H:%M %p", - localtime( - $data->{daily}->{data}->[$i] - ->{temperatureMaxTime} - ) - ), 'tempLow' => int( sprintf( "%.1f", $data->{daily}->{data}->[$i] ->{temperatureLow} ) + 0.5 ), 'tempLowTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i] ->{temperatureLowTime} @@ -334,7 +310,7 @@ sub _ProcessingRetrieveData($$) { ->{temperatureHigh} ) + 0.5 ), 'tempHighTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i] ->{temperatureHighTime} @@ -346,7 +322,7 @@ sub _ProcessingRetrieveData($$) { ->{apparentTemperatureLow} ) + 0.5 ), 'apparentTempLowTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i] ->{apparentTemperatureLowTime} @@ -358,36 +334,12 @@ sub _ProcessingRetrieveData($$) { ->{apparentTemperatureHigh} ) + 0.5 ), 'apparentTempHighTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i] ->{apparentTemperatureHighTime} ) ), - 'apparenttempMin' => int( - sprintf( "%.1f", - $data->{daily}->{data}->[$i] - ->{apparentTemperatureMin} ) + 0.5 - ), - 'apparenttempMinTime' => strftime( - "%a, %e %b %Y %H:%M %p", - localtime( - $data->{daily}->{data}->[$i] - ->{apparentTemperatureMinTime} - ) - ), - 'apparenttempMax' => int( - sprintf( "%.1f", - $data->{daily}->{data}->[$i] - ->{apparentTemperatureMax} ) + 0.5 - ), - 'apparenttempMaxTime' => strftime( - "%a, %e %b %Y %H:%M %p", - localtime( - $data->{daily}->{data}->[$i] - ->{apparentTemperatureMaxTime} - ) - ), 'code' => $codes{ $data->{daily}->{data}->[$i]->{icon} }, 'iconAPI' => $data->{daily}->{data}->[$i]->{icon}, @@ -398,7 +350,7 @@ sub _ProcessingRetrieveData($$) { 'uvIndex' => $data->{daily}->{data}->[$i]->{uvIndex}, 'uvIndexTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i]->{uvIndexTime} ) @@ -409,7 +361,7 @@ sub _ProcessingRetrieveData($$) { $data->{daily}->{data}->[$i] ->{precipIntensityMax}, 'precipIntensityMaxTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i] ->{precipIntensityMaxTime} @@ -441,11 +393,11 @@ sub _ProcessingRetrieveData($$) { ), 'windGust' => int( sprintf( "%.1f", - $data->{daily}->{data}->[$i]->{windGust} ) + ($data->{daily}->{data}->[$i]->{windGust} * 3.6) ) + 0.5 ), 'windGustTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i]->{windGustTime} ) @@ -453,13 +405,13 @@ sub _ProcessingRetrieveData($$) { 'moonPhase' => $data->{daily}->{data}->[$i]->{moonPhase}, 'sunsetTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i]->{sunsetTime} ) ), 'sunriseTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{daily}->{data}->[$i]->{sunriseTime} ) @@ -495,13 +447,13 @@ sub _ProcessingRetrieveData($$) { @{ $self->{cached}->{forecast}->{hourly} }, { 'pubDate' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{hourly}->{data}->[$i]->{'time'} ) ), 'day_of_week' => strftime( - "%a", + "%a, %H:%M", localtime( $data->{hourly}->{data}->[$i]->{'time'} ) @@ -526,15 +478,23 @@ sub _ProcessingRetrieveData($$) { $data->{hourly}->{data}->[$i]->{cloudCover} * 100, 'precipType' => $data->{hourly}->{data}->[$i]->{precipType}, - 'wind_direction' => $data->{hourly}->{data}->[$i]->{windBearing}, - 'wind' => sprintf( "%.1f", - ($data->{hourly}->{data}->[$i]->{windSpeed} * 3.6) ), - 'wind_speed' => sprintf( "%.1f", - ($data->{hourly}->{data}->[$i]->{windSpeed} * 3.6) ), - 'windGust' => sprintf( "%.1f", - $data->{hourly}->{data}->[$i]->{windGust} ), + 'wind' => int( + sprintf( "%.1f", + ($data->{hourly}->{data}->[$i]->{windSpeed} * 3.6) ) + + 0.5 + ), + 'wind_speed' => int( + sprintf( "%.1f", + ($data->{hourly}->{data}->[$i]->{windSpeed} * 3.6) ) + + 0.5 + ), + 'windGust' => int( + sprintf( "%.1f", + ($data->{hourly}->{data}->[$i]->{windGust} * 3.6) ) + + 0.5 + ), 'precipProbability' => $data->{hourly}->{data}->[$i]->{precipProbability}, 'pressure' => sprintf( "%.1f", @@ -568,7 +528,7 @@ sub _ErrorHandling($$) { my ( $self, $err ) = @_; $self->{cached}->{current_date_time} = - strftime( "%a, %e %b %Y %H:%M %p", localtime( $self->{fetchTime} ) ), + strftime( "%a, %e %b %Y %H:%M", localtime( $self->{fetchTime} ) ), $self->{cached}->{status} = $err; $self->{cached}->{validity} = 'stale'; } diff --git a/fhem/FHEM/OpenWeatherMapAPI.pm b/fhem/FHEM/OpenWeatherMapAPI.pm index 9f7be4319..70fd67429 100644 --- a/fhem/FHEM/OpenWeatherMapAPI.pm +++ b/fhem/FHEM/OpenWeatherMapAPI.pm @@ -262,7 +262,7 @@ sub _ProcessingRetrieveData($$) { ###### Ab hier wird die ResponseHash Referenze für die Rückgabe zusammen gestellt $self->{cached}->{current_date_time} = - strftime( "%a, %e %b %Y %H:%M %p", + strftime( "%a, %e %b %Y %H:%M", localtime( $self->{fetchTime} ) ); if ( $self->{endpoint} eq 'weather' ) { @@ -310,15 +310,15 @@ sub _ProcessingRetrieveData($$) { 'code' => $codes{ $data->{weather}->[0]->{id} }, 'iconAPI' => $data->{weather}->[0]->{icon}, 'sunsetTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{sys}->{sunset} ) ), 'sunriseTime' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{sys}->{sunrise} ) ), 'pubDate' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( $data->{dt} ) ), }; @@ -337,13 +337,13 @@ sub _ProcessingRetrieveData($$) { @{ $self->{cached}->{forecast}->{hourly} }, { 'pubDate' => strftime( - "%a, %e %b %Y %H:%M %p", + "%a, %e %b %Y %H:%M", localtime( ( $data->{list}->[$i]->{dt} ) - 3600 ) ), 'day_of_week' => strftime( - "%a", + "%a, %H:%M", localtime( ( $data->{list}->[$i]->{dt} ) - 3600 ) @@ -462,7 +462,7 @@ sub _ErrorHandling($$) { my ( $self, $err ) = @_; $self->{cached}->{current_date_time} = - strftime( "%a, %e %b %Y %H:%M %p", localtime( $self->{fetchTime} ) ), + strftime( "%a, %e %b %Y %H:%M", localtime( $self->{fetchTime} ) ), $self->{cached}->{status} = $err; $self->{cached}->{validity} = 'stale'; }