Problem with Ecobee Rule Throwing Null Error - Openhab 3.1

I have the following Ecobee rule that is failing (Openhab 3.1, Synology DSM 6.2)

rule "CoolHoldDwn"
        when
        Item DwnDesCool received command
        then
        logInfo("CoolHoldDwn", "Setting cool setpoint to " + receivedCommand.toString)
val EcobeedActions = getActions("ecobee","ecobee:thermostat:XXXX:YYYY")
Thread::sleep(1000)
        val DwnDesCoolTemp = new QuantityType<Temperature>(receivedCommand.toString+" °F")
        var QuantityType<Temperature> DwnDesHeatTemp
        if (DwnDesHeat.state instanceof DecimalType) {
        DwnDesHeatTemp = DwnDesHeat.state.toString+" °F"
        } else {
        DwnDesHeatTemp = new QuantityType<Temperature>("50 °F")
}
logInfo("CoolHoldDwn", "DwnDesCoolTemp = " + DwnDesCoolTemp)
logInfo("HeatHoldDwn", "DwnDesHeatTemp = " + DwnDesHeatTemp)
EcobeedActions.setHold(DwnDesCoolTemp, DwnDesHeatTemp, null, null, null, "nextTransition", null)
end

When I do this I get the following error in the log:

2021-07-14 22:53:25.789 [INFO ] [penhab.core.model.script.CoolHoldDwn] - Setting cool setpoint to 76.0
2021-07-14 22:53:26.792 [INFO ] [penhab.core.model.script.CoolHoldDwn] - DwnDesCoolTemp = 76 °F
2021-07-14 22:53:26.793 [INFO ] [penhab.core.model.script.HeatHoldDwn] - DwnDesHeatTemp = 50 °F
2021-07-14 22:53:26.794 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'demo-45' failed: An error occurred during the script execution: Could not invoke method: org.openhab.binding.ecobee.internal.action.EcobeeActions.setHold(org.openhab.core.thing.binding.ThingActions,org.openhab.core.library.types.QuantityType,org.openhab.core.library.types.QuantityType,java.lang.String,java.util.Date,java.util.Date,java.lang.String,java.lang.Number) on instance: null in demo

If instead I take the line “DwnDesHeatTemp = new QuantityType(“50 °F”)” and duplicate it immediately after the else conditional as in:

rule "CoolHoldDwn"
        when
        Item DwnDesCool received command
        then
        logInfo("CoolHoldDwn", "Setting cool setpoint to " + receivedCommand.toString)
val EcobeedActions = getActions("ecobee","ecobee:thermostat:XXX:YYYY")
Thread::sleep(1000)
        val DwnDesCoolTemp = new QuantityType<Temperature>(receivedCommand.toString+" °F")
        var QuantityType<Temperature> DwnDesHeatTemp
        if (DwnDesHeat.state instanceof DecimalType) {
        DwnDesHeatTemp = DwnDesHeat.state.toString+" °F"
        } else {
        DwnDesHeatTemp = new QuantityType<Temperature>("50 °F")
}
        DwnDesHeatTemp = new QuantityType<Temperature>("50 °F")
logInfo("CoolHoldDwn", "DwnDesCoolTemp = " + DwnDesCoolTemp)
logInfo("HeatHoldDwn", "DwnDesHeatTemp = " + DwnDesHeatTemp)
EcobeedActions.setHold(DwnDesCoolTemp, DwnDesHeatTemp, null, null, null, "nextTransition", null)
end

The rule works.

2021-07-14 22:52:25.290 [INFO ] [penhab.core.model.script.CoolHoldDwn] - Setting cool setpoint to 77.0
2021-07-14 22:52:26.292 [INFO ] [penhab.core.model.script.CoolHoldDwn] - DwnDesCoolTemp = 77 °F
2021-07-14 22:52:26.293 [INFO ] [penhab.core.model.script.HeatHoldDwn] - DwnDesHeatTemp = 50 °F

Since I am not experienced with JAVA programming, I wonder if someone could help me with why this is failing. I need to have the DwnDesHeatTemp inside the conditional so that if it is set to a proper value and the thermostat is in auto mode, it retains the original setting.

Many thanks,

-Mark

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.