fix write Hash then ref current not present
This commit is contained in:
		| @@ -369,15 +369,18 @@ sub Weather_WriteReadings($$) { | |||||||
|  |  | ||||||
|  |  | ||||||
|     # current |     # current | ||||||
|     while( my ($r,$v) = each %{$dataRef->{current}} ) { |     if ( ref( $dataRef->{current} ) eq 'HASH' ) { | ||||||
|         readingsBulkUpdate($hash, $r, $v); |         while( my ($r,$v) = each %{$dataRef->{current}} ) { | ||||||
|     } |             readingsBulkUpdate($hash, $r, $v); | ||||||
|     readingsBulkUpdate($hash, 'icon',  $iconlist[$dataRef->{current}{code}]); |         } | ||||||
|     if (  defined($dataRef->{current}{wind_direction}) |          | ||||||
|       and defined($dataRef->{current}{wind_speed} ) ) |         readingsBulkUpdate($hash, 'icon',  $iconlist[$dataRef->{current}{code}]); | ||||||
|     { |         if (  defined($dataRef->{current}{wind_direction}) | ||||||
|         my $wdir= degrees_to_direction($dataRef->{current}{wind_direction}, @directions_txt_i18n); |         and defined($dataRef->{current}{wind_speed} ) ) | ||||||
|         readingsBulkUpdate($hash, 'wind_condition', 'Wind: ' . $wdir . ' ' . $dataRef->{current}{wind_speed} . ' km/h'); |         { | ||||||
|  |             my $wdir= degrees_to_direction($dataRef->{current}{wind_direction}, @directions_txt_i18n); | ||||||
|  |             readingsBulkUpdate($hash, 'wind_condition', 'Wind: ' . $wdir . ' ' . $dataRef->{current}{wind_speed} . ' km/h'); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     # forecast |     # forecast | ||||||
| @@ -413,6 +416,7 @@ sub Weather_WriteReadings($$) { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |      | ||||||
|     my $val= 'T:' . $dataRef->{current}{temperature} . '°C' |     my $val= 'T:' . $dataRef->{current}{temperature} . '°C' | ||||||
|             .' ' . substr($status_items_txt_i18n{1}, 0, 1) . ':' . $dataRef->{current}{humidity} . '%' |             .' ' . substr($status_items_txt_i18n{1}, 0, 1) . ':' . $dataRef->{current}{humidity} . '%' | ||||||
|             .' ' . substr($status_items_txt_i18n{0}, 0, 1) . ':' . $dataRef->{current}{wind} . 'km/h' |             .' ' . substr($status_items_txt_i18n{0}, 0, 1) . ':' . $dataRef->{current}{wind} . 'km/h' | ||||||
|   | |||||||
							
								
								
									
										471
									
								
								DarkSkyAPI.pm
									
									
									
									
									
								
							
							
						
						
									
										471
									
								
								DarkSkyAPI.pm
									
									
									
									
									
								
							| @@ -111,7 +111,7 @@ sub _RetrieveDataFromDarkSky($) { | |||||||
|     my $self = shift; |     my $self = shift; | ||||||
|  |  | ||||||
|     # retrieve data from cache |     # retrieve data from cache | ||||||
|     if ( (time() - $self->{fetchTime}) < $self->{cachemaxage} ) { |     if ( ( time() - $self->{fetchTime} ) < $self->{cachemaxage} ) { | ||||||
|         return _CallWeatherCallbackFn($self); |         return _CallWeatherCallbackFn($self); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -126,12 +126,15 @@ sub _RetrieveDataFromDarkSky($) { | |||||||
|         or $self->{key} eq 'none' |         or $self->{key} eq 'none' | ||||||
|         or $missingModul ) |         or $missingModul ) | ||||||
|     { |     { | ||||||
|         _RetrieveDataFinished( $paramRef, |         _RetrieveDataFinished( | ||||||
|             'The given location is invalid. (wrong latitude or longitude?) put both as an attribute in the global device or set define option location=[LAT],[LONG]', |             $paramRef, | ||||||
|             undef ) | 'The given location is invalid. (wrong latitude or longitude?) put both as an attribute in the global device or set define option location=[LAT],[LONG]', | ||||||
|           if ( $self->{lat} eq 'error' or $self->{long} eq 'error' ); |             undef | ||||||
|  |         ) if ( $self->{lat} eq 'error' or $self->{long} eq 'error' ); | ||||||
|  |  | ||||||
|         _RetrieveDataFinished( $paramRef, 'No given api key. (define  myWeather Weather apikey=[KEY])', undef ) |         _RetrieveDataFinished( $paramRef, | ||||||
|  |             'No given api key. (define  myWeather Weather apikey=[KEY])', | ||||||
|  |             undef ) | ||||||
|           if ( $self->{key} eq 'none' ); |           if ( $self->{key} eq 'none' ); | ||||||
|  |  | ||||||
|         _RetrieveDataFinished( $paramRef, |         _RetrieveDataFinished( $paramRef, | ||||||
| @@ -157,9 +160,8 @@ sub _RetrieveDataFinished($$$) { | |||||||
|     my $self = $paramRef->{self}; |     my $self = $paramRef->{self}; | ||||||
|  |  | ||||||
|     if ( !$err ) { |     if ( !$err ) { | ||||||
|         $self->{cached}->{status}   = 'ok'; |         $self->{cached}->{status} = 'ok'; | ||||||
|         $self->{cached}->{validity} = 'up-to-date', |         $self->{cached}->{validity} = 'up-to-date', $self->{fetchTime} = time(); | ||||||
|         $self->{fetchTime} = time(); |  | ||||||
|         _ProcessingRetrieveData( $self, $response ); |         _ProcessingRetrieveData( $self, $response ); | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @@ -172,201 +174,260 @@ sub _RetrieveDataFinished($$$) { | |||||||
| sub _ProcessingRetrieveData($$) { | sub _ProcessingRetrieveData($$) { | ||||||
|     my ( $self, $response ) = @_; |     my ( $self, $response ) = @_; | ||||||
|  |  | ||||||
|     if ( $self->{cached}->{status} eq 'ok' and defined($response) ) |     if ( $self->{cached}->{status} eq 'ok' and defined($response) ) { | ||||||
|         { |         my $data = eval { decode_json($response) }; | ||||||
|             my $data = eval { decode_json($response) }; |  | ||||||
|  |  | ||||||
|             if ($@) { |         if ($@) { | ||||||
|                 _ErrorHandling( $self, 'DarkSky Weather decode JSON err ' . $@ ); |             _ErrorHandling( $self, 'DarkSky Weather decode JSON err ' . $@ ); | ||||||
|             } |         } | ||||||
|             elsif ( defined( $data->{code} ) and defined( $data->{error} ) ) { |         elsif ( defined( $data->{code} ) and defined( $data->{error} ) ) { | ||||||
|                 _ErrorHandling( $self, 'Code: ' . $data->{code} . ' Error: ' . $data->{error} ); |             _ErrorHandling( $self, | ||||||
|             } |                 'Code: ' . $data->{code} . ' Error: ' . $data->{error} ); | ||||||
|             else { |         } | ||||||
|     #             print Dumper $data;       ## für Debugging |         else { | ||||||
|  |             #             print Dumper $data;       ## für Debugging | ||||||
|  |  | ||||||
|                     $self->{cached}->{current_date_time} = strftime("%a,%e %b %Y %H:%M %p",localtime( $self->{fetchTime} )), |             $self->{cached}->{current_date_time} = strftime( | ||||||
|                     $self->{cached}->{timezone} = $data->{timezone}; |                 "%a,%e %b %Y %H:%M %p", | ||||||
|                     $self->{cached}->{license} = $data->{flags}->{'meteoalarm-license'}; |                 localtime( $self->{fetchTime} ) | ||||||
|                     $self->{cached}->{current} = { |               ), | ||||||
|                             'temperature' => int(sprintf("%.1f",$data->{currently}->{temperature}) + 0.5), |               $self->{cached}->{timezone} = $data->{timezone}; | ||||||
|                             'temp_c'      => int(sprintf("%.1f",$data->{currently}->{temperature}) + 0.5), |             $self->{cached}->{license} = $data->{flags}->{'meteoalarm-license'}; | ||||||
|                             'dewPoint'    => int(sprintf("%.1f",$data->{currently}->{dewPoint}) + 0.5), |             $self->{cached}->{current} = { | ||||||
|                             'humidity'    => $data->{currently}->{humidity} * 100, |                 'temperature' => int( | ||||||
|                             'condition' => |                     sprintf( "%.1f", $data->{currently}->{temperature} ) + 0.5 | ||||||
|                                 encode_utf8( $data->{currently}->{summary} ), |                 ), | ||||||
|                             'pressure'       => $data->{currently}->{pressure}, |                 'temp_c' => int( | ||||||
|                             'wind'           => $data->{currently}->{windSpeed}, |                     sprintf( "%.1f", $data->{currently}->{temperature} ) + 0.5 | ||||||
|                             'wind_speed'     => $data->{currently}->{windSpeed}, |                 ), | ||||||
|                             'wind_direction' => $data->{currently}->{windBearing}, |                 'dewPoint' => int( | ||||||
|                             'windGust'       => $data->{currently}->{windGust}, |                     sprintf( "%.1f", $data->{currently}->{dewPoint} ) + 0.5 | ||||||
|                             'cloudCover'     => $data->{currently}->{cloudCover}, |                 ), | ||||||
|                             'uvIndex'        => $data->{currently}->{uvIndex}, |                 'humidity'   => $data->{currently}->{humidity} * 100, | ||||||
|                             'visibility'     => $data->{currently}->{visibility}, |                 'condition'  => encode_utf8( $data->{currently}->{summary} ), | ||||||
|                             'ozone'          => $data->{currently}->{ozone}, |                 'pressure'   => $data->{currently}->{pressure}, | ||||||
|                             'code'           => $codes{ $data->{currently}->{icon} }, |                 'wind'       => $data->{currently}->{windSpeed}, | ||||||
|                             'iconAPI'        => $data->{currently}->{icon}, |                 'wind_speed' => $data->{currently}->{windSpeed}, | ||||||
|                             'pubDate'        => strftime( |                 'wind_direction' => $data->{currently}->{windBearing}, | ||||||
|                                 "%a,%e %b %Y %H:%M %p", |                 'windGust'       => $data->{currently}->{windGust}, | ||||||
|                                 localtime( $data->{currently}->{'time'} ) |                 'cloudCover'     => $data->{currently}->{cloudCover}, | ||||||
|  |                 'uvIndex'        => $data->{currently}->{uvIndex}, | ||||||
|  |                 'visibility'     => $data->{currently}->{visibility}, | ||||||
|  |                 'ozone'          => $data->{currently}->{ozone}, | ||||||
|  |                 'code'           => $codes{ $data->{currently}->{icon} }, | ||||||
|  |                 'iconAPI'        => $data->{currently}->{icon}, | ||||||
|  |                 'pubDate'        => strftime( | ||||||
|  |                     "%a,%e %b %Y %H:%M %p", | ||||||
|  |                     localtime( $data->{currently}->{'time'} ) | ||||||
|  |                 ), | ||||||
|  |                 'precipProbability' => $data->{currently}->{precipProbability}, | ||||||
|  |                 'apparentTemperature' => int( | ||||||
|  |                     sprintf( | ||||||
|  |                         "%.1f", $data->{currently}->{apparentTemperature} | ||||||
|  |                     ) + 0.5 | ||||||
|  |                 ), | ||||||
|  |                 'precipIntensity' => $data->{currently}->{precipIntensity}, | ||||||
|  |             }; | ||||||
|  |  | ||||||
|  |             my $i = 0; | ||||||
|  |             if ( ref( $data->{daily}->{data} ) eq "ARRAY" | ||||||
|  |                 and scalar( @{ $data->{daily}->{data} } ) > 0 ) | ||||||
|  |             { | ||||||
|  |                 foreach ( @{ $data->{daily}->{data} } ) { | ||||||
|  |                     push( | ||||||
|  |                         @{ $self->{cached}->{forcast}->{daily} }, | ||||||
|  |                         { | ||||||
|  |                             'date' => strftime( | ||||||
|  |                                 "%a, %d.%m.%Y", | ||||||
|  |                                 localtime( $data->{daily}->{data}[$i]{'time'} ) | ||||||
|  |                             ), | ||||||
|  |                             'day_of_week' => strftime( | ||||||
|  |                                 "%a", | ||||||
|  |                                 localtime( $data->{daily}->{data}[$i]{'time'} ) | ||||||
|  |                             ), | ||||||
|  |                             'low_c' => int( | ||||||
|  |                                 sprintf( "%.1f", | ||||||
|  |                                     $data->{daily}->{data}[$i]{temperatureLow} ) | ||||||
|  |                                   + 0.5 | ||||||
|  |                             ), | ||||||
|  |                             'high_c' => int( | ||||||
|  |                                 sprintf( "%.1f", | ||||||
|  |                                     $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", | ||||||
|  |                                 localtime( | ||||||
|  |                                     $data->{daily} | ||||||
|  |                                       ->{data}[$i]{temperatureLowTime} | ||||||
|  |                                 ) | ||||||
|  |                             ), | ||||||
|  |                             'tempHigh' => int( | ||||||
|  |                                 sprintf( "%.1f", | ||||||
|  |                                     $data->{daily}->{data}[$i]{temperatureHigh} | ||||||
|  |                                 ) + 0.5 | ||||||
|  |                             ), | ||||||
|  |                             'tempHighTime' => strftime( | ||||||
|  |                                 "%a,%e %b %Y %H:%M %p", | ||||||
|  |                                 localtime( | ||||||
|  |                                     $data->{daily} | ||||||
|  |                                       ->{data}[$i]{temperatureHighTime} | ||||||
|  |                                 ) | ||||||
|  |                             ), | ||||||
|  |                             'apparentTempLow' => int( | ||||||
|  |                                 sprintf( "%.1f", | ||||||
|  |                                     $data->{daily} | ||||||
|  |                                       ->{data}[$i]{apparentTemperatureLow} ) + | ||||||
|  |                                   0.5 | ||||||
|  |                             ), | ||||||
|  |                             'apparentTempLowTime' => strftime( | ||||||
|  |                                 "%a,%e %b %Y %H:%M %p", | ||||||
|  |                                 localtime( | ||||||
|  |                                     $data->{daily} | ||||||
|  |                                       ->{data}[$i]{apparentTemperatureLowTime} | ||||||
|  |                                 ) | ||||||
|  |                             ), | ||||||
|  |                             'apparentTempHigh' => int( | ||||||
|  |                                 sprintf( "%.1f", | ||||||
|  |                                     $data->{daily} | ||||||
|  |                                       ->{data}[$i]{apparentTemperatureHigh} ) + | ||||||
|  |                                   0.5 | ||||||
|  |                             ), | ||||||
|  |                             'apparentTempHighTime' => strftime( | ||||||
|  |                                 "%a,%e %b %Y %H:%M %p", | ||||||
|  |                                 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}, | ||||||
|  |                             'condition' => encode_utf8( | ||||||
|  |                                 $data->{daily}->{data}[$i]{summary} | ||||||
|  |                             ), | ||||||
|  |                             'ozone'   => $data->{daily}->{data}[$i]{ozone}, | ||||||
|  |                             'uvIndex' => $data->{daily}->{data}[$i]{uvIndex}, | ||||||
|  |                             'uvIndexTime' => strftime( | ||||||
|  |                                 "%a,%e %b %Y %H:%M %p", | ||||||
|  |                                 localtime( | ||||||
|  |                                     $data->{daily}->{data}[$i]{uvIndexTime} | ||||||
|  |                                 ) | ||||||
|                             ), |                             ), | ||||||
|                             'precipProbability' => |  | ||||||
|                                 $data->{currently}->{precipProbability}, |  | ||||||
|                             'apparentTemperature' => |  | ||||||
|                                 int(sprintf("%.1f",$data->{currently}->{apparentTemperature}) + 0.5), |  | ||||||
|                             'precipIntensity' => |                             'precipIntensity' => | ||||||
|                                 $data->{currently}->{precipIntensity}, |                               $data->{daily}->{data}[$i]{precipIntensity}, | ||||||
|                         }; |                             'precipIntensityMax' => | ||||||
|  |                               $data->{daily}->{data}[$i]{precipIntensityMax}, | ||||||
|  |                             'precipIntensityMaxTime' => strftime( | ||||||
|  |                                 "%a,%e %b %Y %H:%M %p", | ||||||
|  |                                 localtime( | ||||||
|  |                                     $data->{daily} | ||||||
|  |                                       ->{data}[$i]{precipIntensityMaxTime} | ||||||
|  |                                 ) | ||||||
|  |                             ), | ||||||
|  |                             'dewPoint' => $data->{daily}->{data}[$i]{dewPoint}, | ||||||
|  |                             'humidity' => $data->{daily}->{data}[$i]{humidity} | ||||||
|  |                               * 100, | ||||||
|  |                             'cloudCover' => | ||||||
|  |                               $data->{daily}->{data}[$i]{cloudCover}, | ||||||
|  |                             'precipType' => | ||||||
|  |                               $data->{daily}->{data}[$i]{precipType}, | ||||||
|  |  | ||||||
|                     my $i = 0; |                             'wind_direction' => | ||||||
|                     if ( ref($data->{daily}->{data}) eq "ARRAY" |                               $data->{daily}->{data}[$i]{windBearing}, | ||||||
|                      and scalar(@{ $data->{daily}->{data}}) > 0 ) |                             'wind' => $data->{daily}->{data}[$i]{windSpeed}, | ||||||
|                     { |                             'wind_speed' => | ||||||
|                         foreach (@{$data->{daily}->{data}}) { |                               $data->{daily}->{data}[$i]{windSpeed}, | ||||||
|                             push (@{$self->{cached}->{forcast}->{daily}}, |                             'windGust' => $data->{daily}->{data}[$i]{windGust}, | ||||||
|                                     { |                             'windGustTime' => strftime( | ||||||
|                                         'date' => strftime( |                                 "%a,%e %b %Y %H:%M %p", | ||||||
|                                             "%a, %d.%m.%Y", |                                 localtime( | ||||||
|                                             localtime( $data->{daily}->{data}[$i]{'time'} ) |                                     $data->{daily}->{data}[$i]{windGustTime} | ||||||
|                                         ), |                                 ) | ||||||
|                                         'day_of_week' => strftime( |                             ), | ||||||
|                                             "%a", |                             'moonPhase' => | ||||||
|                                             localtime( $data->{daily}->{data}[$i]{'time'} ) |                               $data->{daily}->{data}[$i]{moonPhase}, | ||||||
|                                         ), |                             'sunsetTime' => strftime( | ||||||
|                                         'low_c' => int(sprintf("%.1f",$data->{daily}->{data}[$i]{temperatureLow}) + 0.5), |                                 "%a,%e %b %Y %H:%M %p", | ||||||
|                                         'high_c' => |                                 localtime( | ||||||
|                                         int(sprintf("%.1f",$data->{daily}->{data}[$i]{temperatureHigh}) + 0.5), |                                     $data->{daily}->{data}[$i]{sunsetTime} | ||||||
|                                         'tempMin' => |                                 ) | ||||||
|                                         int(sprintf("%.1f",$data->{daily}->{data}[$i]{temperatureMin}) + 0.5), |                             ), | ||||||
|                                         'tempMinTime' => strftime( |                             'sunriseTime' => strftime( | ||||||
|                                             "%a,%e %b %Y %H:%M %p", |                                 "%a,%e %b %Y %H:%M %p", | ||||||
|                                             localtime( |                                 localtime( | ||||||
|                                                 $data->{daily}->{data}[$i]{temperatureMinTime} |                                     $data->{daily}->{data}[$i]{sunriseTime} | ||||||
|                                             ) |                                 ) | ||||||
|                                         ), |                             ), | ||||||
|                                         '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", |  | ||||||
|                                             localtime( |  | ||||||
|                                                 $data->{daily}->{data}[$i]{temperatureLowTime} |  | ||||||
|                                             ) |  | ||||||
|                                         ), |  | ||||||
|                                         'tempHigh' => |  | ||||||
|                                         int(sprintf("%.1f",$data->{daily}->{data}[$i]{temperatureHigh}) + 0.5), |  | ||||||
|                                         'tempHighTime' => strftime( |  | ||||||
|                                             "%a,%e %b %Y %H:%M %p", |  | ||||||
|                                             localtime( |  | ||||||
|                                                 $data->{daily}->{data}[$i]{temperatureHighTime} |  | ||||||
|                                             ) |  | ||||||
|                                         ), |  | ||||||
|                                         'apparentTempLow' => |  | ||||||
|                                         int(sprintf("%.1f",$data->{daily}->{data}[$i]{apparentTemperatureLow}) + 0.5), |  | ||||||
|                                         'apparentTempLowTime' => strftime( |  | ||||||
|                                             "%a,%e %b %Y %H:%M %p", |  | ||||||
|                                             localtime( |  | ||||||
|                                                 $data->{daily}->{data}[$i] |  | ||||||
|                                                 {apparentTemperatureLowTime} |  | ||||||
|                                             ) |  | ||||||
|                                         ), |  | ||||||
|                                         'apparentTempHigh' => |  | ||||||
|                                         int(sprintf("%.1f",$data->{daily}->{data}[$i]{apparentTemperatureHigh}) + 0.5), |  | ||||||
|                                         'apparentTempHighTime' => strftime( |  | ||||||
|                                             "%a,%e %b %Y %H:%M %p", |  | ||||||
|                                             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}, |  | ||||||
|                                         'condition' => |  | ||||||
|                                         encode_utf8( $data->{daily}->{data}[$i]{summary} ), |  | ||||||
|                                         'ozone'       => $data->{daily}->{data}[$i]{ozone}, |  | ||||||
|                                         'uvIndex'     => $data->{daily}->{data}[$i]{uvIndex}, |  | ||||||
|                                         'uvIndexTime' => strftime( |  | ||||||
|                                             "%a,%e %b %Y %H:%M %p", |  | ||||||
|                                             localtime( |  | ||||||
|                                                 $data->{daily}->{data}[$i]{uvIndexTime} |  | ||||||
|                                             ) |  | ||||||
|                                         ), |  | ||||||
|                                         'precipIntensity' => |  | ||||||
|                                         $data->{daily}->{data}[$i]{precipIntensity}, |  | ||||||
|                                         'precipIntensityMax' => |  | ||||||
|                                         $data->{daily}->{data}[$i]{precipIntensityMax}, |  | ||||||
|                                         'precipIntensityMaxTime' => strftime( |  | ||||||
|                                             "%a,%e %b %Y %H:%M %p", |  | ||||||
|                                             localtime( |  | ||||||
|                                                 $data->{daily}->{data}[$i] |  | ||||||
|                                                 {precipIntensityMaxTime} |  | ||||||
|                                             ) |  | ||||||
|                                         ), |  | ||||||
|                                         'dewPoint'   => $data->{daily}->{data}[$i]{dewPoint}, |  | ||||||
|                                         'humidity'   => $data->{daily}->{data}[$i]{humidity} * 100, |  | ||||||
|                                         'cloudCover' => $data->{daily}->{data}[$i]{cloudCover}, |  | ||||||
|                                         'precipType' => $data->{daily}->{data}[$i]{precipType}, |  | ||||||
|  |  | ||||||
|                                         'wind_direction' => |                             'precipProbability' => | ||||||
|                                         $data->{daily}->{data}[$i]{windBearing}, |                               $data->{daily}->{data}[$i]{precipProbability}, | ||||||
|                                         'wind'       => $data->{daily}->{data}[$i]{windSpeed}, |                             'pressure' => $data->{daily}->{data}[$i]{pressure}, | ||||||
|                                         'wind_speed' => $data->{daily}->{data}[$i]{windSpeed}, |                             'visibility' => | ||||||
|                                         'windGust'   => $data->{daily}->{data}[$i]{windGust}, |                               $data->{daily}->{data}[$i]{visibility}, | ||||||
|                                         'windGustTime' => strftime( |  | ||||||
|                                             "%a,%e %b %Y %H:%M %p", |  | ||||||
|                                             localtime( |  | ||||||
|                                                 $data->{daily}->{data}[$i]{windGustTime} |  | ||||||
|                                             ) |  | ||||||
|                                         ), |  | ||||||
|                                         'moonPhase'  => $data->{daily}->{data}[$i]{moonPhase}, |  | ||||||
|                                         'sunsetTime' => strftime( |  | ||||||
|                                             "%a,%e %b %Y %H:%M %p", |  | ||||||
|                                             localtime( |  | ||||||
|                                                 $data->{daily}->{data}[$i]{sunsetTime} |  | ||||||
|                                             ) |  | ||||||
|                                         ), |  | ||||||
|                                         'sunriseTime' => strftime( |  | ||||||
|                                             "%a,%e %b %Y %H:%M %p", |  | ||||||
|                                             localtime( |  | ||||||
|                                                 $data->{daily}->{data}[$i]{sunriseTime} |  | ||||||
|                                             ) |  | ||||||
|                                         ), |  | ||||||
|  |  | ||||||
|                                         'precipProbability' => |  | ||||||
|                                         $data->{daily}->{data}[$i]{precipProbability}, |  | ||||||
|                                         'pressure'   => $data->{daily}->{data}[$i]{pressure}, |  | ||||||
|                                         'visibility' => $data->{daily}->{data}[$i]{visibility}, |  | ||||||
|                                     }); |  | ||||||
|                             $i++; |  | ||||||
|                         } |                         } | ||||||
|                     } |                     ); | ||||||
|  |                      | ||||||
|  |                     $i++; | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     ## Aufruf der callbackFn |     ## Aufruf der callbackFn | ||||||
|     _CallWeatherCallbackFn($self); |     _CallWeatherCallbackFn($self); | ||||||
| @@ -380,10 +441,11 @@ sub _CallWeatherCallbackFn($) { | |||||||
| } | } | ||||||
|  |  | ||||||
| sub _ErrorHandling($$) { | sub _ErrorHandling($$) { | ||||||
|     my ($self,$err) = @_; |     my ( $self, $err ) = @_; | ||||||
|  |  | ||||||
|     $self->{cached}->{current_date_time} = strftime("%a,%e %b %Y %H:%M %p",localtime( $self->{fetchTime} )), |     $self->{cached}->{current_date_time} = | ||||||
|     $self->{cached}->{status} = $err; |       strftime( "%a,%e %b %Y %H:%M %p", localtime( $self->{fetchTime} ) ), | ||||||
|  |       $self->{cached}->{status} = $err; | ||||||
|     $self->{cached}->{validity} = 'stale'; |     $self->{cached}->{validity} = 'stale'; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -391,12 +453,13 @@ sub _CreateForcastRef($) { | |||||||
|     my $self = shift; |     my $self = shift; | ||||||
|  |  | ||||||
|     my $forcastRef = ( |     my $forcastRef = ( | ||||||
|             { |         { | ||||||
|                 lat      => $self->{lat}, |             lat  => $self->{lat}, | ||||||
|                 long     => $self->{long}, |             long => $self->{long}, | ||||||
|                 apiMaintainer => 'Leon Gaultier (<a href=https://forum.fhem.de/index.php?action=profile;u=13684>CoolTux</a>)', |             apiMaintainer => | ||||||
|             } | 'Leon Gaultier (<a href=https://forum.fhem.de/index.php?action=profile;u=13684>CoolTux</a>)', | ||||||
|         ); |         } | ||||||
|  |     ); | ||||||
|  |  | ||||||
|     return $forcastRef; |     return $forcastRef; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -53,9 +53,35 @@ use constant URL => 'https://api.openweathermap.org/data/2.5/'; | |||||||
| ## URL . 'forcast?' for forcast data | ## URL . 'forcast?' for forcast data | ||||||
|  |  | ||||||
| my %codes = ( | my %codes = ( | ||||||
|     200 => 45, 201 => 45, 202 => 45, 210 => 4, 211 => 4, 212 => 3, 221 => 4, 230 => 45, 231 => 45, 232 => 45, |     200 => 45, | ||||||
|     300 => 9, 301 => 9, 302 => 9, 310 => 9, 311 => 9, 312 => 9, 313 => 9, 314 => 9, 321 => 9, |     201 => 45, | ||||||
|     500 => 35, 501 => 35, 502 => 35, 503 => 35, 504 => 35, 511 => 35, 520 => 35, 521 => 35, 522 => 35, 531 => 35, |     202 => 45, | ||||||
|  |     210 => 4, | ||||||
|  |     211 => 4, | ||||||
|  |     212 => 3, | ||||||
|  |     221 => 4, | ||||||
|  |     230 => 45, | ||||||
|  |     231 => 45, | ||||||
|  |     232 => 45, | ||||||
|  |     300 => 9, | ||||||
|  |     301 => 9, | ||||||
|  |     302 => 9, | ||||||
|  |     310 => 9, | ||||||
|  |     311 => 9, | ||||||
|  |     312 => 9, | ||||||
|  |     313 => 9, | ||||||
|  |     314 => 9, | ||||||
|  |     321 => 9, | ||||||
|  |     500 => 35, | ||||||
|  |     501 => 35, | ||||||
|  |     502 => 35, | ||||||
|  |     503 => 35, | ||||||
|  |     504 => 35, | ||||||
|  |     511 => 35, | ||||||
|  |     520 => 35, | ||||||
|  |     521 => 35, | ||||||
|  |     522 => 35, | ||||||
|  |     531 => 35, | ||||||
| ); | ); | ||||||
|  |  | ||||||
| sub new { | sub new { | ||||||
| @@ -109,7 +135,7 @@ sub _RetrieveDataFromOpenWeatherMap($) { | |||||||
|     my $self = shift; |     my $self = shift; | ||||||
|  |  | ||||||
|     # retrieve data from cache |     # retrieve data from cache | ||||||
|     if ( (time() - $self->{fetchTime}) < $self->{cachemaxage} ) { |     if ( ( time() - $self->{fetchTime} ) < $self->{cachemaxage} ) { | ||||||
|         return _CallWeatherCallbackFn($self); |         return _CallWeatherCallbackFn($self); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -127,12 +153,15 @@ sub _RetrieveDataFromOpenWeatherMap($) { | |||||||
|         or $self->{key} eq 'none' |         or $self->{key} eq 'none' | ||||||
|         or $missingModul ) |         or $missingModul ) | ||||||
|     { |     { | ||||||
|         _RetrieveDataFinished( $paramRef, |         _RetrieveDataFinished( | ||||||
|             'The given location is invalid. (wrong latitude or longitude?) put both as an attribute in the global device or set define option location=[LAT],[LONG]', |             $paramRef, | ||||||
|             undef ) | 'The given location is invalid. (wrong latitude or longitude?) put both as an attribute in the global device or set define option location=[LAT],[LONG]', | ||||||
|           if ( $self->{lat} eq 'error' or $self->{long} eq 'error' ); |             undef | ||||||
|  |         ) if ( $self->{lat} eq 'error' or $self->{long} eq 'error' ); | ||||||
|  |  | ||||||
|         _RetrieveDataFinished( $paramRef, 'No given api key. (define  myWeather Weather apikey=[KEY])', undef ) |         _RetrieveDataFinished( $paramRef, | ||||||
|  |             'No given api key. (define  myWeather Weather apikey=[KEY])', | ||||||
|  |             undef ) | ||||||
|           if ( $self->{key} eq 'none' ); |           if ( $self->{key} eq 'none' ); | ||||||
|  |  | ||||||
|         _RetrieveDataFinished( $paramRef, |         _RetrieveDataFinished( $paramRef, | ||||||
| @@ -142,14 +171,11 @@ sub _RetrieveDataFromOpenWeatherMap($) { | |||||||
|     else { |     else { | ||||||
|         $paramRef->{url} = |         $paramRef->{url} = | ||||||
|             URL |             URL | ||||||
|           . $paramRef->{endpoint} . '?' |           . $paramRef->{endpoint} . '?' . 'lat=' | ||||||
|           . 'lat=' |           . $self->{lat} . '&' . 'lon=' | ||||||
|           . $self->{lat} . '&' |  | ||||||
|           . 'lon=' |  | ||||||
|           . $self->{long} . '&' |           . $self->{long} . '&' | ||||||
|           . 'APPID=' |           . 'APPID=' | ||||||
|           . $self->{key} . '&' |           . $self->{key} . '&' . 'lang=' | ||||||
|           . 'lang=' |  | ||||||
|           . $self->{lang}; |           . $self->{lang}; | ||||||
|  |  | ||||||
|         main::HttpUtils_NonblockingGet($paramRef); |         main::HttpUtils_NonblockingGet($paramRef); | ||||||
| @@ -161,9 +187,8 @@ sub _RetrieveDataFinished($$$) { | |||||||
|     my $self = $paramRef->{self}; |     my $self = $paramRef->{self}; | ||||||
|  |  | ||||||
|     if ( !$err ) { |     if ( !$err ) { | ||||||
|         $self->{cached}->{status}   = 'ok'; |         $self->{cached}->{status} = 'ok'; | ||||||
|         $self->{cached}->{validity} = 'up-to-date', |         $self->{cached}->{validity} = 'up-to-date', $self->{fetchTime} = time(); | ||||||
|         $self->{fetchTime} = time(); |  | ||||||
|         _ProcessingRetrieveData( $self, $response ); |         _ProcessingRetrieveData( $self, $response ); | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
| @@ -178,57 +203,80 @@ sub _RetrieveDataFinished($$$) { | |||||||
| sub _ProcessingRetrieveData($$) { | sub _ProcessingRetrieveData($$) { | ||||||
|     my ( $self, $response ) = @_; |     my ( $self, $response ) = @_; | ||||||
|  |  | ||||||
|     if ( $self->{cached}->{status} eq 'ok' and defined($response) ) |     if ( $self->{cached}->{status} eq 'ok' and defined($response) ) { | ||||||
|         { |         my $data = eval { decode_json($response) }; | ||||||
|             my $data = eval { decode_json($response) }; |  | ||||||
|             #print 'Dumper1: ' . Dumper $data; |  | ||||||
|  |  | ||||||
|             if ($@) { | #         print 'Dumper1: ' . Dumper $data; | ||||||
|                 _ErrorHandling( $self, 'OpenWeatherMap Weather decode JSON err ' . $@ ); |  | ||||||
|             } |  | ||||||
|             elsif ( defined($data->{cod}) and defined($data->{message}) ) { |  | ||||||
|                 print 'Dumper2: ' . Dumper $data; |  | ||||||
|                 _ErrorHandling( $self, $data->{cod} . ': ' . $data->{message} ); |  | ||||||
|             } |  | ||||||
|             else { |  | ||||||
|     #             print Dumper $data;       ## für Debugging |  | ||||||
|                 return if ( $self->{endpoint} eq 'forcast' ); |  | ||||||
|  |  | ||||||
|  |         if ($@) { | ||||||
|                 $self->{cached}->{current_date_time} = strftime("%a,%e %b %Y %H:%M %p",localtime( $self->{fetchTime} )), |             _ErrorHandling( $self, | ||||||
|                 $self->{cached}->{country} = $data->{sys}->{country}; |                 'OpenWeatherMap Weather decode JSON err ' . $@ ); | ||||||
|                 $self->{cached}->{city} = $data->{name}; |  | ||||||
|                 $self->{cached}->{current} = { |  | ||||||
|                             'temperature' => int(sprintf("%.1f",($data->{main}->{temp} - 273.15 )) + 0.5), |  | ||||||
|                             'temp_c'      => int(sprintf("%.1f",($data->{main}->{temp} - 273.15 )) + 0.5), |  | ||||||
|                             'low_c'       => int(sprintf("%.1f",($data->{main}->{temp_min} - 273.15 )) + 0.5), |  | ||||||
|                             'high_c'      => int(sprintf("%.1f",($data->{main}->{temp_max} - 273.15 )) + 0.5), |  | ||||||
|                             'tempLow'     => int(sprintf("%.1f",($data->{main}->{temp_min} - 273.15 )) + 0.5), |  | ||||||
|                             'tempHigh'    => int(sprintf("%.1f",($data->{main}->{temp_max} - 273.15 )) + 0.5), |  | ||||||
|                             'humidity'    => $data->{main}->{humidity}, |  | ||||||
|                             'condition' => |  | ||||||
|                             encode_utf8( $data->{weather}[0]{description} ), |  | ||||||
|                             'pressure'       => $data->{main}->{pressure}, |  | ||||||
|                             'wind'           => $data->{wind}->{speed}, |  | ||||||
|                             'wind_speed'     => $data->{wind}->{speed}, |  | ||||||
|                             'wind_direction' => $data->{wind}->{deg}, |  | ||||||
|                             'cloudCover'     => $data->{clouds}->{all}, |  | ||||||
|                             'visibility'     => $data->{visibility}, |  | ||||||
|     #                         'code'           => $codes{ $data->{weather}[0]{icon} }, |  | ||||||
|                             'iconAPI'        => $data->{weather}[0]{icon}, |  | ||||||
|                             'sunsetTime'     => strftime("%a,%e %b %Y %H:%M %p",localtime($data->{sys}->{sunset})), |  | ||||||
|                             'sunriseTime'    => strftime("%a,%e %b %Y %H:%M %p",localtime($data->{sys}->{sunrise})), |  | ||||||
|                             'pubDate'        => strftime( |  | ||||||
|                                 "%a,%e %b %Y %H:%M %p", |  | ||||||
|                                 localtime( $data->{dt} ) |  | ||||||
|                             ), |  | ||||||
|                         } if ( $self->{endpoint} eq 'weather' ); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|  |         elsif ( defined( $data->{cod} ) and defined( $data->{message} ) ) { | ||||||
|  |             print 'Dumper2: ' . Dumper $data; | ||||||
|  |             _ErrorHandling( $self, $data->{cod} . ': ' . $data->{message} ); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  | #             print Dumper $data;       ## für Debugging | ||||||
|  |             return if ( $self->{endpoint} eq 'forcast' ); | ||||||
|  |  | ||||||
| #     $self->{cached} = $forcastRef;         Vorsicht |             $self->{cached}->{current_date_time} = strftime( | ||||||
|  |                 "%a,%e %b %Y %H:%M %p", | ||||||
|  |                 localtime( $self->{fetchTime} ) | ||||||
|  |               ), | ||||||
|  |               $self->{cached}->{country} = $data->{sys}->{country}; | ||||||
|  |             $self->{cached}->{city}    = $data->{name}; | ||||||
|  |             $self->{cached}->{current} = { | ||||||
|  |                 'temperature' => int( | ||||||
|  |                     sprintf( "%.1f", ( $data->{main}->{temp} - 273.15 ) ) + 0.5 | ||||||
|  |                 ), | ||||||
|  |                 'temp_c' => int( | ||||||
|  |                     sprintf( "%.1f", ( $data->{main}->{temp} - 273.15 ) ) + 0.5 | ||||||
|  |                 ), | ||||||
|  |                 'low_c' => int( | ||||||
|  |                     sprintf( "%.1f", ( $data->{main}->{temp_min} - 273.15 ) ) + | ||||||
|  |                       0.5 | ||||||
|  |                 ), | ||||||
|  |                 'high_c' => int( | ||||||
|  |                     sprintf( "%.1f", ( $data->{main}->{temp_max} - 273.15 ) ) + | ||||||
|  |                       0.5 | ||||||
|  |                 ), | ||||||
|  |                 'tempLow' => int( | ||||||
|  |                     sprintf( "%.1f", ( $data->{main}->{temp_min} - 273.15 ) ) + | ||||||
|  |                       0.5 | ||||||
|  |                 ), | ||||||
|  |                 'tempHigh' => int( | ||||||
|  |                     sprintf( "%.1f", ( $data->{main}->{temp_max} - 273.15 ) ) + | ||||||
|  |                       0.5 | ||||||
|  |                 ), | ||||||
|  |                 'humidity'   => $data->{main}->{humidity}, | ||||||
|  |                 'condition'  => encode_utf8( $data->{weather}[0]{description} ), | ||||||
|  |                 'pressure'   => $data->{main}->{pressure}, | ||||||
|  |                 'wind'       => $data->{wind}->{speed}, | ||||||
|  |                 'wind_speed' => $data->{wind}->{speed}, | ||||||
|  |                 'wind_direction' => $data->{wind}->{deg}, | ||||||
|  |                 'cloudCover'     => $data->{clouds}->{all}, | ||||||
|  |                 'visibility'     => $data->{visibility}, | ||||||
|  |  | ||||||
|     _RetrieveDataFromOpenWeatherMap($self) if ( $self->{endpoint} eq 'weather' ); | #                         'code'           => $codes{ $data->{weather}[0]{icon} }, | ||||||
|  |                 'iconAPI'    => $data->{weather}[0]{icon}, | ||||||
|  |                 'sunsetTime' => strftime( | ||||||
|  |                     "%a,%e %b %Y %H:%M %p", | ||||||
|  |                     localtime( $data->{sys}->{sunset} ) | ||||||
|  |                 ), | ||||||
|  |                 'sunriseTime' => strftime( | ||||||
|  |                     "%a,%e %b %Y %H:%M %p", | ||||||
|  |                     localtime( $data->{sys}->{sunrise} ) | ||||||
|  |                 ), | ||||||
|  |                 'pubDate' => | ||||||
|  |                   strftime( "%a,%e %b %Y %H:%M %p", localtime( $data->{dt} ) ), | ||||||
|  |               } | ||||||
|  |               if ( $self->{endpoint} eq 'weather' ); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     _RetrieveDataFromOpenWeatherMap($self) | ||||||
|  |       if ( $self->{endpoint} eq 'weather' ); | ||||||
|     $self->{endpoint} = 'none' if ( $self->{endpoint} eq 'forcast' ); |     $self->{endpoint} = 'none' if ( $self->{endpoint} eq 'forcast' ); | ||||||
|  |  | ||||||
|     _CallWeatherCallbackFn($self); |     _CallWeatherCallbackFn($self); | ||||||
| @@ -242,10 +290,11 @@ sub _CallWeatherCallbackFn($) { | |||||||
| } | } | ||||||
|  |  | ||||||
| sub _ErrorHandling($$) { | sub _ErrorHandling($$) { | ||||||
|     my ($self,$err) = @_; |     my ( $self, $err ) = @_; | ||||||
|  |  | ||||||
|     $self->{cached}->{current_date_time} = strftime("%a,%e %b %Y %H:%M %p",localtime( $self->{fetchTime} )), |     $self->{cached}->{current_date_time} = | ||||||
|     $self->{cached}->{status} = $err; |       strftime( "%a,%e %b %Y %H:%M %p", localtime( $self->{fetchTime} ) ), | ||||||
|  |       $self->{cached}->{status} = $err; | ||||||
|     $self->{cached}->{validity} = 'stale'; |     $self->{cached}->{validity} = 'stale'; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -253,12 +302,13 @@ sub _CreateForcastRef($) { | |||||||
|     my $self = shift; |     my $self = shift; | ||||||
|  |  | ||||||
|     my $forcastRef = ( |     my $forcastRef = ( | ||||||
|             { |         { | ||||||
|                 lat      => $self->{lat}, |             lat  => $self->{lat}, | ||||||
|                 long     => $self->{long}, |             long => $self->{long}, | ||||||
|                 apiMaintainer => 'Leon Gaultier (<a href=https://forum.fhem.de/index.php?action=profile;u=13684>CoolTux</a>)', |             apiMaintainer => | ||||||
|             } | 'Leon Gaultier (<a href=https://forum.fhem.de/index.php?action=profile;u=13684>CoolTux</a>)', | ||||||
|         ); |         } | ||||||
|  |     ); | ||||||
|  |  | ||||||
|     return $forcastRef; |     return $forcastRef; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user