Improve PWS support
The previous implementation would have required a firmware update
This commit is contained in:
@@ -56,4 +56,7 @@ export interface AdjustmentMethodResponse {
|
|||||||
wateringData: BaseWateringData;
|
wateringData: BaseWateringData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdjustmentOptions {}
|
export interface AdjustmentOptions {
|
||||||
|
/** Information about the PWS to use in the format "pws:API_KEY@PWS_ID". */
|
||||||
|
pws?: string;
|
||||||
|
}
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ export const getWateringData = async function( req: express.Request, res: expres
|
|||||||
location: string | GeoCoordinates = getParameter(req.query.loc),
|
location: string | GeoCoordinates = getParameter(req.query.loc),
|
||||||
outputFormat: string = getParameter(req.query.format),
|
outputFormat: string = getParameter(req.query.format),
|
||||||
remoteAddress: string = getParameter(req.headers[ "x-forwarded-for" ]) || req.connection.remoteAddress,
|
remoteAddress: string = getParameter(req.headers[ "x-forwarded-for" ]) || req.connection.remoteAddress,
|
||||||
pwsString: string = getParameter( req.query.pws ),
|
|
||||||
adjustmentOptions: AdjustmentOptions;
|
adjustmentOptions: AdjustmentOptions;
|
||||||
|
|
||||||
// X-Forwarded-For header may contain more than one IP address and therefore
|
// 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 );
|
let timeData: TimeData = getTimeData( coordinates );
|
||||||
|
|
||||||
// Parse the PWS information.
|
// Parse the PWS information.
|
||||||
|
const pwsString: string | undefined = adjustmentOptions.pws;
|
||||||
let pws: PWS | undefined = undefined;
|
let pws: PWS | undefined = undefined;
|
||||||
if ( pwsString ) {
|
if ( pwsString ) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user