Add WeatherProvider ID to returned data
This commit is contained in:
@@ -19,6 +19,7 @@ async function getDarkSkyWateringData( coordinates: GeoCoordinates ): Promise< W
|
||||
}
|
||||
|
||||
return {
|
||||
weatherProvider: "DarkSky",
|
||||
// Calculate average temperature for the day using hourly data.
|
||||
temp : historicData.hourly.data.reduce( ( sum, hourlyData ) => sum + hourlyData.temperature, 0 ) / historicData.hourly.data.length,
|
||||
humidity: historicData.daily.data[ 0 ].humidity * 100,
|
||||
@@ -40,6 +41,7 @@ async function getDarkSkyWeatherData( coordinates: GeoCoordinates ): Promise< We
|
||||
}
|
||||
|
||||
const weather: WeatherData = {
|
||||
weatherProvider: "DarkSky",
|
||||
temp: Math.floor( forecast.currently.temperature ),
|
||||
humidity: Math.floor( forecast.currently.humidity * 100 ),
|
||||
wind: Math.floor( forecast.currently.windSpeed ),
|
||||
|
||||
@@ -31,6 +31,7 @@ async function getOWMWateringData( coordinates: GeoCoordinates ): Promise< Water
|
||||
}
|
||||
|
||||
return {
|
||||
weatherProvider: "OWM",
|
||||
temp: totalTemp / periods,
|
||||
humidity: totalHumidity / periods,
|
||||
precip: totalPrecip / 25.4,
|
||||
@@ -58,6 +59,7 @@ async function getOWMWeatherData( coordinates: GeoCoordinates ): Promise< Weathe
|
||||
}
|
||||
|
||||
const weather: WeatherData = {
|
||||
weatherProvider: "OWM",
|
||||
temp: parseInt( current.main.temp ),
|
||||
humidity: parseInt( current.main.humidity ),
|
||||
wind: parseInt( current.wind.speed ),
|
||||
|
||||
Reference in New Issue
Block a user