Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setThisTstatClimate() issues #6

Closed
SANdood opened this issue Aug 13, 2015 · 0 comments
Closed

setThisTstatClimate() issues #6

SANdood opened this issue Aug 13, 2015 · 0 comments

Comments

@SANdood
Copy link

SANdood commented Aug 13, 2015

  1. Calling myEcobeeDevice.home() will do nothing if the currently SCHEDULED climate is "Home", ditto for the other modes - it doesn't change if the requested climateName is the same as the currently scheduled Climate. This, if the Tstat is in "Home" and you call myEcobeeDevice.away() it will change the attribute "setClimate" (and thermostat) to Away, while "climateName" will remain "Home". Then when you try to set it back to Home, the check in setThisTstatClimate() will find that the requested climateName == currentValue('climateName') and return without doing anything.

  2. in the above case, a simple call to resumeProgram("") will get the thermostat to "Home" instead of overloading another Hold event. An optimization is to call resumeProgram("") BEFORE checking the provided climateName == currentValue('climateName'), thereby skipping the overhead of calling setClimate() - side benefit is that the thermostat actually returns to the desired program, instead of getting a hold. You might choose to look at the hold preference == nextTransition and use resumeProgram(), else do the setClimate() to set the Hold.

  3. Your check for exceptionCheck.contains('done') might get a false positive, since several other routines are called that each update verboseTrace with strings that include 'done'. Just to be sure, I've changed the check to be specifically for the complete string "setClimate>done"

  4. You use the reserved word "sleep" as a command. I don't believe it is possible to overload the system's "sleep()" - at least, I get errors if I try to call myEcobeeThermostat.sleep(). I changed mine to "night()", you might choose another term (asleep, or maby you can get away with "Sleep()".

My fixes to #1, #2 & #3 are:

void setThisTstatClimate(climateName) {
    def thermostatId= determine_tstat_id("")        
    def currentProgram = device.currentValue("climateName") 
    def currentProgramType = device.currentValue("programType").trim().toUpperCase()
    if (currentProgramType == 'VACATION') {
        if (settings.trace) {
            log.debug "setThisTstatClimate>thermostatId = ${settings.thermostatId},cannot do the prog switch due to vacation settings"
            sendEvent name: "verboseTrace", value:
                    "setThisTstatClimate>thermostatId = ${settings.thermostatId},cannot do the prog switch due to vacation settings"
        }
        return
    }
    else if (currentProgramType == 'HOLD') {
        resumeProgram("")                       // let's get back to normal first
        currentProgram = device.currentValue("climateName")     // get what it is NOW
        log.trace "Resuming scheduled climate: ${currentProgram}"
    }

    // If the requested climate is different from current one, then change it to the given climate
    if (currentProgram.toUpperCase() != climateName.trim().toUpperCase()) {
//      resumeProgram("")

        setClimate(thermostatId, climateName)
        def exceptionCheck=device.currentValue("verboseTrace")
        if (exceptionCheck.contains("setClimate>done")) {
            log.trace "setClimate ${climateName} done"
            sendEvent(name: 'programScheduleName', value: climateName)
            sendEvent(name: 'programNameForUI', value: climateName)
// No presence in my version (BAB)
//          if (climateName.toUpperCase().contains('AWAY')) { 
//              sendEvent(name: "presence", value: "non present")
//          } else {        
//              sendEvent(name: "presence", value: "present")
//          }
        } else {
            log.trace "setClimate ${climateName} failed: ${exceptionCheck}"
        }

//      log.trace "setThisTstatClimate> poll()"
        poll() // to refresh the values in the UI
    }
}
@yracine yracine closed this as completed Sep 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants