Register ETo AdjustmentMethod
This commit is contained in:
@@ -11,6 +11,7 @@ import { AdjustmentMethod, AdjustmentMethodResponse, AdjustmentOptions } from ".
|
|||||||
import ManualAdjustmentMethod from "./adjustmentMethods/ManualAdjustmentMethod";
|
import ManualAdjustmentMethod from "./adjustmentMethods/ManualAdjustmentMethod";
|
||||||
import ZimmermanAdjustmentMethod from "./adjustmentMethods/ZimmermanAdjustmentMethod";
|
import ZimmermanAdjustmentMethod from "./adjustmentMethods/ZimmermanAdjustmentMethod";
|
||||||
import RainDelayAdjustmentMethod from "./adjustmentMethods/RainDelayAdjustmentMethod";
|
import RainDelayAdjustmentMethod from "./adjustmentMethods/RainDelayAdjustmentMethod";
|
||||||
|
import EToAdjustmentMethod from "./adjustmentMethods/EToAdjustmentMethod";
|
||||||
const weatherProvider: WeatherProvider = new ( require("./weatherProviders/" + ( process.env.WEATHER_PROVIDER || "OWM" ) ).default )();
|
const weatherProvider: WeatherProvider = new ( require("./weatherProviders/" + ( process.env.WEATHER_PROVIDER || "OWM" ) ).default )();
|
||||||
|
|
||||||
// Define regex filters to match against location
|
// Define regex filters to match against location
|
||||||
@@ -26,7 +27,8 @@ const filters = {
|
|||||||
const ADJUSTMENT_METHOD: { [ key: number ] : AdjustmentMethod } = {
|
const ADJUSTMENT_METHOD: { [ key: number ] : AdjustmentMethod } = {
|
||||||
0: ManualAdjustmentMethod,
|
0: ManualAdjustmentMethod,
|
||||||
1: ZimmermanAdjustmentMethod,
|
1: ZimmermanAdjustmentMethod,
|
||||||
2: RainDelayAdjustmentMethod
|
2: RainDelayAdjustmentMethod,
|
||||||
|
3: EToAdjustmentMethod
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,6 +189,11 @@ export const getWateringData = async function( req: express.Request, res: expres
|
|||||||
// the string is split against a comma and the first value is selected
|
// the string is split against a comma and the first value is selected
|
||||||
remoteAddress = remoteAddress.split( "," )[ 0 ];
|
remoteAddress = remoteAddress.split( "," )[ 0 ];
|
||||||
|
|
||||||
|
if ( !adjustmentMethod ) {
|
||||||
|
res.send( "Error: Unknown AdjustmentMethod ID" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Parse weather adjustment options
|
// Parse weather adjustment options
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user