Skip to content

Commit d36e054

Browse files
committed
Fixed Inside Temp Logging Bug
The inside temp wasn't being logged unless there was a full degree jump since the last time it checked. This has been corrected now.
1 parent c9d8354 commit d36e054

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

com.androidthermostat.server/src/com/androidthermostat/server/data/Conditions.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public class Conditions {
3333

3434
private Bitmap weatherImage = null;
3535
public int insideTempRaw=0;
36+
public double lastLoggedInsideTemp = 0;
37+
38+
3639
public String debugMessage = "";
3740

3841
private Context context;
@@ -124,7 +127,6 @@ public void updateWeather()
124127
//this.weatherImageUrl = resp.img;
125128
//this.weatherImage = BitmapFactory.decodeStream((InputStream)new URL(weatherImageUrl).getContent());
126129
//this.weatherForecastUrl = "http://www.weather.com/weather/right-now/" + Settings.getCurrent().getZipCode();
127-
128130
}
129131

130132
if (previousTemp!=Conditions.getCurrent().getOutsideTemperature() && success)
@@ -147,7 +149,7 @@ public void updateArduino()
147149
Settings s = Settings.getCurrent();
148150
FurnaceController fc = FurnaceController.getCurrent();
149151

150-
double previousTemp = Conditions.getCurrent().insideTemperature;
152+
//double previousTemp = Conditions.getCurrent().insideTemperature;
151153
double temp = fc.getTemperature();
152154

153155
int effectiveHigh = s.getTargetHigh();
@@ -177,8 +179,9 @@ public void updateArduino()
177179
if (s.getMode().equals("Off")) fc.setMode("Off");
178180

179181
//Make sure there's a full 1 degree difference in temperature so it isn't too chatty.
180-
if (previousTemp - temp > 1 || previousTemp - temp < -1)
182+
if (lastLoggedInsideTemp - temp > 1 || lastLoggedInsideTemp - temp < -1)
181183
{
184+
lastLoggedInsideTemp = temp;
182185
try {
183186
if (s.getPingOutUrl()!=null && s.getPingOutUrl()!="" && s.getInsideTempChangeParams()!=null && s.getInsideTempChangeParams()!="") Utils.pingOut(s.getPingOutUrl() + s.getInsideTempChangeParams());
184187
} catch (Exception e) {

com.androidthermostat.server/src/com/androidthermostat/server/utils/Utils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ public static void pingOut(String url)
125125
try {
126126
if (url.contains("[outsideTemp]")) url = url.replace("[outsideTemp]", String.valueOf(Conditions.getCurrent().getOutsideTemperature()) );
127127
if (url.contains("[insideTemp]")) url = url.replace("[insideTemp]", String.valueOf(Conditions.getCurrent().getInsideTemperature()) );
128-
128+
129+
Utils.logInfo("Pinging - " + url, "data.Utils.pingOut");
129130
Utils.getUrlContents(url);
130131
} catch (Exception e) {
131-
Utils.debugText="Utils.pingout - " + e.toString();
132+
Utils.logError(e.toString(), "data.Utils.pingOut");
132133
}
133134
}
134135

-25 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)