@@ -70,8 +70,8 @@ WeatherProvider.register("weatherapi", {
7070 . map ( ( v ) => `${ v } ` . trim ( ) )
7171 . filter ( ( v ) => v !== "" ) ;
7272
73- if ( locationParts . length === 0 ) {
74- this . setFetchLocation ( locationParts . join ( ", " ) . trim ( ) ) ;
73+ if ( locationParts . length > 0 ) {
74+ this . setFetchedLocation ( locationParts . join ( ", " ) . trim ( ) ) ;
7575 }
7676
7777 return responseData ;
@@ -291,7 +291,7 @@ WeatherProvider.register("weatherapi", {
291291 case "NNW" :
292292 return ( 326.25 + 348.75 ) / 2 ;
293293 default :
294- return "N" ;
294+ return 0 ; // North by default
295295 }
296296 } ,
297297
@@ -316,7 +316,8 @@ WeatherProvider.register("weatherapi", {
316316 currentWeather . minTemperature = parseFloat ( weather . day . mintemp_c ) ;
317317 currentWeather . maxTemperature = parseFloat ( weather . day . maxtemp_c ) ;
318318 currentWeather . snow = parseFloat ( data . current . snow_cm * 10 ) ;
319- currentWeather . precipitationAmount = parseFloat ( data . current . precip_mm ) ;
319+ currentWeather . rain = parseFloat ( data . current . precip_mm ) ;
320+ currentWeather . precipitationAmount = currentWeather . rain + currentWeather . snow ;
320321 currentWeather . uv_index = parseFloat ( data . current . uv ) ;
321322
322323 return currentWeather ;
@@ -331,7 +332,7 @@ WeatherProvider.register("weatherapi", {
331332 const refTime = moment ( fd . date , "YYYY-MM-DD" ) . format ( "YYYY-MM-DD HH:00" ) ;
332333 const sameTime = fd . hour . find ( ( h ) => h . time === refTime ) ;
333334
334- const precipitationPropability
335+ const precipitationProbability
335336 = ( fd . hour . reduce ( ( acc , h ) => {
336337 const idxValue = ( ( h . will_it_rain ?? 0 ) + ( h . will_it_snow ?? 0 ) ) / 2 ;
337338 return acc + idxValue ;
@@ -346,16 +347,16 @@ WeatherProvider.register("weatherapi", {
346347 fd . day . condition . code ,
347348 true
348349 ) ;
349- weather . windSpeed = fd . day . maxwind_kph * 0.2778 ;
350- weather . windFromDirection = this . cardinalWindDirection ( sameTime . wind_dir ) ;
350+ weather . windSpeed = parseFloat ( fd . day . maxwind_kph ) * 0.2778 ;
351+ weather . windFromDirection = this . cardinalWindDirection ( sameTime ? .wind_dir ) ;
351352 weather . sunrise = this . parseSunDatetime ( fd , "sunrise" ) ;
352353 weather . sunset = this . parseSunDatetime ( fd , "sunset" ) ;
353354 weather . temperature = parseFloat ( fd . day . avgtemp_c ) ;
354355 weather . humidity = parseFloat ( fd . day . avghumidity ) ;
355356 weather . snow = parseFloat ( fd . day . totalsnow_cm * 10 ) ;
356357 weather . rain = parseFloat ( fd . day . totalprecip_mm ) ;
357358 weather . precipitationAmount = weather . rain + weather . snow ;
358- weather . precipitationPropability = precipitationPropability ;
359+ weather . precipitationProbability = precipitationProbability ;
359360 weather . uv_index = parseFloat ( fd . day . uv ) ;
360361
361362 days . push ( weather ) ;
@@ -389,7 +390,7 @@ WeatherProvider.register("weatherapi", {
389390 weather . minTemperature = parseFloat ( fd . day . mintemp_c ) ;
390391 weather . maxTemperature = parseFloat ( fd . day . maxtemp_c ) ;
391392 weather . humidity = parseFloat ( h . humidity ) ;
392- weather . windSpeed = fd . day . maxwind_kph * 0.2778 ;
393+ weather . windSpeed = parseFloat ( fd . day . maxwind_kph ) * 0.2778 ;
393394 weather . windFromDirection = this . cardinalWindDirection ( h . wind_dir ) ;
394395 weather . weatherType = this . convertWeatherType (
395396 h . condition . code ,
@@ -439,7 +440,7 @@ WeatherProvider.register("weatherapi", {
439440 1168 : { day : "day-sprinkle" , night : "night-sprinkle" } ,
440441 1171 : { day : "day-sprinkle" , night : "night-sprinkle" } ,
441442 1180 : { day : "day-sprinkle" , night : "night-sprinkle" } ,
442- 1183 : { day : "Light rain " , night : "Light rain " } ,
443+ 1183 : { day : "day-sprinkle " , night : "night-sprinkle " } ,
443444 1186 : { day : "day-showers" , night : "night-showers" } ,
444445 1189 : { day : "day-showers" , night : "night-showers" } ,
445446 1192 : { day : "day-showers" , night : "night-showers" } ,
0 commit comments