SANdood / Ecobee-Suite

Ecobee Suite is for integrating Ecobee thermostats & sensors with the Hubitat home automation platform
109 stars 154 forks source link

setAway only holds for 2 hours?! #67

Open byoder7 opened 1 year ago

byoder7 commented 1 year ago

Hi guys,

First, thank you for offering this great software. It is a must when using something like hubitat or smartthings.

So the issue I have is that I have automation setup to call custom command "away()" when there is no presence at my house. Then, when someone is back, it will call "resumeProgram()". However, I noticed the following in the away() calls:

app:1052022-07-31 03:18:06.290 pm infosetProgram(Away) for EcobeeTherm: Downstairs (456123456) - holdType: holdHours, holdHours: 2 app:1052022-07-31 03:18:06.232 pm infosetProgram(Away) for EcobeeTherm: Upstairs (456123458) - holdType: holdHours, holdHours: 2

So, it appears that Ecobee or the EcobeeSuite is doing the away only for 2 hours? How can I change this? Ideally, I want it to be away mode until I change it, which would happen when there is presence again, and then it would resume the normal program for that time of day.

Thanks, Brian

Maksim-us commented 1 year ago

In the Ecobee Suite Manager, in "Ecobee Suite Preferences" there is a setting "Default hold type", which is probably set to 2 hours for you. Change it to "Until I change".

byoder7 commented 1 year ago

Yes, but that doesn't apply to the calls via Ecobee Suite Manager.

After looking through the code I am going to answer my own question here. I changed from setAway() to setThermostatProgram('Away', 'indefinite'). So you just select the setThermostatProgram and add two parameters. The hold type (Away, Home, ...) and then the second parameter is the 'indefinite', our could be 'holdHours' with a third parameter of the number of hours.

https://www.ecobee.com/home/developer/api/documentation/v1/functions/SetHold.shtml

Brian

Maksim-us commented 1 year ago

Interesting. I have that setting as default and don't have to specify hold type on every call. But I'm glad you figured it out.

On Mon, Aug 1, 2022 at 10:08 AM byoder7 @.***> wrote:

Yes, but that doesn't apply to the calls via Ecobee Suite Manager.

After looking through the code I am going to answer my own question here. I changed from setAway() to setThermostatProgram('Away', 'indefinite'). So you just select the setThermostatProgram and add two parameters. The hold type (Away, Home, ...) and then the second parameter is the 'indefinite', our could be 'holdHours' with a third parameter of the number of hours.

https://www.ecobee.com/home/developer/api/documentation/v1/functions/SetHold.shtml

Brian

— Reply to this email directly, view it on GitHub https://github.com/SANdood/Ecobee-Suite/issues/67#issuecomment-1201328722, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDU2Z6KPR4S3AOBDJL4LY3VW7R5XANCNFSM55H3K2XQ . You are receiving this because you commented.Message ID: @.***>

byoder7 commented 1 year ago

Here is the code in question. It looks like it just has default of 2 hours if not specified, so that would be the default used by Ecobee Suite Manager, regardless of what was set on the device. I would think a better default would be to use the setting on the Ecobee, so whatever you have there it would use as the default.

But easy enough to figure out what to do. I think things will be working perfectly for me now. Thanks for such a great product, and code that is easy to read :)

void setThermostatProgram(String program, String holdType="", Integer holdHours=2) { // N.B. if holdType is provided, it must be one of the valid parameters for the Ecobee setHold call (indefinite, nextTransition, holdHours). dateTime not currently supported refresh()

String currentThermostatHold = ST ? device.currentValue('thermostatHold') : device.currentValue('thermostatHold', true)
if (currentThermostatHold == 'vacation') {
    LOG("setThermostatProgram(${program}): program change requested but ${device.displayName} is in Vacation mode, ignoring request",2,null,'warn')
    return
}

def programsList = []
def programs = device.currentValue('programsList')
if (!programs) {
    LOG("Supported programs list not initialized, possible installation error", 1, this, 'warn')
    programsList = ["Away","Home","Sleep","Resume"]     // Just use the default list
} else {
    programsList = new JsonSlurper().parseText(programs) + ['Resume']
}

if ((program == null) || (program == "") || (!programsList.contains(program))) {
    LOG("setThermostatProgram( ${program} ): Missing or Invalid argument - must be one of (${programsList.toString()[1..-2]})", 2, this, 'warn')
    return
}

def deviceId = getDeviceId()
LOG("setThermostatProgram(${program}, ${holdType}, ${holdHours})", 4, this,'trace')

if (program == 'Resume') {
    LOG("setThermostatProgram() Resuming scheduled program", 2, this, 'info')
    resumeProgram( true )
    return
}

String sendHoldType = ""
def sendHoldHours = null
if (holdType && (holdType != "")) {
    sendHoldType = holdType
    if (holdType == 'holdHours') sendHoldHours = holdHours
} else {
    sendHoldType =  whatHoldType()
    //log.debug "sendHoldType: ${sendHoldType}"
    if ((sendHoldType != null) && sendHoldType.toString().isNumber()) {
        sendHoldHours = sendHoldType
        sendHoldType = 'holdHours'
    }
}
// refresh()        // need to know if scheduled program changed recently
byoder7 commented 1 year ago

Last update, looks like there is actually a setting in the Ecobee Suite, so you can pick your default behavior.

image