Accessing ecobee actions via jsr223 (jython specifically)

last edit on this…a tutorial on how to do this (since i wish there had been one hours ago):

 ecobee = oh.getAction('EcobeeAction')
 ecobee.ecobeeResumeProgram(ir.getItem("hvacMode"), True)


    ecobee = oh.getAction('EcobeeAction')
    ecobee.ecobeeSetHold(ir.getItem("hvacMode"), None, None, "away", None, None, None, None)

where hvacMode is any item that’s attached to the ecobee binding in the items list. my first problem was figuring out how to actually access the ecobee action…the first line of each code snippet is what grabs that for you. from there, you can use any of the ecobee functions, such as the two i used above.

my main mistake after figuring out how to actually get to the action itself was sending null instead of None in the function call for the missing parameters…i code in php all day so i use null all the time, and then i saw a regular rule example that also used null and didn’t think twice about it. that doesn’t work with python (jython)…you must use None instead of null. once i made that minor change, everything worked.

Cool! But be aware that I had to make a breaking change with the 1.9.0 versions of the Ecobee binding and action for OH2 compatibility. The first argument is no longer an item; it’s just a string containing your thermostat ID (or multiple separated by commas, or * for all registered thermostats, etc., like in “out” binding config strings in your .items file).

For those looking to do this now I believe the proper way is to do something like this.

from core.rules import rule
from core.triggers import when
from core.actions import EcobeeAction

@rule("DesiredHeat received command")
@when("Item desiredHeat received command")
def set_heat(event):
  ecobee = EcobeeAction
  desiredCool = ir.getItem("desiredCool").state
  if not isinstance(desiredCool, DecimalType):
    desiredCool = DecimalType(90)"Setting Hold Temperature to: {}".format(event.itemCommand))

Also make sure to restart openHAB after installing the ecobee Action or it won’t be added to core.actions. Took me awhile to figure that one out.