patch-specials #10
| @@ -1,4 +1,4 @@ | |||||||
| UPD 2022-12-28_09:21:01 54815 FHEM/59_Weather.pm | UPD 2022-12-28_09:21:01 54815 FHEM/59_Weather.pm | ||||||
| UPD 2022-12-28_09:20:44 49883 lib/FHEM/APIs/Weather/DarkSkyAPI.pm | UPD 2022-12-28_09:20:44 49883 lib/FHEM/APIs/Weather/DarkSkyAPI.pm | ||||||
| UPD 2022-12-28_09:20:52 32101 lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm | UPD 2022-12-28_09:20:52 32101 lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm | ||||||
| UPD 2022-12-28_09:20:32 35424 lib/FHEM/APIs/Weather/wundergroundAPI.pm | UPD 2022-12-29_04:40:05 35600 lib/FHEM/APIs/Weather/wundergroundAPI.pm | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ use FHEM::Meta; | |||||||
| use POSIX; | use POSIX; | ||||||
| use HttpUtils; | use HttpUtils; | ||||||
| use experimental qw /switch/; | use experimental qw /switch/; | ||||||
|  | use Encode; | ||||||
|  |  | ||||||
| my $META = {}; | my $META = {}; | ||||||
| my $ret  = FHEM::Meta::getMetadata( __FILE__, $META ); | my $ret  = FHEM::Meta::getMetadata( __FILE__, $META ); | ||||||
| @@ -75,8 +76,10 @@ eval { | |||||||
|  |  | ||||||
| my $missingModul = ''; | my $missingModul = ''; | ||||||
|  |  | ||||||
| # use Data::Dumper;    # for Debug only | ## no critic (Conditional "use" statement. Use "require" to conditionally include a module (Modules::ProhibitConditionalUseStatements)) | ||||||
| ## API URL | eval { use Encode qw /encode_utf8/; 1 } | ||||||
|  |   or $missingModul .= 'Encode '; | ||||||
|  |  | ||||||
| eval { use Readonly; 1 } | eval { use Readonly; 1 } | ||||||
|   or $missingModul .= 'Readonly ';    # apt install libreadonly-perl |   or $missingModul .= 'Readonly ';    # apt install libreadonly-perl | ||||||
| ## use critic | ## use critic | ||||||
| @@ -370,7 +373,7 @@ sub _ProcessingRetrieveData { | |||||||
|         and defined($response) |         and defined($response) | ||||||
|         and $response ) |         and $response ) | ||||||
|     { |     { | ||||||
|         if ( $response =~ m/^\{.*\}$/ ) { |         if ( $response =~ m/^\{.*\}$/x ) { | ||||||
|             my $data = eval { decode_json( encode_utf8($response) ) }; |             my $data = eval { decode_json( encode_utf8($response) ) }; | ||||||
|             if ($@) { |             if ($@) { | ||||||
|                 _ErrorHandling( $self, |                 _ErrorHandling( $self, | ||||||
| @@ -486,13 +489,13 @@ sub _ProcessingRetrieveData { | |||||||
|  |  | ||||||
|                     while ( $i < $days ) { |                     while ( $i < $days ) { | ||||||
|                         $data->{moonriseTimeLocal}[$i] =~ |                         $data->{moonriseTimeLocal}[$i] =~ | ||||||
|                           s/^(....-..-..T..:..).*/$1/; |                           s/^(....-..-..T..:..).*/$1/x; | ||||||
|                         $data->{moonsetTimeLocal}[$i] =~ |                         $data->{moonsetTimeLocal}[$i] =~ | ||||||
|                           s/^(....-..-..T..:..).*/$1/; |                           s/^(....-..-..T..:..).*/$1/x; | ||||||
|                         $data->{sunriseTimeLocal}[$i] =~ |                         $data->{sunriseTimeLocal}[$i] =~ | ||||||
|                           s/^(....-..-..T..:..).*/$1/; |                           s/^(....-..-..T..:..).*/$1/x; | ||||||
|                         $data->{sunsetTimeLocal}[$i] =~ |                         $data->{sunsetTimeLocal}[$i] =~ | ||||||
|                           s/^(....-..-..T..:..).*/$1/; |                           s/^(....-..-..T..:..).*/$1/x; | ||||||
|  |  | ||||||
|                         push( |                         push( | ||||||
|                             @{ $self->{cached}{forecast}{daily} }, |                             @{ $self->{cached}{forecast}{daily} }, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user