Skip to content

Commit

Permalink
Return raw data used to calculate watering level
Browse files Browse the repository at this point in the history
  • Loading branch information
Derpthemeus committed May 4, 2019
1 parent 128c430 commit 746d938
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions routes/weather.js
Expand Up @@ -11,7 +11,7 @@ var http = require( "http" ),
time: /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})([+-])(\d{2})(\d{2})/,
timezone: /^()()()()()()([+-])(\d{2})(\d{2})/
};

// If location does not match GPS or PWS/ICAO, then attempt to resolve
// location using Weather Underground autocomplete API
function resolveCoordinates( location, callback ) {
Expand Down Expand Up @@ -131,7 +131,7 @@ function getOWMWeatherData( location, callback ) {
callback( weather );
} );
} );
} );
} );
}

// Calculate timezone and sun rise/set information
Expand Down Expand Up @@ -308,7 +308,8 @@ exports.getWateringData = function( req, res ) {
tz: getTimezone( weather.timezone ),
sunrise: weather.sunrise,
sunset: weather.sunset,
eip: ipToInt( remoteAddress )
eip: ipToInt( remoteAddress ),
rawData: { h: weather.humidity, p: weather.precip, t: weather.temp }
};

// Return the response to the client in the requested format
Expand All @@ -320,7 +321,8 @@ exports.getWateringData = function( req, res ) {
"&tz=" + data.tz +
"&sunrise=" + data.sunrise +
"&sunset=" + data.sunset +
"&eip=" + data.eip
"&eip=" + data.eip +
"&rawData=" + JSON.stringify( data.rawData )
);
}
};
Expand Down

0 comments on commit 746d938

Please sign in to comment.