@@ -30,7 +30,8 @@ public void reinitialize(DeviceDetail aDevice, SharedDetail aShared) {
30
30
31
31
public void setTargetTemperature (Float theTemp ) {
32
32
if (theTemp < 33.0 & theTemp > 9.0 ) {
33
- HttpPost postRequest = new HttpPost (theSession .getTransport_url () + "/v2/put/shared." + deviceName );
33
+ String theUrl = theSession .getTransport_url () + "/v2/put/shared." + deviceName ;
34
+ HttpPost postRequest = new HttpPost (theUrl );
34
35
String target = null ;
35
36
if (deviceDetail .getCurrentScheduleMode ().toLowerCase () == "range" ) {
36
37
if (theTemp < sharedDetail .getTargetTemperature ())
@@ -41,33 +42,41 @@ public void setTargetTemperature(Float theTemp) {
41
42
else
42
43
target = "target_temperature" ;
43
44
StringEntity requestBody = new StringEntity ("{\" target_change_pending\" :true,\" " + target + "\" :" + String .format ("%3.1f" , theTemp )+ "}" , NestSession .parsedContentType );
45
+ log .debug ("setTargetTemperature for thermostat: " + theUrl + " with body: " + requestBody );
44
46
postRequest .setEntity (requestBody );
45
- theSession .execute (postRequest );
47
+ String theResponse = theSession .execute (postRequest );
48
+ log .debug ("setTargetTemperature response: " + theResponse );
46
49
}
47
50
else
48
- log .warn ("temperature outside of Nest paramaters of 10C to 33C derees, not setting with this paramter: " + theTemp .toString ());
51
+ log .warn ("setTargetTemperature outside of Nest paramaters of 10C to 33C derees, not setting with this paramter: " + theTemp .toString ());
49
52
}
50
53
51
54
public void setTargetType (String theType ) {
52
55
if (theType .equals ("cool" ) || theType .equals ("heat" ) || theType .equals ("range" ) || theType .equals ("off" )) {
53
- HttpPost postRequest = new HttpPost (theSession .getTransport_url () + "/v2/put/shared." + deviceName );
56
+ String theUrl = theSession .getTransport_url () + "/v2/put/shared." + deviceName ;
57
+ HttpPost postRequest = new HttpPost (theUrl );
54
58
StringEntity requestBody = new StringEntity ("{\" target_temperature_type\" :\" " + theType + "\" }" , NestSession .parsedContentType );
59
+ log .debug ("setTargetType for thermostat: " + theUrl + " with body: " + requestBody );
55
60
postRequest .setEntity (requestBody );
56
- theSession .execute (postRequest );
61
+ String theResponse = theSession .execute (postRequest );
62
+ log .debug ("setTargetType response: " + theResponse );
57
63
}
58
64
else
59
- log .warn ("target type of Nest thermostat not one of the following: hest, cool, range or off, not setting with this paramter: " + theType );
65
+ log .warn ("setTargetType of Nest thermostat not one of the following: hest, cool, range or off, not setting with this paramter: " + theType );
60
66
}
61
67
62
68
public void setFanMode (String theMode ) {
63
69
if (theMode .equals ("on" ) || theMode .equals ("auto" )) {
64
- HttpPost postRequest = new HttpPost (theSession .getTransport_url () + "/v2/put/device." + deviceName );
70
+ String theUrl = theSession .getTransport_url () + "/v2/put/device." + deviceName ;
71
+ HttpPost postRequest = new HttpPost (theUrl );
65
72
StringEntity requestBody = new StringEntity ("{\" fan_mode\" :\" " + theMode + "\" }" , NestSession .parsedContentType );
73
+ log .debug ("setFanMode for thermostat: " + theUrl + " with body: " + requestBody );
66
74
postRequest .setEntity (requestBody );
67
- theSession .execute (postRequest );
75
+ String theResponse = theSession .execute (postRequest );
76
+ log .debug ("setFanMode response: " + theResponse );
68
77
}
69
78
else
70
- log .warn ("fan mode of Nest thermostat not one of the following: auto or off, not setting with this paramter: " + theMode );
79
+ log .warn ("setFanMode of Nest thermostat not one of the following: auto or off, not setting with this paramter: " + theMode );
71
80
}
72
81
73
82
public DeviceDetail getDeviceDetail () {
0 commit comments