Midea branded AC’s with ESPhome (no cloud)

@tomasz_p Actually I have the Midea MHC-V22W/D2RN8 heat pump. So the proper way to connect to the Modbus is by using the A/B from wire controller or connector CN30, right?

image

Sorry for the terrible resolution.

@SavKoK I think it doesen’t matter what model you have because genuine Midea and all of it’s clones work the same way. I dont’ have manual for original Midea, but in Kaisa and also Clivet it’s shown the same way. Here you have part of the service manual of my unit. It’s clear:

1 Like

@tomasz_p This note that “wired controller is integrated” is what confuses me. I will check my heat pump and report back.

It says integrated because that’s where it’s mounted in the factory when it comes to the split units which i have. It can be taken from it and mounted wherever you want. In monoblock version it’s just a standalone item.

1 Like

I just read some registers on a MIDEA heat pump through Modbus. I just used the H1/H2 from wired controller as @tomasz_p recommended :slight_smile:

Address Meaning Description HEX Value DEC Value Comment
100 Operating frequency Compressor operating frequency in Hz.
Value read = current value
001B 27 Seems ΟΚ
101 Operation mode Unit’s operation mode,
0: shut down
2: cooling,
3: heating,
0003 3 Seems ΟΚ
102 Fan speed Fan speed, unit: rpm. Value read = current speed value 0208 520 Seems ΟΚ
103 PMV ODU electronic expansion valve opening, unit: P. Value read = current value (shows only 8 multiples. Only multiples of 8 will be shown) 00B0 176 Seems ΟΚ → 22*8
107 T4 temperature Outdoor temperature, unit: °C. Value read = current value 0010 16 Seems ΟΚ
118 ODU current Current ODU value, unit: A, Value read = current value 0005 5 Seems ΟΚ
119 ODU voltage ODU voltage value, unit: V. Value read = current value (reserved) 00E8 232 Seems ΟΚ → 230V = 1P
132 Unit target frequency Compressor target frequency in Hz. Send value = actual value 001C 28 Seems ΟΚ → Compared to 100 register
134 DC bus voltage Return value = actual value / 10 (Unit: Volts) 0039 57 Seems ΟΚ → 570VDC = 3P

I think the values seem reasonable.

Hi,

Since it already some time ago that information about Midea heat pumps using ESPHome/modbus is posted here, so let me do an update of the current state of my project.
My goal is to create an ESPHome based solution for Midea heat pumps and clones which can be used by others who do not have the time/capability to create such.

My son (electronics student) designed a small board which can be easily connected to the heat pump and I am working on to get all the registers available in Home Assistant and for some of them I want to be able to update the value.

The prototype of the board:

Most off the registers are working now, also those where multiple values are behind one register (bitmasks) and I am also able to turn on the DHW tank heater (register 7) and configure the leaving water temperature for zone 1 and zone 2 (register 2). Especially the last one was a bit harder to get right.

Being able to write to all the registers is now more a matter of implementing it, but I think also a lot should not be that easy settable by an ordinary user, so I have to see what to expose and not.

If somebody wants to see my current config, just sent me a message. I am not posting it completely here, since I am still working on, but it would be sad if you are spending a lot of time in things I already found out how it works :slight_smile:

3 Likes

Hi @Mosibi,
glad to hear that you’re working on this. I’d like to see your config.

1 Like

I’d love to have a look at your config also!
I briefly tried to get rs 485 comms working but alas had no joy. I suspect it was my esphome config that was at fault.

Also, love the pcb design!

1 Like

in mean time you can check mine: my github


it’s dirty and work in progress but functional, you may get some inspiration where to go next.
I didn’t care for zone2 yet as not using it

Also wating for @Mosibi config as I couldn’t progress without his help

1 Like

Hi Tomasz_p, when you say you’ve used D5 and D6 on the ESP are you refering to RX/TX0 ?

I’m using an ESP32 Dev Board and like yourself, just cannot get any comms working to the heatpump controller.

I’m currently using TX/RX1 set which should be GPIO 16,17. I have set the heatpump modbus device ID on the dial to 1, which should set it as device 1.
However im simply getting the same replies as you were via esphome, no response received.

Any ideas?

Is that this dial you are talking about?

As you can see, mine is set to 0 but I use 1 (0x1) as address. That surprised me a bit, I expected I had to use address 16 (according the docs). So my advice, try all the 16 addresses

i got it working the same way, just had to not use the normal uart pins. Odd, thanks for the insight though!
All up and running now, on my way adding a few more of the holding registers for switches etc

Hi all,

A week ago I made a post in this topic to let you know that I have a pretty okay working config for the Midea heat pump (and clones). A few of you helped me with advise on some settings and now I think it is time to share it with you all.

The project can be found here: GitHub - Mosibi/Midea-heat-pump-ESPHome

I you have suggestions, feedback or something else, then please let me know. And of course, pull requests on the config are very welcome!! :smiley:

2 Likes

I have an EMI I-verter mini split I-Verter Variable Speed Single Zone Ductless Split Systems | EMI RetroAire which is similar to Midea.

The display board has an empty area labeled wifi CN3. At first I thought this was the UART port but after soldering pins and connecting an esp8266 it would respond with exactly the same message being sent out. It was missing the usb port board so I ordered it, part 17222000A01170. 17222000A01170 Midea Display Box Subassembly

With that usb board I was seeing responces to the UART messages and was able to control temp and power via esphome. But the remote stopped working. Unplugging the usb board allowed the remote to work but it wasn’t working with it connected.

Looking at the boards posted by @nvschilleman (has a usb module) and @bartlebi (no usb module) and the display board I have I noticed that jumper J3 connects XT and REC together on the boards without an extneral usb module and is missing on the board with the module. Also noticed there is a signal on those two pins when the remote is pressed. Lastly @nvschilleman said the unit stops responding if the usb board is disconnected which is the opposite of what’s happening with my setup. So I de-soldered jumper/resistor J3 and it worked! Now I can have the usb board connected and it still responds to the remote and I can control it via esphome as well.

I did have to make a few changes to the MideaUART library used by the midea component because it would request power usage every 30 seconds even if there is no power usage config and in my case that caused the usb module to restart (led starts flashing) and it would lose communication for a few seconds. Also removed the network status reporting that the library did every 2 minutes since that also caused a temporary comm issue. Removed the preset check that stopped it from changing fan speeds if a preset was active because it would go into defrost on its own and that would block fan speed changes. Finally set the fan speeds to 30/50/80 instead of 20/40/60/80 since my unit used those instead.

Anyway, main point is if you have an empty CN3 connector that mentions wifi on it you can probably get the usb board and desolder J3 to make it work.

3 Likes

Display board front

1 Like

Hi @Mosibi,

I tried to use your code but after successful compilation and upload to the board I cant’ get any logs… I got error saying that there’s no connection via wifi.
Any suggestions?

If you want more logging output then you have now, change “logger.level” from “INFO” to “DEBUG” in heatpump.yaml and re-upload it.

And for your wifi, instead of using a secret file, you can directly place your ssid and password in there to see if that helps. It should open a fallback access point btw when the wifi client setup fails, the ssid and password for it are in the config file.

I don’t know the reason because my normal setup is working and using secrets - I didn’t change that.
Got it working now but i had to cut registers from number 200, as a matter of fact I dont need them.

But instead I’d like to use register 0 to choose from water temp flow control (bit 1) and room temp thermostat control (bit 0). Could you provide some clues?

Hi,

Took me a long time to figure things out.
For Vaillant Arovair, Bulex Genia Fan, Saunier Duval Genia Fan, Midea MKG series, and other Midea clones:
Old versions can be controller via Modbus with the PQE connection.
Newer ones (like mine) doesnt have the Modbus hardware anymore:

Only the XYE connection:
Via reverse engineering i can succesfull operate 5 units via XYE and RS 485 in a Loxone system.

XYE is basically an RS485 network:

I made an excel file to generate the 16 byte string for communication.
and also how to enter this into a Loxone RS485 system.

Unfortunately I’m not allowed to share excel files on this forum

Regards

Lieven

@tomasz_p

What you need for register 0, bit 0 and 1, is a “switch”. I just did that for bit 2 in my config and this change should make it clear for you what changes are needed.

See Added switch for register 0 bit 2 · Mosibi/Midea-heat-pump-ESPHome@51cc7f7 · GitHub for the change I made.

Regarding your other issue. If it works without the registers from the 200 range, i suspect it has something to do with the amount of storage available on your ESP32, but still it is strange that the compile phase went okay.