Create custom remote receiver with ESPHome and IRremoteESP8266

I have custom climate component like this, and use IRremoteESP8266 to control Gree AC

#include "esphome.h"
#include "IRremoteESP8266.h"
#include "IRsend.h"
#include "ir_Gree.h"

const uint16_t kIrLed = 14;
IRGreeAC ac(kIrLed);

class GreeAC : public Component, public Climate
{
public:
  void setup() override
  {
    ac.begin();
    ac.on();

    ac.setMode(kGreeAuto);
    ac.setTemp(22);
    ac.setFan(kGreeFanAuto);
    ac.setSwingVertical(true, kGreeSwingAuto);
  }

  climate::ClimateTraits traits()
  {
    auto traits = climate::ClimateTraits();

   ...

    return traits;
  }

  void control(const ClimateCall &call) override
  {
  
    //Set climate, fan, swing modes
    
    this->publish_state();
    
    ac.send();
    delay(200);
  }
};

and yaml like this:

esphome:
  name: ir_bedroom
  platform: ESP8266
  board: esp_wroom_02
  includes: 
    - gree/gree_ir.h
  libraries:
    - IRremoteESP8266

...

remote_receiver:
  pin: 
    number: GPIO5
    inverted: true
  dump: all

remote_transmitter:
  pin: 
    number: GPIO14
    inverted: false
  carrier_duty_percent: 50%
  id: "ir_bedroom_transmitter"
    
climate:
- platform: custom
  lambda: |-
    auto bedroom_ac = new GreeAC();
    App.register_component(bedroom_ac);
    return {bedroom_ac};
  climates:
    - name: "Bedroom AC"

...

Is there any way to create custom remote receiver? I want to receive command, decode it (using ac.decode()), and update climate state (call publish_state()). Is it possible?

2 Likes

Did you find a solution to this?

Unfortunately not

Hagakurje, can you share full example for controlling AC please?

Example is here

Thanks a lot!