Super simple but something is off


(Doug) #1

ok so super simple app, when sensor A is open turn off the thermostat and turn on the fan, that part is working just fine. The issue is the eventhandler for closing the sensor. It doesn’t turn the thermostat back on or set the fan to auto and I don’t know why. I’ve got to be missing the syntax of the command but I don’t see it. the very small code block is as follows from the preferences block, any input would be apprecieated, actual thermostat is Honeywell lyric v2(maybe there is an issue there?):

preferences {
section(“Select Window Sensor”) {
input “windowsensor”,“capability.contactSensor”, required: true, title:“Select Sensor”
section("Choose thermostat… ") {
input “thermostat”, “capability.thermostat”, required: true, title:“Select Thermostat”


def installed() {
log.debug "Installed with settings: ${settings}"

def updated() {
log.debug "Installed with settings: ${settings}"
def subscribeToEvents() {
subscribe(windowsensor, “”, openHandler)
subscribe(windowsensor, “contact.closed”, closeHandler)

def openHandler(evt) {
log.debug "openHandler called: $evt"

def closeHandler(evt) {
log.debug "closeHandler called: $evt"

(Mike Maxwell) #2

When the contact closes are you getting your debug output?
As a test, subscribe to your thermostat, set it to auto manually, make sure auto and auto fan are actually supported.

(Realy Living Dream) #3

Unless you are just doing this to practice writing you own app, there is already an app in Marketplace " Thermostat mode director" that will turn off your HVAC if any door or window is open.

(Doug) #4

CThat particular app doesn’t turn the fan on for air movement, which is actually working already. The thermostat supports auto,heat,cool,off,fan auto,fan circulate, and fan off. So this should work right?
Yes I see the debug msg, so the event handler is triggered, I’m just not 100% sure that is the correct usage.

(Doug) #5

Slightly interesting update, while the AP supports turning on to auto mode, and the thermostat and the manufacturers app support turning on in auto mode, the device handler does not at this moment. I’ve contacted manufacturer support to begin to see who to point this out to to get it added to the device handler, since they are a partner I figured Honeywell would be the first step.