Skip to content

Commit

Permalink
Use 24 hour windows in OWM WeatherProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
Derpthemeus committed May 13, 2019
1 parent e175028 commit 0a75b3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion routes/weather.ts
Expand Up @@ -174,7 +174,8 @@ function checkWeatherRestriction( adjustmentValue: number, weather: WateringData

if ( californiaRestriction ) {

// TODO this is currently checking if the forecasted precipitation over the next 30 hours is >0.1 inches
// TODO depending on which WeatherProvider is used, this might be checking if rain is forecasted in th next 24
// hours rather than checking if it has rained in the past 48 hours.
// If the California watering restriction is in use then prevent watering
// if more then 0.1" of rain has accumulated in the past 48 hours
if ( weather.precip > 0.1 ) {
Expand Down
2 changes: 1 addition & 1 deletion routes/weatherProviders/OWM.ts
Expand Up @@ -23,7 +23,7 @@ async function getOWMWateringData( coordinates: GeoCoordinates ): Promise< Water
totalHumidity = 0,
totalPrecip = 0;

const periods = Math.min(forecast.list.length, 10);
const periods = Math.min(forecast.list.length, 8);
for ( let index = 0; index < periods; index++ ) {
totalTemp += parseFloat( forecast.list[ index ].main.temp );
totalHumidity += parseInt( forecast.list[ index ].main.humidity );
Expand Down

0 comments on commit 0a75b3d

Please sign in to comment.