diff --git a/README.md b/README.md index ba0ed10..0d6086d 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ You should see "OpenSprinkler Weather Service" in response. You can use the following request to see the watering level that the Weather Service calculates. Note: to be consistent, change the values of h, t and r to the % weightings and bh (as a %), bt (in F), bp (in inches) to the offsets from the Zimmerman config page in App. ``` -http://:3000/weather1.py?loc=50,1&wto="\"h\":100,\"t\":100,\"r\":100,\"bh\":70,\"bt\":59,\"br\":0" +http://:3000/weather1.py?loc=50,1&wto="h":100,"t":100,"r":100,"bh":70,"bt":59,"br":0 ``` This will return a response similar to below with ```scale``` value equating to the watering level and ```rawData``` reflecting the temp (F), humidity (%) and daily rainfall (inches) used in the zimmerman calc. diff --git a/routes/weather.ts b/routes/weather.ts index 58473f6..aa1f7e1 100644 --- a/routes/weather.ts +++ b/routes/weather.ts @@ -242,8 +242,9 @@ export const getWateringData = async function( req: express.Request, res: expres adjustmentOptions = JSON.parse( "{" + adjustmentOptionsString + "}" ); } catch ( err ) { - // If the JSON is not valid, do not incorporate weather adjustment options - adjustmentOptions = undefined; + // If the JSON is not valid then abort the claculation + res.send(`Error: Unable to parse options (${err})`); + return; } // Attempt to resolve provided location to GPS coordinates.