Hi folks. Once again I’m delving into writing / tweaking smartapps and I’m running into the same problems I always seem to. Specifically subscribing to events, using attributes, etc. I have worked out a few issues, but am having real problems getting certain attributes from my thermostat. Any help would be appreciated.
I need to retrieve and make decisions based upon the current heating and cooling setpoints. But here’s the log data I’m getting:
ThermostatCoolPoint = null, ThermostatSetpoint = null, ThermostatHeatPoint = null.
I have also never figured out how one posts code in a sane format, but that’s a different issue The code is extremely simple. Why am getting null responses???
/**
- HVAC Zone Equalizer
-
- Copyright 2015 Jeff Lunglhofer
-
- Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
- in compliance with the License. You may obtain a copy of the License at:
-
-
http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
- on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
- for the specific language governing permissions and limitations under the License.
-
*/
definition(
name: “HVA/C Zone Balancer”,
namespace: “everest123”,
author: “Jeff Lunglhofer”,
description: “Toggle air handler to recirculate air when two areas are not the same temperature.”,
category: “Green Living”,
// iconUrl: “”,
// iconX2Url: “”
)
preferences {
section(“Title”) {
paragraph “Use HVA/C fan to equalize between the thermostat and a second temperature sensor.”
}
section(“About”) {
paragraph “tbd”
}
section(“Thermostats”) {
input “thermostat”, “capability.thermostat”, title:“Select thermostat to be controlled”, required: true
}
section("Choose a temperature sensors… "){
input “sensor”, “capability.temperatureMeasurement”, title: “Temperature sensors to balance temperature”, required: true
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
state.fanRunning = false;
log.debug "Subscribing to events!"
subscribe(thermostat, “thermostatMode”, checkThings);
subscribe(thermostat, “thermostatFanMode”, checkThings);
subscribe(thermostat, “heatingSetpoint”, checkThings);
subscribe(thermostat, “coolingSetpoint”, checkThings);
subscribe(thermostat, “thermostatSetpoint”, checkThings);
subscribe(thermostat, “temperature”, checkThings);
subscribe(sensor, “temperature”, checkThings);
}
def start_circulate(){
DEBUG(“start_circulate()”)
// if (sensor.currentValue(“temperature”) >= runtemp)
{ DEBUG (“into start_circulate() if statement”)
thermostat.fanOn()
}
}
def checkThings(evt) {
log.debug "Event Detected!"
def thermostatTemp = settings.thermostat.currentTemperature
def sensorTemp = settings.sensor.currentTemperature
def thermostatMode = settings.thermostat.currentThermostatMode
def thermostatFanMode = settings.thermostat.currentThermostatFanMode
def thermostatHeatPoint = settings.thermostat.currentheatingSetpoint
def thermostatCoolPoint = settings.thermostat.currentcoolingSetpoint
def thermostatSetPoint = settings.thermostat.currentthermostatSetpoint
log.debug "Event Detected!"
log.debug "$evt.displayName is $evt.value"
log.debug "ThermostatTemp: $thermostatTemp, Remote Sensor: $sensorTemp, ThermostatMode: $thermostatMode"
log.debug "ThermostatFanMode = $thermostatFanMode, ThermostatHeatPoint = $thermostateHEadPoint"
log.debug "ThermostatCoolPoint = $thermostatCoolpoint, ThermostatSetpoint = $thermostatSetpoint"
}