Midea branded AC’s with ESPhome (no cloud)

Yes, XYE seems the best way to go.

Some Units have a directly impelented Modbus-Port (PQE) that should work as well.

Maybe someone figures out, how to design a little circuit that works for the HA-HB interface as well :wink:
It seems to be described in this patent:
US20230239167A1 - Control method and control apparatus for communication device, and communication system and storage medium - Google Patents
or the Chinese (engl. translated) version
CN112556105B - Control method, control device, communication system and storage medium for communication equipment - Google Patents

For HAHB it do not think that it is that complicated as described in the document, but that the power is taken from the 2 wires over a transformer that blocks modulated differential signals from other sources and that there is enough dampening by capacitors, that the power-consumption ripples are much lower than the communication patterns.

I’m happy to help with both hardware development and testing for xye and pqe and ha-hb interface. Just i need some intro about hardware required. I’ve got minisplit inverter ac that’s midea under the hood. I posted photo of indoor wiring diagram in #1218 above but i only have display board currently. What’s exact part number for multifunction board?

For wall mounted splits AC with internal 12V connection this module is often used: (in this case as Bosch brandlabel)

This module is shipped with 2 wiring harnesses which are the same BUT does not have the adapter cable that connects the plug on the AC’s main control board pcb (CN32) with the harness (because Bosch unit come preinstalled?)

On my unit at home i use a kit that is almost the same as the Bosch.
At my unit the 12V (CN32) cable was not already mounted and shipped with the board, but i had to fully disassemble the unit to plug it into the right connector.
–>The wiring between CN32 (main control board) and CN43 (multifunction/adapter board) is split into 2 cables.

(My unit: Midea All easy Blue == Xtreme Save Blue)

My module was sold as MFB-C and is shipped with the missing 12V cable (for me the other wiring looked the same incl. same poliarity as the bosch labeled, PCB has same ID sticker!)
The bad thing is, that i need the box formfactor like the bosch module has, but MFB-C is some other formfactor. If i have some time in the next days, then i print a housing.

@DjordjeMandic thanks a lot for your investigation! You added another brandlabel for that kind of AC - i was not aware that Midea is behind some Samsung variants too…

Indoor Fan Speed RPM Query

For the AR12TXHQASINEU AR3500 mini-split, operating at 23°C in heating mode with a maximum airflow of 540 m³/h, we can estimate airflow at different fan speeds based on proportional RPM scaling. This approach gives us the following approximate values:

Fan Speed and Corresponding Airflow Rates (approximately)

Mode IF Parameter (HEX) Indoor Fan (DEC) RPM Approximate Airflow (m³/h)
Silence 41-42 65-66 650-660 RPM ~280 m³/h
Low 47-48 71-72 710-720 RPM ~305 m³/h
Medium 5B-5C 91-92 910-920 RPM ~390 m³/h
High 6F-70 111-112 1110-1120 RPM ~475 m³/h
Boost/Turbo 7D-7F 125-127 1250-1270 RPM ~540 m³/h

Calculating Power Transfer and COP

With measurements of inlet and outlet air temperature, humidity, pressure, and airflow, you can calculate the power transferred to the air using:

P = density × flow rate × specific heat × ΔT

Here:

  • Power Transferred to Air (or Power Output) can be calculated from airflow and temperature difference.
  • Power Input can be read directly from an electricity meter.

For instance, with an airflow of 540 m³/h in turbo mode, my manual calculation (using only ΔT and airflow) resulted in a power output of 4.16 kW at 2°C outdoor temperature, while drawing approximately 1.3 kW from the wall, yielding a COP of ~3.2.

Inquiry Mode and Accessing RPM Data

These fan speeds were obtained manually using the IF parameter in inquiry mode. I’m exploring whether there’s a way to read RPM directly via UART or XYE/Modbus protocols.

While the unit has a built-in fan RPM sensor that could be tapped for direct readings, there may be a simpler way to access this data. If anyone has experience with accessing RPM values through these protocols or knows whether COP and EER are directly reported by the unit, that information would be helpful.

1 Like

Hello. I have a Saunier Duval fan coil, manufactured by Midea, and I have been able to connect via modbus and read the registers from 1601 to 1640. But I don’t know what they mean. I have seen this post https://community.home-assistant.io/t/midea-branded-ac-s-with-esphome-no-cloud/265236/805?u=pocoyo, but I can’t find any more information. Can anyone tell me where to find more details? Thanks.

Hi folks,
Im looking for your input…
I currently have the Senville 24K central HVAC (MIDEA Manufactured). It comes with the KJR-120X Thermostat, same as dydx I believe. Now I’m wondering, what hook up option would be the best considering I want HA to overide temp settings over thermostat and vice versa when each is used? Or is that no possible?

The two options are:

Option 1:
Use the HAHB ports (I beleive they are supplied with 12v as thermostat doesnt have power supply) with TTL Serial Port to RS485 and hook up to ESP32 or raspberry PI. According to this Midea branded AC’s with ESPhome (no cloud) - #1063 by exciton , post from Exciton the 12V was hooked up to the TTL converter directly?

Option 2: Use the 485COM port on the thermostat with ESP32 ( ESP-WROOM-32) and from what I understand I need a level shifter as well?

I have not explored the board of the HVAC indoor unit , but I beleive the options would be pretty much the same ports.

@exciton , @topdog360 , any input ?

Thanks guys !

Hello @th4h4x ,

I was previously blocked due to “new user” restrictions so i was not able to reply earlier, but they now seem to be lifted.

Your display appears to have a HAHB Bus connection, which combines power and data. As far as I know, there is currently no way to interact directly with the bus. On your display, the IC for the XYE (485) signal conversion is not populated, so your red-marked connector should not have any connection (IC200). Diode 203 or the 0 Ohm resistor 201 are also missing.

Thank you for your photo—your wired remote is the third variant of how the PCB can be populated (HAHB and XYE 5V, XYE 12V variant).

I recommend looking inside your unit to see if there is a USB connector (serial port with USB plug) or if the display has any signs of that port. Does your unit have any sticker with a wiring diagram on it?
Did you search the internet, which Midea model is nearly the same as yours? Which manufacturing date do you have?

Best regards, Fabian

@fabius
Thanks for your reply,

Here is the board, it also has HAHB, EYX and S-485 com port. I thought someone made it work up the thread with EYX ?


Could you provide some photos of the installation?

Hello @th4h4x ,

I am not 100% sure whether XYE is the Midea type bus, and if 485 is really Modbus or just another plug to XYE with additional power (due to the unpopulated chips near that connector). Since there is an adapter/board variant for XYE connection, I would measure if the port is really low voltage logical level and use the described circuit board for XYE.

Does your Midea remember it’s heat vs cool state when you turn off and then turn on the unit through esphome? Or does it default to one or the other?

@poldim If you’re using uart based component then it does. Its always in sync even when you change stuff via remote. I guess that it’s the same via xye also

@fabius, @dbaq, @brianHa, @th4h4x, it’s amazing to see that there are a few people with the same machine and desire!!

For me, heating season is just starting and I was out for a year but last year, info and people with XYE were pretty sparse and eventually I forked @exciton 's code and was able to patch it a bit for my US version. Also, I think “Follow Me” was always working. At least, if I had it enabled on the wired controller. I need to catch up again on the topic but I got a few questions:

  1. Is there any recent XYE repository I can look at?
  2. It really pisses me off that when turned off, the display of the wired controller is blank and current temperature is not shown. Is this the case for you as well? Is there any known workaround? Showing the current temperature, even when off, is just super important.
  3. For me, the system often ignores the set point and won’t turn off. It drives me nuts! For example, if I have the set point at 65F, it would just continue to run! Today it kept going for over an hour, even to 66F (beyond the set point). I have to reduce the setpoint by at least 5F and turn off/on again until the nightmare ends. Is anyone else of you suffering from similar issues?

I know 2-3 are not related to XYE but since I have interested people with the same hardware here I thought I may ask. My installer is highly incompetent and doesn’t know sh** about this hardware (or HVAC in general, for that matter). I also asked in other places but I haven’t found anyone yet who knows anything about these ductless Midea clones.

PS: If XYE would once be fully reverse-engineered, my dream/hope would actually be to replace this stupid, ugly 90’s style wired controller with a small ESP+LCD+buttons+TempSensor or so. Could have multiple and they communicate directly via Wifi. No cables necessary. Receiving end is an Atom RS485 adapter directly wired to the air handler unit and bridging all data via XYE.

Hi all, I’m using an ESP32-C3 on a Bosch 3000i and it works great.
Yesterday I had the idea to add a counter to measure how long the air conditioner has been on, using the “duty_time” sensor, but it doesn’t seem to work, can someone tell me where I’m going wrong?
Here’s my yaml:

esphome:
  name: bosch-climate-3000i
  friendly_name: Bosch Climate 3000i
  area: Cucina

  on_shutdown:
    then:
      - midea_ac.power_off:

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: arduino
    version: 2.0.17

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: "UKCAmFVwyCyhdOUMAymnYnx+vkymNo9cyirrteNOklI="

ota:
  - platform: esphome
    password: "5301b4924b12e50ccd54327287fc9036"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  output_power: 8.5

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Bosch-Climate-3000I"
    password: "c223vn7adRYM"

status_led:
  pin:
    number: 8
    inverted: true

captive_portal:

# UART settings for Midea dongle (required)
uart:
  tx_pin: 21         # hardware dependant
  rx_pin: 20         # hardware dependant
  baud_rate: 9600

# Main settings
climate:
  - platform: midea
    name: "Cucina"         # Use a unique name.
    period: 1s                  # Optional
    timeout: 2s                 # Optional
    num_attempts: 3             # Optional
    autoconf: true              # Autoconfigure most options.
    beeper: true                # Beep on commands.
    visual:                     # Optional. Example of visual settings override.
      min_temperature: 17 °C    # min: 17
      max_temperature: 30 °C    # max: 30
      temperature_step: 0.5 °C  # min: 0.5
    supported_modes:            # Optional. All capabilities in this section may be detected by autoconf.
      - FAN_ONLY
      - HEAT_COOL
      - COOL
      - HEAT
      - DRY
    custom_fan_modes:           # Optional
      - SILENT
      - TURBO
    supported_presets:          # Optional. All capabilities in this section may be detected by autoconf.
      - ECO
      - BOOST
      - SLEEP
    custom_presets:             # Optional. All capabilities in this section may be detected by autoconf.
      - FREEZE_PROTECTION
    supported_swing_modes:      # Optional
      - VERTICAL
      - HORIZONTAL
      - BOTH
    outdoor_temperature:        # Optional. Outdoor temperature sensor (may display incorrect values after long inactivity).
      name: "Temp"

remote_transmitter:
  pin:
    number: 10
    inverted: true
  carrier_duty_percent: 50%

switch:
  - platform: template
    name: "Climate Cucina Beeper"
    icon: mdi:volume-source
    restore_mode: 'RESTORE_DEFAULT_ON'
    optimistic: true
    turn_on_action:
      midea_ac.beeper_on:
    turn_off_action:
      midea_ac.beeper_off:

binary_sensor:
  - platform: status
    name: "Climate Cucina Connection Status"
    id: climate_cucina_connection_status
  
  - platform: homeassistant
    name: "Power"
    entity_id: climate.bosch_climate_3000i_cucina
    id: tempo_acceso

text_sensor:
  - platform: template
    name: "Uptime Human Readable"
    id: uptime_human
    icon: mdi:clock-start

  - platform: version
    name: "Climate Cucina ESPHome Version"
    id: climate_cucina_esphome_version

  - platform: wifi_info
    ip_address:
      name: "Climate Cucina IP Address"
      id: climate_cucina_ip_address
      icon: mdi:ip-network

sensor:
  - platform: uptime
    name: "Uptime Sensor"
    id: uptime_sensor
    update_interval: 60s
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: uptime_human
            state: !lambda |-
              int seconds = round(id(uptime_sensor).raw_state);
              int days = seconds / (24 * 3600);
              seconds = seconds % (24 * 3600);
              int hours = seconds / 3600;
              seconds = seconds % 3600;
              int minutes = seconds /  60;
              seconds = seconds % 60;
              return (
                (days ? to_string(days) + "d " : "") +
                (hours ? to_string(hours) + "h " : "") +
                (minutes ? to_string(minutes) + "m " : "") +
                (to_string(seconds) + "s")
              ).c_str();
    
  - platform: homeassistant
    name: "Follow Me"
    entity_id: sensor.lumi_lumi_weather_temperatura # Sensor from HASS - replace with your own - highly recommended to use (otherwise delete sensor section, or it will not work correctly) - Provides ability for AC unit to use your, external sensor from HomeAss as a main sensor
    id: follow_me
    internal: true
    filters:
      - throttle: 10s
      - heartbeat: 2min             # Maximum interval between updates.
      - debounce: 1s
    on_value:
      midea_ac.follow_me:
        temperature: !lambda "return x;"
        beeper: false               # Optional. Beep on update.

  - platform: wifi_signal
    name: "Climate Cucina WiFi Signal"
    id: climate_cucina_wifi_signal
    update_interval: 30s

  - platform: copy
    source_id: climate_cucina_wifi_signal
    name: "Climate Cucina signal percent"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "%"
    entity_category: "diagnostic"
    device_class: ""

  - platform: internal_temperature
    name: "Internal Temperature"
    icon: "mdi:thermometer"

  - platform: duty_time
    name: "Tempo acceso"
    sensor: tempo_acceso

time:
  - platform: sntp
    id: my_time
    timezone: Europe/Rome
    servers: 
      - 192.168.1.1
      - 0.pool.ntp.org
      - 1.pool.ntp.org

button:
  - platform: restart
    name: "Climate Cucina Restart"
    id: climate_cucina_restart
    icon: "mdi:restart"

  - platform: shutdown
    name: "Climate Cucina Shutdown"
    id: climate_cucina_shutdown

  - platform: safe_mode
    name: "Climate Cucina Safe Mode"
    id: climate_cucina_safe_mode

  - platform: factory_reset
    name: "Climate Cucina Factory Reset"

  - platform: template
    name: "Swing Step"
    icon: mdi:tailwind
    on_press:
      midea_ac.swing_step:

  - platform: template
    name: "Display Toggle"
    icon: mdi:theme-light-dark
    on_press:
      midea_ac.display_toggle:

web_server:
  port: 80
  version: 3
  local: true

For units like the ‘slim duct’ model where the room temperature value is taken from the T1 sensor (incoming air stream), ‘Follow Me’ mode is pretty much required to have it cool/heat the room accurately. Many non-ducted units likely also work better with ‘Follow Me’ used, because the temp is actually being sensed at the remote, which isn’t high on the wall or near where air is moving in/out of the unit.

I have a 18K ducted model (Pioneer rebadge) in the attic that is responsible for 3 bedrooms, and it is generally pretty good with the following tweaks:

  • An ESP8266 in the attic connected to XYE (read-only) and an IR LED that is aimed at the control board to set modes/temp and provide the critical “follow me” value
  • Another ESP device in one of the bedrooms using a Dallas temp sensor to provide room temp, which are sent via the above ESP as “follow me” values at 60 second intervals
  • Some basic rounding/ceiling floor tweaks to the room temp (one decimal place) → follow me value (no decimals), in Fahrenheit. These use some of the XYE sensors:
    • In cool mode, if running, send the floor of the actual temp, otherwise the ceiling
    • In heat mode, if running, send the round of the temp, otherwise the floor
  • My 5-wire thermostat sits unused (and ugly) on the wall

There’s still some strange behavior where these units try to be too smart for their own good. In heat mode, mine strongly prefers to run at a low-power level (~500W), and it will happily let the temp drift about -2F from the setpoint before it kicks into high gear (1000W+), where it can overshoot a bit (+1F). Turbo/boost mode will force it to this high gear if I send that IR instruction.

In cool mode, without adjustments, it normally takes about a +3F setpoint delta to turn on, and it will overcool to -3F. My tweaks above bring that delta much closer to +/-1F, which makes a big difference. Again, turbo mode makes it more responsive to the actual setpoint delta.

My ESP for the remote temp sensing also has an LCD display that shows key XYE values, and I’ve debated adding some basic buttons to make it a DIY thermostat. The algorithm could also be tweaked a bit to force turbo mode and/or lie about the room temp to get the unit to ignore its own stupid algorithms, but I’ve gotten it close enough to where I wouldn’t want to lose the effeciency of running at lower power by forcing it to be more of a on/off type unit.

The newest 4-wire thermostats actually look pretty good, but I like how I have mine set up now

If you have a wired XYE controller, you can set up an RS485 listener to decode the messages sent and received to reverse engineer the protocol. It will have to only listen though - can’t have two masters on one bus.

Thanks! I have the Carrier 38MBRCQ36AA3 with 40MBABQ36XA3 which is a “ductless” Midea, even though it’s installed ducted. This device supports 24V thermostat interface and my installer installed an EcoBee. That one I can connect flawlessly via HomeBridge.

However, I feel that using the 24V interface (contrary to claims on the web) reduces the variable speed system to a single stage: It only runs full (or in 2 steps) and tends to be loud. With the HA/HB controller I feel it runs less noisy. But also it runs pretty much all the time and runs way beyond my set point. As I said, sometimes I need to decrease the set point by many degrees and turn off and on again to make it shut up. Do you have the option for 24V thermostat too?

An ESP8266 in the attic connected to XYE (read-only)

What does this ESP do? What’s the point of just reading from XYE?

and an IR LED that is aimed at the control board to set modes/temp and provide the critical “follow me” value

That’s where I am getting confused. For what? Doesn’t the thermostat have an integrated temperature sensor? I can just enable “Follow Me” on my KSACN1001AAA which, if I understand correctly, sends the temperature from the wall to the control board via HA/HB interface.

Also, do you have a picture of your control board? My control board is in the air handler. My thermostat (KSACN1001AAA) has an IR receiver and I also have a wireless remote control but I don’t see the point since the thermostat has the thermometer anyway (to my understanding)

  • My 5-wire thermostat sits unused (and ugly) on the wall

What interface if 5-wire exactly? 24V legacy interface?

The newest 4-wire thermostats actually look pretty good, but I like how I have mine set up now

Is it this one? Why do you call it “4-wire”? It’s HA/HB interface…
Seems very similar to my KSACN1001AAA. I’d be really curious if this one can show the current temperature even when turned off. I am so mad that mine just shows a blank display when turned off…

@exciton

If you have a wired XYE controller, you can set up an RS485 listener to decode the messages sent and received to reverse engineer the protocol. It will have to only listen though - can’t have two masters on one bus.

What do you mean exactly by “wires XYE controller”? Is this a device that can be purchased?

That was my assumption about that add-on module (Pioneer sells one, but I don’t own it.) It makes these variable speed, inverter-driven compressor minisplits act more like the bang-on/bang-off traditional split systems that are still common in the USA.

I can get access to some (I wish for more) data from the unit’s sensors and control logic. Namely, T1 (air in temp), T2 (indoor coil temp), T4 (outdoor coil/air temp), compressor run/defrost state, and actual fan speed in auto mode. I have my EPA 608 Type 2, and these sensors help me to understand what the unit is actually doing and how to work around its crazy logic.

My unit came with the biggest POS ‘thermostat’ Midea makes (KJRC-12B), which is really just a wired IR remote. There’s no communication back to the thermostat (besides on/off), and the ‘Follow Me’ never worked correctly. It also doesn’t receive IR like some of the newer thermostats do.

The controller just sends the IR commands over 2 of the wires, and there’s literally an IR LED sitting on the ‘display board’ that shines over to the IR receiver on the same board.


5wire-board

Midea units have numerous control options, and some units implement a subset of these. Midea doesn’t even have universal names or circuit board connector ID numbers for these. This forum thread also has posts that reference different types; here’s my attempt at a breakdown:

  • 5-wire: IR over the wire, basically
  • 4-wire: RS-485 (2 wires), and 5V/12V +/- (2 wires)
  • HA/HB (2 wire): modbus?
  • XYE (3 wires): RS-485 (2 wires), ground (1 wire)
  • UART
  • LNS: high voltage modulated signal between indoor/outdoor

Nobody has confirmed if some of these ports can handle multiple protocols or what overlap there is. I’m hoping someone with a modern 4-wire controller (KJR 120N/M) could sniff the RS485 lines and see if it talks the XYE-protocol, modbus or something else. If it talks XYE-protocol, there’s some functionality that hasn’t been documented yet.

Look for midea CCM (centralized controller) units (I have one in the picture above.) I believe the XYE protocol documented on the codberg site was sniffed from one of these, so it’s mostly just basic query/set commands. If the 4-wire controllers also speak XYE, there’s more set/query commands to sniff that aren’t documented anywhere.

Im trying to find which pins correspond to potential ground, vcc,tx and rx and making sure if its 3.3v or 5v. But none of those pins (EYX or the S485) give me a ground to the ground screw right besides the board… Im confused…

Tho this is what I found (from top to bottom)

E(suppossedly ground?) Is linked to 485 pin 1(if + polarity) and 2 (if - polarity on the probes)

Y is linked to 485 pin 3

X is linked to 485 pin 4.

Neither pin 1 ,2 or E give me ground on the ground
How is that possible ?

I would like to read those pins with Rasp.Pi eventually and figure out if there might be a kernel behind all this… Any thought on the pins multimeter reading ?

Yours looks like exactly my board! (Carrier 40MBABQ36XA3). I have just tried measuring this myself yesterday and accidentally shorted my test leads. The good news: It seems to have short protection. I heard a relays switching quickly and the whole machine turned off. I flipped the breaker, then turned it back on and the system still seems to work as normal. Didn’t continue because it was late and cold.
My intention was to get +12V for supplying ESP32.

What did you measure exactly? Resistance measurement when unit turned off?

Question: Are you suggesting the blue and cyan pins are shorted/connected? Did you confirm? I was wondering already if the “S-485” connector is a different interface than EYX but it seems you assume it’s just the same with a different connector?

PS: There is no RX or TX in RS485. It’s a differential interface that carries data both ways. So technically not even ground would be needed.