Merge pull request #91 from OpenSprinkler/reduce-response-size

Reduce response size
This commit is contained in:
Samer Albahra
2020-03-21 18:32:11 -07:00
committed by GitHub
7 changed files with 10 additions and 9 deletions

View File

@@ -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 ),

View File

@@ -8,7 +8,7 @@ async function calculateManualWateringScale( ): Promise< AdjustmentMethodRespons
return {
scale: undefined,
rawData: {
weatherProvider: "Manual",
wp: "Manual",
},
wateringData: undefined
}

View File

@@ -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,

View File

@@ -61,7 +61,7 @@ export default class DarkSkyWeatherProvider extends WeatherProvider {
}
return {
weatherProvider: "DarkSky",
weatherProvider: "DS",
temp: totals.temp / samples.length,
humidity: totals.humidity / samples.length * 100,
precip: totals.precip,
@@ -148,7 +148,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,

View File

@@ -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,

View File

@@ -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
}

View File

@@ -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";