# Create DIY IR controller In this article you will create DIY IR controller for control an air conditioner. ## Requirements - ESP32(for example AYARAFUN ESP32S) - IR led(for example [TSAL6400](https://www.ebay.com/itm/10pcs-TSAL6400-ORIGINAL-Vishay-5mm-Infrared-LED-940nm-IR-Diode/180843198876?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649)) - NPN transistor(for example a 2N3904). - resistor - 100 Om - IR Receiver(for example [KY-022](https://arduinomodules.info/ky-022-infrared-receiver-module/)) - wires ## Build controller The assembly diagram is: ![](https://i.imgur.com/wYozBgv.png) You can choose other pins, if `D4` or `D5` are unavailable, but remember it for later instalation. ## Firmware Next step is upload the firmware to the ESP32 controller. ***The web installer works only on Google chrome browser.*** Open Google chrome browser and go to the next link - [Install Tasmota](https://tasmota.github.io/install/). You will see next page. ![](https://i.imgur.com/BQ3Q9vU.png) Choose **Tasmota IR** and **ESP32**. ![](https://i.imgur.com/vXksTtT.png) And press **Connect**. Then choose Port. ![](https://i.imgur.com/RAfRpXy.png) In popup menu choose "install tasmota IR": ![](https://i.imgur.com/Mx7R7G1.png) Choose "Erase device" and press "Next": ![](https://i.imgur.com/xXiYd2g.png) Confirm an installation and wait until the installation will be completed: ![](https://i.imgur.com/JeMnnLg.png) ## Configuration After finishing the instalation process Wi-Fi configuration popup will appear. Provide your wi-fi credentials, for connect ESP32 to your wi-fi network. After setting up wi-fi you can visit device via "visit device" button. ![](https://i.imgur.com/Ffes6qI.png) Next step is configurate ports. For this go to "configuration"->"configuration module". On this page choose next statements: - IO GPIO4 - IRsend (1) - IO GPIO5 - IRserv Choose your pins, if you connected IR led and reseiver to other pins. All other statements choose to "None". ![](https://i.imgur.com/ycceY5Z.png) Save configuration. ## MQTT configuration Return to "main menu" and go to "Configuration" -> "Configure MQTT". Provide your MQTT credentials here: ![](https://i.imgur.com/XP8C8Op.png) That's all with ESP for now. Next step is install Home Assistant integration. ## Integration setup Next step is to download the files from [this repo](https://github.com/hristo-atanasov/Tasmota-IRHVAC), get the folder named "tasmota_irhvac" and place it in your "custom_components" folder. Reastart Home Assistant! After restart add the following in your "configuration.yaml" file, but don’t save it yet, because you’ll need to replace all values with your speciffic AC values. ``` tasmota_irhvac: climate: - platform: tasmota_irhvac name: "<Some Name Here>" command_topic: "cmnd/<your_tasmota_device>/irhvac" # Pick one of the following: # State is updated when the tasmota device receives an IR signal (includes own transmission and original remote) # useful when a normal remote is in use alongside the tasmota device, may be less reliable than the second option. state_topic: "tele/<your_tasmota_device>/RESULT" # State is updated when the tasmota device completes IR transmissionm, should be pretty reliable. #state_topic: "stat/<your_tasmota_device>/RESULT" # Uncomment if your 'available topic' of Tasmota IR device are different (if device in HA is disabled) #availability_topic: "tele/<your_tasmota_device>/LWT" temperature_sensor: <temperature sensor in room> - # required to measure temperature in a room. e.x. sensor.kitchen_temperature humidity_sensor: None #optional - default None (e.x. sensor.kitchen_humidity) power_sensor: None #optional - default None (e.x. binaly_sensor.kitchen_ac_power) vendor: "<Your vendor here>" #find your vendor in logs. min_temp: 16 #optional - default 16 int value max_temp: 32 #optional - default 32 int value target_temp: 26 #optional - default 26 int value initial_operation_mode: "off" # optional - default "off" string value (one of the "supported_modes") away_temp: 24 #optional - default 24 int value precision: 1 #optional - default 1 int or float value. Can be set to 1, 0.5 or 0.1 supported_modes: - "heat" - "cool" - "dry" - "fan_only" # Use "fan_only" even if Tasmota shows "Mode":"Fan" - "auto" - "off" #Turns the AC off - Should be in quotes # Some devices have "auto" and "fan_only" switched # If the following two lines are uncommented, "auto" and "fan" shoud be commented out #- "auto_fan_only" #if remote shows fan but tasmota says auto #- "fan_only_auto" #if remote shows auto but tasmota says fan supported_fan_speeds: # Some devices say max,but it is high, and auto which is max # If you uncomment the following two, you have to comment high and max # - "auto_max" #woud become max # - "max_high" #would become high #- "on" #- "off" #- "low" - "medium" - "high" #- "middle" #- "focus" #- "diffuse" - "min" - "max" #- "auto" supported_swing_list: - "off" - "vertical" #up to down # - "horizontal" # Left to right # - "both" default_quiet_mode: "Off" #optional - default "Off" string value default_turbo_mode: "Off" #optional - default "Off" string value default_econo_mode: "Off" #optional - default "Off" string value hvac_model: "-1" #optional - default "1" string value celsius_mode: "On" #optional - default "On" string value default_light_mode: "Off" #optional - default "Off" string value default_filter_mode: "Off" #optional - default "Off" string value default_clean_mode: "Off" #optional - default "Off" string value default_beep_mode: "Off" #optional - default "Off" string value default_sleep_mode: "-1" #optional - default "-1" string value default_swingv: "high" #optional - default "" string value default_swingh: "left" #optional - default "" string value keep_mode_when_off: True #optional - default False boolean value : Must be True for MITSUBISHI_AC, ECOCLIM, etc. toggle_list: #optional - default [] # The toggled property is a setting that does not retain the On state. # Set this if your AC properties are toggle function. #- Beep #- Clean #- Econo #- Filter #- Light #- Quiet #- Sleep #- SwingH #- SwingV #- Turbo ``` Let's open logs of ESP32. For this go to proper local URL(if you know it), or open again [Install Tasmota](https://tasmota.github.io/install/) and choose "Tasmota IR" and "ESP32". Press "Connect", choose port and you will see next variants. ![](https://i.imgur.com/sOci3AP.png) Press visit device, and you will provide to device main page. Go to "Consoles" -> "console". Using your remote and the IR Transceiver do the following steps to find your AC values that you have to fill in: - find value by pressing butons on your remote directed to the IR Transceiver. You will get next log in console: ``` 10:08:06.925 MQT: tele/tasmota_F6CF74/RESULT = {"IrReceived":{"Protocol":"MITSUBISHI112","Bits":112,"Data":"0x23CB260100A003060D00000000CB","Repeat":0,"IRHVAC":{"Vendor":"MITSUBISHI112","Model":-1,"Mode":"Cool","Power":"Off","Celsius":"On","Temp":25,"FanSpeed":"Medium","SwingV":"Highest","SwingH":"Auto","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}} ``` - in "IRHVAC" topic will be all necessary information. - Cycle trough all buttons on your remote and fill "configuration.yaml" file. as result part of your configuration file should looks similar to this: (in example unused statement was deleted) ``` tasmota_irhvac: climate: - platform: tasmota_irhvac name: "bangkok climate control" unique_id : "bangkok test climate" command_topic: "cmnd/tasmota_F6CF74/irhvac" state_topic: "tele/tasmota_F6CF74/RESULT" temperature_sensor: sensor.robonomicssensor_36133_temperature_2 vendor: "MITSUBISHI112" min_temp: 16 #optional - default 16 int value max_temp: 31 #optional - default 32 int value target_temp: 25 #optional - default 26 int value initial_operation_mode: "cool" supported_modes: - "cool" - "dry" - "fan_only" # Use "fan_only" even if Tasmota shows "Mode":"Fan" - "auto" - "off" #Turns the AC off - Should be in quotes # Some devices have "auto" and "fan_only" switched # If the following two lines are uncommented, "auto" and "fan" shoud be commented out #- "auto_fan_only" #if remote shows fan but tasmota says auto #- "fan_only_auto" #if remote shows auto but tasmota says fan supported_fan_speeds: # Some devices say max,but it is high, and auto which is max # If you uncomment the following two, you have to comment high and max # - "auto_max" #woud become max # - "max_high" #would become high - "low" - "medium" - "max" - "auto" supported_swing_list: - "off" - "vertical" #up to down hvac_model: "-1" #optional - default "1" string value keep_mode_when_off: True #optional - default False boolean value : Must be True for MITSUBISHI_AC, ECOCLIM, etc. ``` Save "configuration.yaml" and restart Home Assistant. Once restarted you can add in LovelaceUI a new thermostat card and select the newly integrated AC. ![](https://i.imgur.com/elPvMDB.png) If you have problem with GUI mode, switch to "CODE EDITOR" and write next: ``` type: thermostat entity: climate.<your climate name> ``` Your climate name you can find in "Developer tools" -> "states" and start write you climate name in "Filter enteties" field. ![](https://i.imgur.com/I5qeXgf.png) That's all with DIY IR controller setup. Now you can control your air conditioner in Home Assistant. **To send commands to air conditioner your IR controller must have direct visual contact to coditionrer!**