Control air conditioner

Hi
i want to control my air conditioner via mqtt.
i have the broker setup and an ESP8266 with an IR LED. the ESP8266 waits for a message like this:
power=0&mode=2&fan=2&temp=20&vert=2&horiz=2
i want to add a button, a mode selector, fan selector and a temperature control.
how do i define all this and assemble an appropriate message?

well i did it with node red dashboard
now i just need to integrate it in openhab

Hi

I dont know anything about node red dash …

But i can help on the “normal” way …

The steps will be:

1. Install and configure MQTT binding if you dont have it allready…

2. Make a item file for your conditioner settings so you have a item for every setting.

Like:

/*****CONDITIONER ITEMS*****/

/*****Groups*****/
Group cond

/*****Items*****/
Number cond_power "Power" <light> (cond)
Number cond_mode "Mode" <light> (cond)
Number cond_fan "Fan" <light> (cond)
Number cond_temp "Tem" <light> (cond)
Number cond_vert "Vert" <light> (cond)
Number cond_horiz "Horiz" <light> (cond)
Switch cond_send "Send Update" <light> (cond)

3. Make a sitemap to display the items or integrate the items in a given sitemap .

Like:

(set the min and max values from the setpoint items to your needs)

sitemap cond label="Cond"
{ Frame label="Conditioner"
Setpoint item=cond_power label="Power: [%.1f]" minValue=0 maxValue=1 step=1
Setpoint item=cond_mode label="Mode: [%.1f]" minValue=1 maxValue=3 step=1
Setpoint item=cond_fan label="Fan: [%.1f]" minValue=1 maxValue=3 step=1
Setpoint item=cond_temp label="Temp: [%.1f]" minValue=1 maxValue=3 step=1
Setpoint item=cond_vert label="Vert: [%.1f]" minValue=1 maxValue=3 step=1
Setpoint item=cond_horiz label="Horiz: [%.1f]" minValue=1 maxValue=3 step=1
Switch item=cond_send mappings=[ON="Update"]
}

4. Make an Rule to build the mqtt string and send it when update is pressed

rule "cond_sendmqtt"
when
    Item cond_send received update ON
then
// Build the String
var contmqtt = "power="+cond_power.state+"&mode="+cond_mode.state+"&fan="+cond_fan.state+"&temp="+cond_temp.state+"&vert="+cond_vert.state+"&horiz="+cond_horiz.state

//Send MQTT
publish("yourbroker", "yourtopic", contmqtt)

//Set Update switch to off
postUpdate(cond_send, OFF)
end

You also can make a switch with mappings for the power switch instead of the numbers …

2 Likes

did someone find a smart way to record the IR for all the combinations?

1 Like

I read the thread which is good for all, So for that you will do one thing just read some different tricks which will be fine for all. Just get some good tutorial and that will be fine for all. Also when I faced any issue with my AC, by following 24 hour ac repair, you will be fine to get good service. I hope that will be fine for all.