Midea branded AC’s with ESPhome (no cloud)

You have to disable the logger component:

logger:
  baud_rate: 0

Ok just tried that. Same thing. :slightly_frowning_face:

The logger baud rate set to zero is necessary, so leave it in.

Now change TX/RX

I know, tedious, but with the logger enabled it can’t work, so we have to disable the logger and start again with all the other possible things.

When you changed that, what is the output in ESPHome (the pic you already took)?

EDIT: Wait, are you sure, that is a feather board? It looks way more like a NodeMCU…

Ok tried switching TX/RX again. Same thing. The output in ESPhome is the same as the pic I took earlier.

Just out of curiosity, would connecting TX/RX of the ESP32 together (doing this on the bench, disconnected from the A/C entirely) be a valid loopback test? Because I just tried it and I’m seeing this sporadically:

[13:41:41][D][midea_dongle:094]: TX: AA 22 AC 00 00 00 00 00 03 03 41 00 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 84 68 
[13:41:42][D][midea_dongle:029]: RX: AA 20 02 05 45 44 68 69 41 49 A8 04 44 2B B3 BE 81 A1 52 45 95 35 B3 0A 91 98 52 35 49 4B 0B 60 91 
[13:41:42][W][midea_dongle:031]: RX: frame check failed!

Even though it’s not repeating back every single TX string can I at least assume the ESP32 as it’s configured is capable of receiving?

Ok loopback test is working fine. Verified that TX/RX pins on the Feather map to GPIO16 and 17. I also ran the loopback through level shifter and it’s working fine there too. Not sure what the problem is at this point. I ordered an oscilloscope from Amazon and it should be here tomorrow.

Ok it works! Turns out the issue was the Adafruit TXB0104 based level shifter I was using. Either they were defective (I tried two!) or they don’t work for this application for reasons I don’t understand yet. I actually needed to buy an oscilloscope to figure this out. Fortunately I was able to pick up a Sparkfun converter at Microcenter and it works like a charm. So just some caution for anyone who used the Adafruit converter and ends up having the same problem.

2 Likes

If your time permits, you could ask Adafruit for a statement? It would be interesting to know why this level shifter isn’t working as expected. :slight_smile:

But it’s nice to see, how you figured it out (I followed your experiments on Telegram). :+1:

The display is extremely bright and annoying, so we still need the remote on our nightstand to turn it off. Or we have to disable the display more permanently :grimacing:
Would it be possible to use the ESP to send the IR code to disable the display, by connecting an IR LED to it and point towards the IR receiver internally? Did anyone manage to decipher the IR data yet?

So far it seems the display dimmer is IR only and not t controllable over uart.

Some people have started developing it, but not sure what the status is…

Yes that is possible. I made a dongle using a Wemos D1 with an IR Led.

On this photo the Wemos is not soldered in place yet:

This is my config:

esphome:
  name: esp_hvac_skr
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "xxxxxxxxxxxxxx"
  password: "xxxxxxxxxx"

  ap:
    ssid: "xxxxxxxxxxxxxx"
    password: "xxxxxxxxxxxxx"

captive_portal:

# Enable logging
logger:
  baud_rate: 0

api:

ota:

uart:
 tx_pin: TX
 rx_pin: RX
 baud_rate: 9600

midea_dongle:

climate:
 - platform: midea_ac
   name: "Slaapkamer"
   beeper: false

remote_transmitter:
  pin: D7
  carrier_duty_percent: 50%
  
switch:
  - platform: template
    name: "Display toggle"
    turn_on_action:
       - remote_transmitter.transmit_raw:
            carrier_frequency: 38kHz
            code: [  4390, -4371, 572, -1573, 548, -525, 570, -1575, 547, -1598, 547, -525, 573, -1570, 574, -500, 547, -1598, 551, -520, 549, -1597, 572, -498, 549, -524, 547, -1597, 572, -500, 550, -1596, 571, -500, 574, -1571, 572, -1574, 548, -1597, 546, 
                     -1598, 548, -523, 549, -1596, 572, -499, 573, -1571, 573, -500, 570, -501, 548, -524, 573, -500, 572, -1572, 548, -524, 549, -1597, 547, -523, 572, -1573, 572, -499, 548, -1596, 550, -522, 578, -495, 548, -1596, 571, -499, 549, -1598, 548, -523, 549, 
                     -1595, 571, -500, 549, -1596, 548, -1597, 548, -523, 574, -1571, 549, -523, 572, -5157, 4390, -4368, 548, -1596, 550, -521, 574, -1571, 572, -1573, 547, -525, 548, -1595, 549, -523, 550, -1594, 549, -524, 549, -1595, 548, -523, 550, -523, 548, -1596, 
                     548, -523, 550, -1595, 547, -524, 549, -1595, 549, -1595, 550, -1595, 549, -1598, 546, -524, 548, -1595, 549, -523, 548, -1598, 547, -522, 550, -523, 551, -520, 550, -522, 550, -1595, 549, -522, 551, -1596, 572, -499, 547, -1596, 548, -524, 549, -1596, 
                     548, -523, 550, -523, 571, -1574, 547, -523, 549, -1596, 548, -523, 549, -1597, 547, -523, 550, -1594, 574, -1572, 549, -522, 549, -1596, 549, -522, 550]
3 Likes

Cool Noël! Many thanks.
Been lurking other forums but did not find a proper solution yet. Time to order a IR LED and check this out :grimacing::+1:t2:

You’re welcome! You’ll also need a transistor and a resistor. I used the diagram from this page:

I did not add the IR Receiver to my dongle, but a receiver can be useful for sniffing IR commands from the remote.

Hi, I assumed a transistor was necessary, so thanks for the schematics. Just dismantled an old IR blaster so I don’t need to order a LED. I must have some transistors lying around also, not the one mentioned in the linked GitHub page, but a simple BC547B should do the trick also. And otherwise I’ll just dismantle an old IR remote, there should be a suitable IR LED and transistor to salvage from that.

I used a BC549C, also works fine :slight_smile:

Finally found some time to integrate the IR LED and control the display, works fine. It didn’t work with your raw codes, probably a different model/brand AC, so I had to read the codes with an IR receiver.

I was wondering if anyone found a way to control the fan speed, can’t seem to find it in the esphome component itself or on this (or other) forum. I should probably be able to control it with the IR integration, but would be nice to also have feedback on it over the uart.
EDIT: oops never mind, reloaded the device and fan mode and swing mode are back in the hvac entity

So, I’m completely new to this Topic and haven’t read through all 156 comments to be honest. (I actually did now )…

I Have a “Dimstal SMND-12ECO” AC which, as far as I could find out, is pretty much identical with midea…

Still, the midea_ac component doesn’t seem to work properly :frowning:
What I did:

  1. flashed an ESP-01 via the ESPhome addon, using this yaml:
    (no errors or warnings)

esphome:
  name: ac01-esphome
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pass

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Ac01-Esphome Fallback Hotspot"
    password: "***"

captive_portal:
# Enable Home Assistant API
api:
  password: !secret api_ota_pass

ota:
  password: !secret api_ota_pass

# Disable logging over UART
logger:
  baud_rate: 0

uart:
  tx_pin: 1
  rx_pin: 3
  baud_rate: 9600

midea_dongle:
  strength_icon: true

climate:
  - platform: midea_ac
    name: "My Midea AC"
    visual:
      min_temperature: 16 °C
      max_temperature: 30 °C
      temperature_step: 1 °C
    beeper: true
    swing_horizontal: true
    outdoor_temperature:
      name: "Temp"
    power_usage:
      name: "Power"
    humidity_setpoint:
      name: "Hum"
  1. used the adapter to connect it to the AC:

the Logs now show this:


usually it just shows gibberish (as far as I’m concerned) and only shows readable values, if I send a command with the original IR remote control (like here)… also there’s that occasional yellow “RX: frame has unknown type” warning

What could I have done wrong?

EDIT:
The AC doesn’t do anything when I try to send a command via Home Assistant - the climate Lovelace card shows unavailable and if I try do select something there (for example a different fan speed) it just goes blank a second later

EDIT2:
the AC is Wifi enabled - it was sold as such and there was a “USB” plug connected where the ESP-01 is now

EDIT3:
tried “esphome_version: esphome:dev” … no change :frowning:

EDIT4: I doubt I need a logic level converter, since that’s what the adapter seems to do already - TX and RX to ground are almost 5V …

EDIT5:
It works now … I deletet everything from ESPhome and Home Assistant, re-flashed the ESP-01 and addet it again… I have absolutely no idea what is different now, since the configuration is exactly the same as before (except for the name)

1 Like

Your circuit board looks exactly the same as mine and has the same part-No - is that a Dimstal AC?!

So you use a logic level shifter?! I assume you have tried without?!

Did you have to do any special steps setting everything up?

Have you tried switching the brown and yellow duponts on the esp side (RX and TX)?

Yes I did that - the result is like that: Support for Midea A/C - #138 by BakaMonogatari

so there’s only “one” TX line and IR commands are not showing up.

At least I get TX and RX, which should mean, that it’s connected correctly :thinking:

Not that I look you noob (I’m not), but do you have connection between your ESP and your wifi network? (check your router log and ensure that the ESP is connected).

Also, have a try with the recommended settings (ie no !secret yaml, enter the wifi password directly into the esphome yaml). Also: have you set password for homeassistant api? If so, then disable it until you’re 100% sure that it’s not the root cause.