Merge pull request #91 from OpenSprinkler/reduce-response-size
Reduce response size
This commit is contained in:
@@ -54,7 +54,7 @@ async function calculateEToWateringScale(
|
|||||||
return {
|
return {
|
||||||
scale: scale,
|
scale: scale,
|
||||||
rawData: {
|
rawData: {
|
||||||
weatherProvider: etoData.weatherProvider,
|
wp: etoData.weatherProvider,
|
||||||
eto: Math.round( eto * 1000) / 1000,
|
eto: Math.round( eto * 1000) / 1000,
|
||||||
radiation: Math.round( etoData.solarRadiation * 100) / 100,
|
radiation: Math.round( etoData.solarRadiation * 100) / 100,
|
||||||
minT: Math.round( etoData.minTemp ),
|
minT: Math.round( etoData.minTemp ),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ async function calculateManualWateringScale( ): Promise< AdjustmentMethodRespons
|
|||||||
return {
|
return {
|
||||||
scale: undefined,
|
scale: undefined,
|
||||||
rawData: {
|
rawData: {
|
||||||
weatherProvider: "Manual",
|
wp: "Manual",
|
||||||
},
|
},
|
||||||
wateringData: undefined
|
wateringData: undefined
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ async function calculateZimmermanWateringScale(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const rawData = {
|
const rawData = {
|
||||||
weatherProvider: wateringData.weatherProvider,
|
wp: wateringData.weatherProvider,
|
||||||
h: wateringData ? Math.round( wateringData.humidity * 100) / 100 : null,
|
h: wateringData ? Math.round( wateringData.humidity * 100) / 100 : null,
|
||||||
p: wateringData ? Math.round( wateringData.precip * 100 ) / 100 : null,
|
p: wateringData ? Math.round( wateringData.precip * 100 ) / 100 : null,
|
||||||
t: wateringData ? Math.round( wateringData.temp * 10 ) / 10 : null,
|
t: wateringData ? Math.round( wateringData.temp * 10 ) / 10 : null,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export default class DarkSkyWeatherProvider extends WeatherProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
weatherProvider: "DarkSky",
|
weatherProvider: "DS",
|
||||||
temp: totals.temp / samples.length,
|
temp: totals.temp / samples.length,
|
||||||
humidity: totals.humidity / samples.length * 100,
|
humidity: totals.humidity / samples.length * 100,
|
||||||
precip: totals.precip,
|
precip: totals.precip,
|
||||||
@@ -148,7 +148,7 @@ export default class DarkSkyWeatherProvider extends WeatherProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
weatherProvider: "DarkSky",
|
weatherProvider: "DS",
|
||||||
periodStartTime: historicData.hourly.data[ 0 ].time,
|
periodStartTime: historicData.hourly.data[ 0 ].time,
|
||||||
minTemp: historicData.daily.data[ 0 ].temperatureMin,
|
minTemp: historicData.daily.data[ 0 ].temperatureMin,
|
||||||
maxTemp: historicData.daily.data[ 0 ].temperatureMax,
|
maxTemp: historicData.daily.data[ 0 ].temperatureMax,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default class WUnderground extends WeatherProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
weatherProvider: "WUnderground",
|
weatherProvider: "WU",
|
||||||
temp: totals.temp / samples.length,
|
temp: totals.temp / samples.length,
|
||||||
humidity: totals.humidity / samples.length,
|
humidity: totals.humidity / samples.length,
|
||||||
precip: totals.precip,
|
precip: totals.precip,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"01002": {
|
"01002": {
|
||||||
"tz": 32,
|
"tz": 32,
|
||||||
"rawData": {
|
"rawData": {
|
||||||
"weatherProvider": "Manual"
|
"wp": "Manual"
|
||||||
},
|
},
|
||||||
"sunrise": 332,
|
"sunrise": 332,
|
||||||
"sunset": 1203,
|
"sunset": 1203,
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"p": 1.09,
|
"p": 1.09,
|
||||||
"t": 70.8,
|
"t": 70.8,
|
||||||
"raining": 1,
|
"raining": 1,
|
||||||
"weatherProvider": "OWM"
|
"wp": "OWM"
|
||||||
},
|
},
|
||||||
"errCode": 0
|
"errCode": 0
|
||||||
}
|
}
|
||||||
|
|||||||
3
types.ts
3
types.ts
@@ -55,7 +55,7 @@ export interface WeatherDataForecast {
|
|||||||
|
|
||||||
export interface BaseWateringData {
|
export interface BaseWateringData {
|
||||||
/** The WeatherProvider that generated this data. */
|
/** The WeatherProvider that generated this data. */
|
||||||
weatherProvider: WeatherProviderId;
|
weatherProvider: WeatherProviderShortId;
|
||||||
/** The total precipitation over the window (in inches). */
|
/** The total precipitation over the window (in inches). */
|
||||||
precip: number;
|
precip: number;
|
||||||
}
|
}
|
||||||
@@ -75,3 +75,4 @@ export interface ZimmermanWateringData extends BaseWateringData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type WeatherProviderId = "OWM" | "DarkSky" | "local" | "mock" | "WUnderground";
|
export type WeatherProviderId = "OWM" | "DarkSky" | "local" | "mock" | "WUnderground";
|
||||||
|
export type WeatherProviderShortId = "OWM" | "DS" | "local" | "mock" | "WU";
|
||||||
|
|||||||
Reference in New Issue
Block a user