Climate control (AC) script?

Hello,

I want to control the room temperature. I am measuring the temperature using a Sonoff sensor and also able to control the AC temperature using Broadlink RM Mini 3.

Has anybody written a rule which turns ON/OFF the AC based on room temperature?

I guess I am trying to mimic Nest thermostat in software.

Thanks

There are many examples on the forum just use the search function.

One rule example:

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
2 Likes