ESP8266 / ESPHOME / Arduino / IRremoteESP8266


I have an ESP8266 D1 mini connected with an IR Receiver Transmitter. It is recognized by esphome but I don’t know how to integrate the “AIRWELL” library from this git (GitHub - crankyoldgit/IRremoteESP8266: Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on:

If I use a better known brand in my “climate”, I don’t have any errors, but if I customize with airwell, it doesn’t work, here is my yaml :

  name: esp-clim
  friendly_name: ESP-CLIM
    - ir_Airwell.h
    - IRremoteESP8266

  board: esp01_1m

  ssid: !secret wifi_ssid
  password: !secret wifi_password

  pin: GPIO5
  carrier_duty_percent: 50%

  - platform: custom
    lambda: |-
      auto myirairwell = new IRAirwellAc();
      return {myirairwell};

      - name: "Climmmm"

But i have an error :

Compiling .pioenvs/esp-clim/lib84c/IRremoteESP8266/ir_Gorenje.cpp.o
Compiling .pioenvs/esp-clim/lib84c/IRremoteESP8266/ir_Gree.cpp.o
/config/esphome/esp-clim.yaml: In lambda function:
/config/esphome/esp-clim.yaml:56:42: error: no matching function for call to 'IRAirwellAc::IRAirwellAc()'
   56 |       auto myirairwell = new IRAirwellAc();
      |                                          ^
In file included from src/main.cpp:27:
src/ir_Airwell.h:62:12: note: candidate: 'IRAirwellAc::IRAirwellAc(uint16_t, bool, bool)'
   62 |   explicit IRAirwellAc(const uint16_t pin, const bool inverted = false,
      |            ^~~~~~~~~~~
src/ir_Airwell.h:62:12: note:   candidate expects 3 arguments, 0 provided
src/ir_Airwell.h:60:7: note: candidate: 'constexpr IRAirwellAc::IRAirwellAc(const IRAirwellAc&)'
   60 | class IRAirwellAc {
      |       ^~~~~~~~~~~
src/ir_Airwell.h:60:7: note:   candidate expects 1 argument, 0 provided
src/ir_Airwell.h:60:7: note: candidate: 'constexpr IRAirwellAc::IRAirwellAc(IRAirwellAc&&)'
src/ir_Airwell.h:60:7: note:   candidate expects 1 argument, 0 provided
/config/esphome/esp-clim.yaml:58:26: error: could not convert '{myirairwell}' from '<brace-enclosed initializer list>' to 'std::vector<esphome::climate::Climate*>'
   58 |       return {myirairwell};
      |                          ^
      |                          |
      |                          <brace-enclosed initializer list>
Compiling .pioenvs/esp-clim/lib84c/IRremoteESP8266/ir_Haier.cpp.o
Compiling .pioenvs/esp-clim/lib84c/IRremoteESP8266/ir_Hitachi.cpp.o
Compiling .pioenvs/esp-clim/lib84c/IRremoteESP8266/ir_Inax.cpp.o
*** [.pioenvs/esp-clim/src/main.cpp.o] Error 1

And in my /homeassistant/esphome/ir_Airwell.h :slight_smile:

// Copyright 2020 David Conran

/// @file
/// @brief Airwell "Manchester code" based protocol.
/// Some other Airwell products use the COOLIX protocol.

// Supports:
//   Brand: Airwell,  Model: RC08W remote
//   Brand: Airwell,  Model: RC04 remote
//   Brand: Airwell,  Model: DLS 21 DCI R410 AW A/C

#ifndef IR_AIRWELL_H_
#define IR_AIRWELL_H_

#include <stdint.h>
#ifndef UNIT_TEST
#include <Arduino.h>
#include "IRremoteESP8266.h"
#include "IRsend.h"
#ifdef UNIT_TEST
#include "IRsend_test.h"

/// Native representation of a Airwell A/C message.
union AirwellProtocol{
  uint64_t raw;  // The state of the IR remote in native IR code form.
  struct {
    uint64_t            :19;
    uint64_t Temp       :4;
    uint64_t            :5;
    uint64_t Fan        :2;
    uint64_t Mode       :3;
    uint64_t PowerToggle:1;
    uint64_t            :0;

// Constants
const uint64_t kAirwellKnownGoodState = 0x140500002;  // Mode Fan, Speed 1, 25C
// Temperature
const uint8_t kAirwellMinTemp = 16;  // Celsius
const uint8_t kAirwellMaxTemp = 30;  // Celsius
// Fan
const uint8_t kAirwellFanLow = 0;     // 0b00
const uint8_t kAirwellFanMedium = 1;  // 0b01
const uint8_t kAirwellFanHigh = 2;    // 0b10
const uint8_t kAirwellFanAuto = 3;    // 0b11
// Modes
const uint8_t kAirwellCool = 1;  // 0b001
const uint8_t kAirwellHeat = 2;  // 0b010
const uint8_t kAirwellAuto = 3;  // 0b011
const uint8_t kAirwellDry = 4;   // 0b100
const uint8_t kAirwellFan = 5;   // 0b101

// Classes
/// Class for handling detailed Airwell A/C messages.
class IRAirwellAc {
  explicit IRAirwellAc(const uint16_t pin, const bool inverted = false,
                       const bool use_modulation = true);
  void stateReset();
  void send(const uint16_t repeat = kAirwellMinRepeats);
  /// Run the calibration to calculate uSec timing offsets for this platform.
  /// @return The uSec timing offset needed per modulation of the IR Led.
  /// @note This will produce a 65ms IR signal pulse at 38kHz.
  ///   Only ever needs to be run once per object instantiation, if at all.
  int8_t calibrate(void) { return _irsend.calibrate(); }
#endif  // SEND_AIRWELL
  void begin();
  void setPowerToggle(const bool on);
  bool getPowerToggle() const;
  void setTemp(const uint8_t temp);
  uint8_t getTemp() const;
  void setFan(const uint8_t speed);
  uint8_t getFan() const;
  void setMode(const uint8_t mode);
  uint8_t getMode() const;
  uint64_t getRaw() const;
  void setRaw(const uint64_t state);
  static uint8_t convertMode(const stdAc::opmode_t mode);
  static uint8_t convertFan(const stdAc::fanspeed_t speed);
  static stdAc::opmode_t toCommonMode(const uint8_t mode);
  static stdAc::fanspeed_t toCommonFanSpeed(const uint8_t speed);
  stdAc::state_t toCommon(const stdAc::state_t *prev = NULL) const;
  String toString() const;
#ifndef UNIT_TEST

  IRsend _irsend;  ///< Instance of the IR send class
  /// @cond IGNORE
  IRsendTest _irsend;  ///< Instance of the testing IR send class
  /// @endcond
  AirwellProtocol _;
#endif  // IR_AIRWELL_H_

Can you help me ?

I don’t know your library, but first fix your board definition.
Esp01 doesn’t even have pin GPIO5