[SOLVED] Help with thermostat rule

Change the hysteresis to a Number val
As your variable and hysteresis are now all numbers you won’t need the floatValue anymore

rule "Elutoa temperatuur"
when
    Item ElutoaSetpoint changed or
    Item ElutoaTemp changed
then
    var Number cur_temp = ElutoaTemp.state as Number
    var Number setpoint = ElutoaSetpoint.state as Number
    val  Number hysteresis = 0.5

    if (cur_temp < (setpoint - hysteresis)) {
        if (ElutoaRadikas.state != ON) {ElutoaRadikas.sendCommand(ON)}
    }
    else if(cur_temp > setpoint + hysteresis) {
        if (ElutoaRadikas.state != OFF) {ElutoaRadikas.sendCommand(OFF)}
    }
end
3 Likes