[ESPHome Component] Cloud-Free Midea / Inventor / Comfee Dehumidifier (based on Hypfer’s project)

Nice! You have a seperate sensor, for me it’s the same if the bucket is not in place or it’s full since the only sensor Igot for that is a floating sensor which triggers for both of the situations…

Can you post some different RX packets from your device?
Do you have discord?

Send you a dm

Thank you, @Chreece, for your work, I tried to install your component on a Midea Cube 50 without success, from which I removed the EU-SK105 key.

I used this DIYmall USB to ESP8266 Breakout CH340C for programming.

And this DIYmall USB to ESP8266 Breakout CH340C

on connected to the MIDEA CUBE with the switch on UART position.

I am assuming that in the UART position, the USB connector pins are serial TX, RX, VCC and GND.

The problem I am encountering is a total lack of data in reception.
Analyzing your code, I noticed that the reception buffer remains empty.

/ Handle incoming RX packets
void MideaDehumComponent::handleUart() {
  if (!this->uart_) return;

  static size_t rx_len = 0;

  while (this->uart_->available()) { //<-- always FALSE
    uint8_t byte_in;
    if (!this->uart_->read_byte(&byte_in)) break;

    if (rx_len < sizeof(serialRxBuf)) {
      serialRxBuf[rx_len++] = byte_in;
    } else {
      rx_len = 0;
      continue;
    }
    .
    .
    .

The only data modified in the YAML file are these:

esp8266:
  board: esp01_1m

logger:
  baud_rate: 0 
  level: INFO #makes uart stream available in esphome logstream

uart:
  id: uart_midea
  tx_pin: GPIO1 # replace with the TX pin used from esp
  rx_pin: GPIO3 # replace with the RX pin used from esp

Or maybe I’m wrong and the signals are TTL even in the UART position.
Does anyone have experience with this Breakout board?

Thanks in advance for any suggestions.

Hello Manuel,

You don’t have to change anything in the code.
Any changes must be done in the yaml.

The Tx, Rx pins you are using are ok for the esp01.
Now I don’t know if your usb adapter has level shifters (probably not) which are necessary because the signals from the device are on 5V and esp can read only 3.3V.

Edit: you could also try turning the switch to programming

Hi Chreece, the adapter has a level shifter, the VCC pin is at 3.3V.
It would appear that the adapter converts the TX and RX (RS232) signals to D+ and D- (USB) even in the UART position, always passing through the CH340C chip.
I’ll try with an ESP-01 adapter like this, the one suggested in Hypfer’s esp8266-midea-dehumidifier :crossed_fingers:

1 Like

UPDATE

Now with above adapter the firmware works with my Midea Cube 50.

I added the WEB component because I want to control the dehumidifier from a Shelly device via the REST API.
The following endpoints work:
http://midea-dehumidifier.local/climate/midea_cube/set?mode=OFF
http://midea-dehumidifier.local/climate/midea_cube/set?mode=DRY
http://midea-dehumidifier.local/climate/midea_cube/set?fan_mode=LOW
http://midea-dehumidifier.local/climate/midea_cube/set?fan_mode=MEDIUM
http://midea-dehumidifier.local/climate/midea_cube/set?fan_mode=HIGH

but /set?target_humidity or any /set?custom_preset endpoints do not work.

@ChreeceGR please, do yo have any suggestion?

This is the webserver page, as you can see this options are not present:

Sorry I can’t help you with that. I’m not using rest API and in docs there is no mention of climate.
How and why are you controlling the dehumidifier from a shelly?

If I am using a Wemos D1 min, and it has 5V input via VIN, I guess I do not need any level shifter then, is this assumption correct?

The most esp boards have 5V input which is converted to 3.3V for the esp to work.
The uart is still 3.3V logic and if your board doesn’t have a logic converter it could harm it.

OK, great.
When I compile the code, just copied and modified to my board, I get the following error (when using the log branch it works only getting warning):

 [W][uart.arduino_esp8266:151]:   You're using the same serial port for logging and the UART component. Please disable logging over the serial port by setting logger->baud_rate to 0.

Error for main branch:

src/esphome/components/midea_dehum/midea_dehum.cpp: In member function 'virtual esphome::climate::ClimateTraits esphome::midea_dehum::MideaDehumComponent::traits()':
src/esphome/components/midea_dehum/midea_dehum.cpp:1083:36: error: cannot convert 'std::vector<const char*>' to 'std::set<std::__cxx11::basic_string<char> >'
 1083 |     t.set_supported_custom_presets(custom_presets);
      |                                    ^~~~~~~~~~~~~~
      |                                    |
      |                                    std::vector<const char*>
In file included from src/esphome/components/climate/climate.h:9,
                 from src/esphome/components/midea_dehum/midea_dehum.h:8,
                 from src/esphome/components/midea_dehum/midea_dehum.cpp:1:
src/esphome/components/climate/climate_traits.h:130:59: note:   initializing argument 1 of 'void esphome::climate::ClimateTraits::set_supported_custom_presets(std::set<std::__cxx11::basic_string<char> >)'
  130 |   void set_supported_custom_presets(std::set<std::string> supported_custom_presets) {
      |                                     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
*** [.pioenvs/comfeedf3/src/esphome/components/midea_dehum/midea_dehum.cpp.o] Error 1
========================= [FAILED] Took 24.45 seconds =========================

Can you post your yaml and esphome version?

Also make sure you have:

logger:
  baud_rate: 0

as suggested in your logs

Hi, I’m trying to compile on my ESPHome, in Home Assistant, unfortunately this generates the following error, what am I doing wrong?

Note: “Validation” it’s done.

INFO ESPHome 2025.7.5
INFO Reading configuration /config/esphome/deumidificatore.yaml…
INFO Updating https://github.com/Chreece/ESPHome-Dehumidifier@main
INFO Generating C++ source…
ERROR ID midea_dehum_mideaswingswitch_id is already registered

Thank you!

Probably double entry, can you post your yaml?

Hello @ChreeceGR, yes, I’ve fully commented out the “swing” part in dehumidifier.yaml, the Comfee MDDF-20DEN7-WF doesn’t have it.
Also, I can confirm that the SLWF-01Pro dongle works like a charm.
Your work is great, thank you! :slight_smile:

1 Like

Just to let you know, I updated to ESPHome 2025.11.5, adjusted the logger entry and switched back to the main path - it went through without issues. My problem solved with that.

1 Like