Improve PWS support

The previous implementation would have required a firmware update
This commit is contained in:
Matthew Oslan
2019-07-05 22:47:07 -04:00
parent 94681e9f03
commit 7ea1824048
2 changed files with 5 additions and 2 deletions

View File

@@ -56,4 +56,7 @@ export interface AdjustmentMethodResponse {
wateringData: BaseWateringData;
}
export interface AdjustmentOptions {}
export interface AdjustmentOptions {
/** Information about the PWS to use in the format "pws:API_KEY@PWS_ID". */
pws?: string;
}

View File

@@ -185,7 +185,6 @@ export const getWateringData = async function( req: express.Request, res: expres
location: string | GeoCoordinates = getParameter(req.query.loc),
outputFormat: string = getParameter(req.query.format),
remoteAddress: string = getParameter(req.headers[ "x-forwarded-for" ]) || req.connection.remoteAddress,
pwsString: string = getParameter( req.query.pws ),
adjustmentOptions: AdjustmentOptions;
// X-Forwarded-For header may contain more than one IP address and therefore
@@ -219,6 +218,7 @@ export const getWateringData = async function( req: express.Request, res: expres
let timeData: TimeData = getTimeData( coordinates );
// Parse the PWS information.
const pwsString: string | undefined = adjustmentOptions.pws;
let pws: PWS | undefined = undefined;
if ( pwsString ) {
try {