I am writing a Heating and AC app and want the app to auto switch from heating to cooling based on max an min temperature from the web. I can get the data from the web but am unable to compare the data from the web to values set by my app. the part of the code that is important is below. I think it is a class issue does anyone know how to show the class of a variable?
//Heating Cooling switch point Min
section("Select the outside temperature threshold minimum to switch between Heating and Cooling") {
input "tempSwitchMin", "decimal", title: "Temp Min Heating"
}
//Heating Cooling switch point Max
section("Select the outside temperature threshold maximum to switch between Heating and Cooling") {
input "tempSwitchMax", "decimal", title: "Temp Max Heating"
}
private setTemp() {
//Check summer winter
//This code checks the current weather including the high and low then sets cooling or heating
def pollParams = [
uri: "http://api.openweathermap.org",
path: "/data/2.5/find",
headers: ["Content-Type": "text/json", "Authorization": "Bearer ${atomicState.authToken}"],
query: [q: "West+Jordan+UT", units: "imperial"]
]
try{
httpGet(pollParams) { resp ->
if (resp.data) {
log.debug "The Response had data - ${resp.data}"
log.debug "Status - ${resp.status}"
log.debug "Min Temp - ${resp.data.list.main.temp_min}"
def tempMin = resp.data.list.main.temp_min
log.debug "tempMin = $tempMin"
log.debug "Max Temp - ${resp.data.list.main.temp_max}"
def tempMax = resp.data.list.main.temp_max
log.debug "tempMax = $tempMax"
log.debug "Current Temp - ${resp.data.list.main.temp}"
log.debug "$tempSwitchMin - $tempSwitchMax"
if (tempMin <= $tempSwitchMin && tempMax <= $tempSwitchMax) {
log.debug "setting thermostat to heat mode"
thermostat.setThermostatMode("heat")
} else {
log.debug "setting thermostat to cool mode"
thermostat.setThermostatMode("cool")
}
}
if(resp.status == 200) {
log.debug "The Response status was 200"
log.debug "poll results returned"
}
else {
log.debug "The Response status was not 200"
log.error "polling children & got http status ${resp.status}"
}
}
} catch(Exception e) {
}
}