Merge pull request #43 from OpenSprinkler/disable-rawdata-when-not-used

Hide raw data when not used
This commit is contained in:
Samer Albahra
2019-05-23 11:32:50 -05:00
committed by GitHub
2 changed files with 8 additions and 11 deletions

View File

@@ -312,14 +312,17 @@ export const getWateringData = async function( req: express.Request, res: expres
sunrise: timeData.sunrise,
sunset: timeData.sunset,
eip: ipToInt( remoteAddress ),
// TODO this may need to be changed (https://github.com/OpenSprinkler/OpenSprinkler-Weather/pull/11#issuecomment-491037948)
rawData: {
rawData: undefined
};
if ( adjustmentMethod > 0 ) {
data.rawData = {
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,
raining: wateringData ? ( wateringData.raining ? 1 : 0 ) : null
}
};
}
if ( local.useLocalWeather() ) {
console.log( "OpenSprinkler Weather Response: %s", JSON.stringify( data ) );
@@ -335,7 +338,7 @@ export const getWateringData = async function( req: express.Request, res: expres
"&sunrise=" + data.sunrise +
"&sunset=" + data.sunset +
"&eip=" + data.eip +
"&rawData=" + JSON.stringify( data.rawData )
( adjustmentMethod > 0 ? "&rawData=" + JSON.stringify( data.rawData ) : "" )
);
}

View File

@@ -6,13 +6,7 @@
"tz": 32,
"sunrise": 332,
"sunset": 1203,
"eip": 2130706433,
"rawData": {
"h": 98.5,
"p": 1.09,
"t": 70.8,
"raining": 1
}
"eip": 2130706433
}
},
"adjustment1": {