Merge pull request #19 from Derpthemeus/return-raw-data
Return raw data used to calculate watering level
This commit is contained in:
@@ -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})/,
|
time: /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})([+-])(\d{2})(\d{2})/,
|
||||||
timezone: /^()()()()()()([+-])(\d{2})(\d{2})/
|
timezone: /^()()()()()()([+-])(\d{2})(\d{2})/
|
||||||
};
|
};
|
||||||
|
|
||||||
// If location does not match GPS or PWS/ICAO, then attempt to resolve
|
// If location does not match GPS or PWS/ICAO, then attempt to resolve
|
||||||
// location using Weather Underground autocomplete API
|
// location using Weather Underground autocomplete API
|
||||||
function resolveCoordinates( location, callback ) {
|
function resolveCoordinates( location, callback ) {
|
||||||
@@ -131,7 +131,7 @@ function getOWMWeatherData( location, callback ) {
|
|||||||
callback( weather );
|
callback( weather );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate timezone and sun rise/set information
|
// Calculate timezone and sun rise/set information
|
||||||
@@ -308,7 +308,8 @@ exports.getWateringData = function( req, res ) {
|
|||||||
tz: getTimezone( weather.timezone ),
|
tz: getTimezone( weather.timezone ),
|
||||||
sunrise: weather.sunrise,
|
sunrise: weather.sunrise,
|
||||||
sunset: weather.sunset,
|
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
|
// Return the response to the client in the requested format
|
||||||
@@ -320,7 +321,8 @@ exports.getWateringData = function( req, res ) {
|
|||||||
"&tz=" + data.tz +
|
"&tz=" + data.tz +
|
||||||
"&sunrise=" + data.sunrise +
|
"&sunrise=" + data.sunrise +
|
||||||
"&sunset=" + data.sunset +
|
"&sunset=" + data.sunset +
|
||||||
"&eip=" + data.eip
|
"&eip=" + data.eip +
|
||||||
|
"&rawData=" + JSON.stringify( data.rawData )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user