diff --git a/routes/adjustmentMethods/EToAdjustmentMethod.ts b/routes/adjustmentMethods/EToAdjustmentMethod.ts index d1c0fa2..f9af4fe 100644 --- a/routes/adjustmentMethods/EToAdjustmentMethod.ts +++ b/routes/adjustmentMethods/EToAdjustmentMethod.ts @@ -54,7 +54,7 @@ async function calculateEToWateringScale( return { scale: scale, rawData: { - weatherProvider: etoData.weatherProvider, + wp: etoData.weatherProvider, eto: Math.round( eto * 1000) / 1000, radiation: Math.round( etoData.solarRadiation * 100) / 100, minT: Math.round( etoData.minTemp ), diff --git a/routes/adjustmentMethods/ManualAdjustmentMethod.ts b/routes/adjustmentMethods/ManualAdjustmentMethod.ts index 701123f..f3663b7 100644 --- a/routes/adjustmentMethods/ManualAdjustmentMethod.ts +++ b/routes/adjustmentMethods/ManualAdjustmentMethod.ts @@ -8,7 +8,7 @@ async function calculateManualWateringScale( ): Promise< AdjustmentMethodRespons return { scale: undefined, rawData: { - weatherProvider: "Manual", + wp: "Manual", }, wateringData: undefined } diff --git a/routes/adjustmentMethods/ZimmermanAdjustmentMethod.ts b/routes/adjustmentMethods/ZimmermanAdjustmentMethod.ts index ccc0852..508525e 100644 --- a/routes/adjustmentMethods/ZimmermanAdjustmentMethod.ts +++ b/routes/adjustmentMethods/ZimmermanAdjustmentMethod.ts @@ -30,7 +30,7 @@ async function calculateZimmermanWateringScale( */ const rawData = { - weatherProvider: wateringData.weatherProvider, + wp: wateringData.weatherProvider, h: wateringData ? Math.round( wateringData.humidity * 100) / 100 : null, p: wateringData ? Math.round( wateringData.precip * 100 ) / 100 : null, t: wateringData ? Math.round( wateringData.temp * 10 ) / 10 : null, diff --git a/routes/weatherProviders/DarkSky.ts b/routes/weatherProviders/DarkSky.ts index f8133b7..b2e8371 100644 --- a/routes/weatherProviders/DarkSky.ts +++ b/routes/weatherProviders/DarkSky.ts @@ -60,7 +60,7 @@ export default class DarkSkyWeatherProvider extends WeatherProvider { } return { - weatherProvider: "DarkSky", + weatherProvider: "DS", temp: totals.temp / 24, humidity: totals.humidity / 24 * 100, precip: totals.precip, @@ -147,7 +147,7 @@ export default class DarkSkyWeatherProvider extends WeatherProvider { } return { - weatherProvider: "DarkSky", + weatherProvider: "DS", periodStartTime: historicData.hourly.data[ 0 ].time, minTemp: historicData.daily.data[ 0 ].temperatureMin, maxTemp: historicData.daily.data[ 0 ].temperatureMax, diff --git a/routes/weatherProviders/WUnderground.ts b/routes/weatherProviders/WUnderground.ts index be30b5d..199364b 100644 --- a/routes/weatherProviders/WUnderground.ts +++ b/routes/weatherProviders/WUnderground.ts @@ -37,7 +37,7 @@ export default class WUnderground extends WeatherProvider { } return { - weatherProvider: "WUnderground", + weatherProvider: "WU", temp: totals.temp / samples.length, humidity: totals.humidity / samples.length, precip: totals.precip, diff --git a/test/expected.json b/test/expected.json index e1752d6..aa5d5e2 100644 --- a/test/expected.json +++ b/test/expected.json @@ -3,7 +3,7 @@ "01002": { "tz": 32, "rawData": { - "weatherProvider": "Manual" + "wp": "Manual" }, "sunrise": 332, "sunset": 1203, @@ -23,7 +23,7 @@ "p": 1.09, "t": 70.8, "raining": 1, - "weatherProvider": "OWM" + "wp": "OWM" }, "errCode": 0 } diff --git a/types.ts b/types.ts index 72a480d..a026208 100644 --- a/types.ts +++ b/types.ts @@ -55,7 +55,7 @@ export interface WeatherDataForecast { export interface BaseWateringData { /** The WeatherProvider that generated this data. */ - weatherProvider: WeatherProviderId; + weatherProvider: WeatherProviderShortId; /** The total precipitation over the window (in inches). */ precip: number; } @@ -75,3 +75,4 @@ export interface ZimmermanWateringData extends BaseWateringData { } export type WeatherProviderId = "OWM" | "DarkSky" | "local" | "mock" | "WUnderground"; +export type WeatherProviderShortId = "OWM" | "DS" | "local" | "mock" | "WU";