Newbie help: thermostatFanMode isn't changing fan mode


#1

Hi folks,

I’m not an experienced coder, but I have been successful working my way through simple Smartapps. Now I’m stuck and could use a little expert help. My thermo is the Honeywell ZW1007.

I’m using the “Extravagent Thermostat Control” app as my base code, and I want to add fan control to what the app does today. So far I’ve added/modified:

section("To this Fan setting") {
	input "fanSetpoint", "enum", title: "Which setting?", multiple:false, 
    metadata:[values:['fanOn','fanAuto','fanCirculate']]
}

and this to the sections def updated() and def initialize():

subscribe(thermostat, "thermostatFanMode", thermostatFanModeHandler)

and this to the section that sets temps:

    thermostat.setThermostatFanMode(fanSetpoint)

When the app executes, all looks well in the log, except that no matter what value I pass to set the fan mode, it never ever changes. Temp set points work great, but nada on the fan mode:

9:03:43 PM: debug End of thermostat setting SmartApp
9:03:43 PM: debug Schedule Basic Thermostat Settings has changed the heat to ‘66’ and cooling to ‘75’ and fan to 'fanCirculate’
9:03:43 PM: debug sending push message
9:03:42 PM: debug Initiating thermostat changes…
9:03:42 PM: debug setTheTemp, location.mode = Home, newMode = null, location.modes = [Home, Night, Away, Vacation]
9:03:42 PM: debug SET DOW: All Week
9:03:42 PM: debug Calendar DOW: 5
9:03:19 PM: trace Scheduling ‘setTheTemp’ for InstalledSmartApp: eac19b36-f148-4bea-9ec8-974f3c92f523
9:03:19 PM: debug Scheduling Temp change for day All Week at time 2014-09-03T21:05:00.000-0400
9:03:19 PM: trace thermostatFanMode from 2nd Floor Thermostat was provided with thermostatFanModeHandler…creating subscription
9:03:19 PM: trace temperature from 2nd Floor Thermostat was provided with temperatureHandler…creating subscription
9:03:19 PM: trace coolingSetpoint from 2nd Floor Thermostat was provided with coolingSetpointHandler…creating subscription
9:03:19 PM: trace heatingSetpoint from 2nd Floor Thermostat was provided with heatingSetpointHandler…creating subscription

I tried looking through @wackware 's code for the “better thermo” device type to understand how to set fan mode properly, but that didn’t help me much.

Does anyone have any experience with what I’m trying to do? Is there something else I should be adding to set the fan mode? Any help would be greatly appreciated, thanks!


[RELEASE] Unlimited customizable thermostat
(Tim Slagle) #2
 thermostat.setThermostatFanMode("${fanSetpoint}")

Try this. Its not writing the command properly, i still get confussled sometimes when it comes to thermostat commands. I think this should work though.


#3

Thanks Tim, your help is appreciated. I made the recommended change, but the fan mode change still won’t take. I ran this through the IDE simulation, as well as installing/configuring/executing my app via the ST phone app.

    thermostat.setThermostatFanMode("${fanSetpoint}")

1:51:04 PM: debug End of thermostat setting SmartApp
1:51:04 PM: debug Schedule Basic Thermostat Settings has changed the heat to ‘68’ and cooling to ‘75’ and fan to 'fanCirculate’
1:51:04 PM: debug sending push message
1:51:03 PM: debug Initiating thermostat changes…
1:51:03 PM: debug setTheTemp, location.mode = Home, newMode = null, location.modes = [Home, Night, Away, Vacation]
1:51:03 PM: debug SET DOW: All Week
1:51:03 PM: debug Calendar DOW: 5
1:50:24 PM: debug currentTemperature: physicalgraph.app.EventWrapper@6474d1aa, [thermostat:[2nd Floor Thermostat], heatingSetpoint:68, coolingSetpoint:75, fanSetpoint:fanCirculate, dayOfWeek:All Week, time:2014-09-04T13:51:00.000-0400]

temperature: 71.0 F
heatingSetpoint: 68.0 F
coolingSetpoint: 75.0 F
thermostatSetpoint: 75.0 F
thermostatMode: cool
thermostatFanMode: fanAuto
thermostatOperatingState: idle


(Tim Slagle) #4

Can you share all your code? I’d like to take a look.


#5

Sure, but give me a little bit of time. On the road at the moment, but I’ll post it here in a few hours. Thanks Tim.


#6

Here you go:

/**

  • Extravagent Thermostat setting
  • Allows you to set your thermostat to different temp during
    
  • different days of the week
    
  • Author: Samer Theodossy, changes : jscgs350
    */

// Automatically generated. Make future change here.
definition(
name: “Schedule Basic Thermostat Settings”,
namespace: “jscgs350”,
author: “jscgs350”,
description: “Set my basic thermo settings, like heat/cool temp and fan, to a schedule”,
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
section(“Set these thermostats”) {
input “thermostat”, “capability.thermostat”, title: “Which?”, multiple:true
}

section("To these temperatures") {
  input "heatingSetpoint", "number", title: "When Heating"
  input "coolingSetpoint", "number", title: "When Cooling"

}

section("To this Fan setting") {
  input "fanSetpoint", "enum", title: "Which setting?", multiple:false, 
    metadata:[values:['fanOn','fanAuto','fanCirculate']]

}

section("Configuration") {
	input "dayOfWeek", "enum",
                    title: "Which day of the week?",
                    multiple: false,
                    metadata: [
                values: [
                'All Week',
                'Monday to Friday',
                'Saturday & Sunday',
                'Monday',
                'Tuesday',
                'Wednesday',
                'Thursday',
                'Friday',
                'Saturday',
                'Sunday'
            ]
                    ]
	input "time", "time", title: "At this time"
    //input "newMode", "mode", title: "Change to this mode"
}
section( "Notifications" ) {
	input "sendPushMessage", "enum", title: "Send a push notification?", metadata:[values:["Yes", "No"]], required: false
    input "phoneNumber", "phone", title: "Send a text message?", required: false
}

}

def installed() {
// subscribe to these events
subscribe(thermostat, “heatingSetpoint”, heatingSetpointHandler)
subscribe(thermostat, “coolingSetpoint”, coolingSetpointHandler)
subscribe(thermostat, “temperature”, temperatureHandler)
subscribe(thermostat, “thermostatFanMode”, thermostatFanModeHandler)
initialize()
}

def updated() {
// we have had an update
// remove everything and reinstall
unschedule()
subscribe(thermostat, “heatingSetpoint”, heatingSetpointHandler)
subscribe(thermostat, “coolingSetpoint”, coolingSetpointHandler)
subscribe(thermostat, “temperature”, temperatureHandler)
subscribe(thermostat, “thermostatFanMode”, thermostatFanModeHandler)
initialize()
}

def initialize() {

    log.debug "Scheduling Temp change for day " + dayOfWeek + " at time " + time
    schedule(time, setTheTemp)

}

def heatingSetpointHandler(evt)
{
log.debug “heatingSetpoint: $evt, $settings”
}

def coolingSetpointHandler(evt)
{
log.debug “coolingSetpoint: $evt, $settings”
}

def temperatureHandler(evt)
{
log.debug “currentTemperature: $evt, $settings”
}

def thermostatFanModeHandler(evt)
{
log.debug “thermostatFanMode: $evt, $settings”
}

def setTheTemp() {

def doChange = false
Calendar localCalendar = Calendar.getInstance(TimeZone.getDefault());
int currentDayOfWeek = localCalendar.get(Calendar.DAY_OF_WEEK);
// Check the condition under which we want this to run now
// This set allows the most flexibility.
if(dayOfWeek == 'All Week'){
        doChange = true
}
else if((dayOfWeek == 'Monday' || dayOfWeek == 'Monday to Friday') && currentDayOfWeek == Calendar.instance.MONDAY){
        doChange = true
}
else if((dayOfWeek == 'Tuesday' || dayOfWeek == 'Monday to Friday') && currentDayOfWeek == Calendar.instance.TUESDAY){
        doChange = true
}
else if((dayOfWeek == 'Wednesday' || dayOfWeek == 'Monday to Friday') && currentDayOfWeek == Calendar.instance.WEDNESDAY){
        doChange = true
}
else if((dayOfWeek == 'Thursday' || dayOfWeek == 'Monday to Friday') && currentDayOfWeek == Calendar.instance.THURSDAY){
        doChange = true
}
else if((dayOfWeek == 'Friday' || dayOfWeek == 'Monday to Friday') && currentDayOfWeek == Calendar.instance.FRIDAY){
        doChange = true
}
else if((dayOfWeek == 'Saturday' || dayOfWeek == 'Saturday & Sunday') && currentDayOfWeek == Calendar.instance.SATURDAY){
        doChange = true
}
else if((dayOfWeek == 'Sunday' || dayOfWeek == 'Saturday & Sunday') && currentDayOfWeek == Calendar.instance.SUNDAY){
        doChange = true
}
// some debugging in order to make sure things are working correclty
log.debug "Calendar DOW: " + currentDayOfWeek
log.debug "SET DOW: " + dayOfWeek
// If we have hit the condition to schedule this then lets do it
if(doChange == true){
    log.debug "setTheTemp, location.mode = $location.mode, newMode = $newMode, location.modes = $location.modes"
    log.debug " Initiating thermostat changes..."
   	thermostat.setHeatingSetpoint(heatingSetpoint)
  thermostat.setCoolingSetpoint(coolingSetpoint)
    thermostat.setThermostatFanMode("${fanSetpoint}")
    thermostat.poll()
    send "${label} has changed the heat to '${heatingSetpoint}' and cooling to '${coolingSetpoint}' and fan to '${fanSetpoint}'"
}
else {
        log.debug "Temp/Fan change not scheduled for today."
}
log.debug "End of thermostat setting SmartApp"

}

private send(msg) {
if ( sendPushMessage != “Yes” ) {
log.debug( “sending push message” )
sendPush( msg )
}

    if ( phoneNumber ) {
            log.debug( "sending text message" )
            sendSms( phoneNumber, msg )
    }
    log.debug msg

}

private getLabel() {
app.label ?: “jscgs350”
}

// catchall
def event(evt)
{
log.debug “value: $evt.value, event: $evt, settings: $settings, handlerName: ${evt.handlerName}”
}


(Tim Slagle) #7

yeah remove the chagnes me made earlier, but… im not seeing anything that would keep it from working. I’ll see if it can do some testing for you tonight/this weekend.


#8

Thank you so much, and no worries and no rush. I didn’t realize the code displayed so odd in my post, sorry about that.


(NotoiousBDG) #9

Supported fan modes are on, auto, and circulate, not fanOn, fanAuto, and fanCirculate. Check https://graph.api.smartthings.com/ide/doc/capabilities for more details.


#10

@notoriousbdg Yep, already have it coded correctly I believe, plus I tried those other values as well. Additionally, the device reports back what it should be:


[RELEASE] Unlimited customizable thermostat
#11

@notoriousbdg and @RBoy Thanks for the help you guys gave me. Notoiousbdg, you were 100% right, thank you for pointing me to the documentation. I thought I tried those values, but I guess not. Even though the device returned what I would have though the values should be (and also from looking at Twack’s custom device type), what you sent worked perfectly. Thanks!

RB, thanks as well for taking the time to reply to my other post. I also made the changes recommended by you. Thanks!


(NotoiousBDG) #12

No problem. I’m glad you got it working.