# Robonomics IR remote with ESPHome The Robonomics team creates devices with a type-c port for **open-source firmware** updating. Today we will upload [ESPHome](https://esphome.io/) firmware on it and connect it to Home Assistant. ## Requirements To write our firmware on ESPHome we need to know the pinout of the IR remote. Robonomics devices come with pre-installed open-source firmware Tasmota, and after connecting the device to your wi-fi network you can visit the device and find its pinout. For IR remote pinout will be next: ![image](https://hackmd.io/_uploads/ByFK7qIYT.png) We will use GPIO 4 and 5. Also, you should have an A/C brand from the list of compatible units. Full list of compatible vendors you can find on [the official website](https://esphome.io/components/climate/climate_ir). ## ESPHome This article assumes that you already have ESPHome. Create a new project. The Robonomics IR remote uses `ESP32` and `esp32dev` as a board. After finishing with ESPHome wizard you will get a similar yaml file: ``` esphome: name: ir_remote esp32: board: esp32dev framework: type: arduino # Enable logging logger: # Enable Home Assistant API api: password: "" ota: password: "" wifi: ssid: "<YOUR_WI-FI>" password: "<YOUR_PASSWORD>" # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Ir Remote Fallback Hotspot" password: "6HRfq87RpfGM" captive_portal: remote_transmitter: pin: GPIO4 carrier_duty_percent: 50% remote_receiver: pin: GPIO5 dump: all climate: - platform: daikin # adjust to match your AC unit! name: "Robonomics AC" ``` ESPHome gives a lot of variants of device configuration, so the provided configuration file may be only one of the variants. The full configuration file will be next: ``` esphome: name: ir_remote esp32: board: esp32dev framework: type: arduino # Enable logging logger: # Enable Home Assistant API api: password: "" ota: password: "" wifi: ssid: "<YOUR_WI-FI>" password: "<YOUR_PASSWORD>" # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Ir Remote Fallback Hotspot" password: "6HRfq87RpfGM" captive_portal: remote_transmitter: pin: GPIO4 carrier_duty_percent: 50% remote_receiver: pin: number: GPIO5 inverted: True dump: all climate: - platform: daikin # adjust to match your AC unit! name: "Robonomics AC" ``` ### Remote Transmitter and Receiver components To send and receive data from your A/C unit, we should provide pins to the Transmitter and Receiver. Leave these fields unchanged. ### Climate component Provide here the vendor of your A/C in the platform field and give a name to it. In the example vendor is "daikin". ## Advanced Options Additionally, you can set the following values: - min_temperature (Optional, float): The minimum temperature the climate device can reach. Used to set the range of the frontend gauge. - max_temperature (Optional, float): The maximum temperature the climate device can reach. Used to set the range of the frontend gauge. - temperature_step (Optional, float): The granularity with which the target temperature can be controlled. Can be a single number, or split as below: - target_temperature (Required, float): The granularity for target temperature. - current_temperature (Required, float): The granularity for current temperature. The code will be next: ``` climate: - platform: <YOUR VENDOR> # adjust to match your AC unit! name: "Robonomics AC" visual: min_temperature: 16 max_temperature: 28 temperature_step: target_temperature: 0.5 current_temperature: 0.1 ``` If you have a temperature sensor in Home Assistant and you want to get the temperature from it as "current temperature" in the A/C entity, then you should import it. Add next part of code: ``` sensor: - platform: homeassistant id: current_ac_temperature entity_id: <YOUR_HOME_ASSISTANT_ENTITY_ID># example - sensor.temperature_sensor ``` And add the "sensor" key to the Climate component with the value - `current_ac_temperature`. Full Climate component code in the example will be next: ``` remote_transmitter: pin: GPIO4 carrier_duty_percent: 50% remote_receiver: pin: number: GPIO5 inverted: True dump: all sensor: - platform: homeassistant id: current_ac_temperature entity_id: sensor.t_h_sensor_work_zone_temperature climate: - platform: daikin_brc # adjust to match your AC unit! name: "Robonomics AC" sensor: current_ac_temperature visual: min_temperature: 16 max_temperature: 28 temperature_step: target_temperature: 0.5 current_temperature: 0.1 ``` ## Configuration After changing all parameters in configuration file, save it and close. Connect the device to PC and upload firmware with next command - `esphome run <NAME_OF_CONFIGURATION_FILE>`. Wait until firmware will compile and choose upload over the cable. That's all. Now you can connect the deivce to home automation operating systems. - To connect to Home Assistant read [this article](https://hackmd.io/@nakata5321/HkVnKk2K6). - To connect to openHAB read [this article](https://hackmd.io/@nakata5321/BknlqbpKp).