How To Call setSchedule() In The Ecobee Suite

I installed the Ecobee Suite with HPM. My Ecobee 4 has two extra sensors and so I ended up after installation with two sensor drivers (for the two sensors) and a thermostat driver. I played with the thermostat driver (In the device section) and found out that the setSchedule("home") would enable the comfort mode called home. I then wanted to write an app in Groovy that would programmatically do what I did under the device manually:

definition(
name: "ACcontrol",
namespace: "Hubi",
author: "Hubi",
description: "AC Demo To Execute setSchedule()",
category: "Convenience",
iconUrl: "",
iconX2Url: "",
iconX3Url: "",
oauth: [displayName: "HTML Endpoint", displayLink: "https://sharptools.io"])

preferences() {
section("Sensors") {
input name: "EcobeeLivingRoom", type: "capability.sensor", title: "EcobeeLivingRoom (EcobeeSensor: Living Room (P5H6))"
input name: "EcobeeBedRoom", type: "capability.sensor", title: "EcobeeBedroom (EcobeeSensor: Bedroom (YHJV))"
input name: "EcobeeThermostat", type: "capability.thermostat", title: "EcobeeThermostat (EcobeeTherm)"
}
section("Logging") {
input name: "logEnable", type: "bool", title: "Enable logging?"
}
}

def installed() {
updated()
}

def updated() {
if (logEnable) log.debug "updated()"
unsubscribe()
subscribe(EcobeeLivingRoom, "home", EcobeeHandler)
subscribe(EcobeeBedRoom, "sensor", EcobeeHandler)

// THE NEXT LINE OF CODE CAUSES THE FOLLOWING ERROR
//Expression [MethodCallExpression] is not allowed: EcobeeThermostat.setSchedule(home) at line number 33
EcobeeThermostat.setSchedule("home")
}

def EcobeeHandler(evt) {
log.debeg "!!!!!!!!!!!!!!!!!!!!! Entered EcobeeHandler() !!!!!!!!!!!!!!!!!!!!!!!!"
}

When I installed this app I supply the correct selection for the "input". In all other apps in which I supply a method (setSchedule("home") in this case) to a device (EcobeeThermostat in this case) it will execute that method. What could I be doing wrong?

The following is a snippet from the device section:

Thanks

I changed two lines in the app from:

input name: "EcobeeThermostat", type: "capability.thermostat", title: "EcobeeThermostat (EcobeeTherm)"

EcobeeThermostat.setSchedule("home")

to:

input name: "MyEcobeeThermostat", type: "capability.thermostat", title: "EcobeeThermostat (EcobeeTherm)"

MyEcobeeThermostat.setSchedule("home")

and everything works great now. Can anyone tell me why this change made the difference? I suspect the name EcobeeThermostat is already being used some where but where?

Thanks

This might be the name of the class corresponding to the driver name. You may have been able to avoid that by using settings.settingName instead of just settingName, or following the Groovy convention of camelCase instead of TitleCase for variable names (as setting names are "elevated" to automatically) would avoid this particular collision.

1 Like