Midea A/C via local XYE

Yeah my unit seems to have 2 separate buses, both electrically RS485:

  • CN9 XYE “to CCM comm. bus”
  • CN40 to “wire controller”, optionally daisy chained via WiFi adaptor

I got some photos of the terminals and the wiring diagram inside the unit, which is the complete version from Midea rather than the “sanitised” version from Actron Air in my case.

I’m guessing that the CN20 link from indoor to outdoor unit is also electrically RS485. Now I am also tempted to sniff this and see if it reveals some interesting data (e.g. outdoor fan speed, compressor speed, EEV opening angle).

Ah hah. Ok.
My RS485 connector I’m using, which you call CN40, is labeled CN14 on my unit. (Name not visible in this pic, but I saw it in another - it’s the one on the bottom right with the red connector)

And here’s my circuit diagram for reference:

So your CN9 would be my CN3. And you’ve tested both sets of wiring and you get different results on the CN9… Interesting.

I’m not sure how mine is, and I’m kinda feeling a bit lazy haha. Whatever the case is, my plan is to keep using the extended functionality - I don’t think C6 will work on your CN9 if C4 errors out, as they seem “releated”

Having the compressor duty cyle or speed would be fine, but I can infer that from the output temps too. Now the unit does a LOT less work than it was before using the 24V setup and it’s just as nice if not nicer in here.

-Matt

I am happy to see you progressing this.

I have a ducted minisplit that is senville branded. I have spent an unbelievable amount of time working on this myself. My home had an addition that was not ducted with the main central heat pump, so we had a mini split installed. The thermostat is on the same wall our fireplace is on, and the addition is all windows, so it gets very cold in the winter towards the back of the addition where we sit. I wanted to do a remote mounted temp sensor (which i use to control our fireplace) to control the minisplit to make everything work in sync and provide interlocks so someone isn’t turning on the main unit heat, and running ac out in the addition.

There are a LOT of threads out there about the midea communications. My unit had a wall thermostat that was 5 wire. Most of the threads talk about the 4 wire thermostats. My unit has multiple communication busses. I have tried to switch to the 4 wire thermostat and an esp32 connected to the remote unit in the crawl space that is connected to the older 5 wire thermostat. I removed the Tsop from that board and hard wired the esp32 to send IR follow me commands, then using the uart through a level shifter to set the temp, control on and off, and such, however I don’t fully feel its working properly. The unit never actually shuts the fan down. It does ramp, I do have it regulating temp, but the fan never shuts down when the fan is set to “auto”

Now knowing what I do now and understanding how the follow me commands work, I should have just removed the temp sensor from the internal board, used a digital pot to control the temp remotely. It probably would have been a lot easier.

The issue I have is once I switched to the 4 wire thermostat, it will only display Celsius. I have contacted Senville, they sent me a second thermostat for free saying that it should display Fahrenheit but it doesn’t. I spent a lot of time on the phone with the tech support about it and it was never resolved.

It also seems as though the uart is expecting *C where as the IR commands are sent to the receiver board as *F and displays *F

I have not found a way to do the follow me commands with UART that completely bypasses any IR commands. I can’t use the 5 wire thermostat because it doesn’t update when the esp32 changes the the set temp via uart because it does not have 2 way communication it appears.

I would like to dig into the rs485 side of things because it seems as though that is the only communication protocol that does everything. I don’t understand the logic of all of these different communications especially when they do not all talk to each other.

My board has RS485 marked on it, and its been a little while but I believe it says xye as well somewhere. I will continue to follow this thread!

It finally got cold enough here to catch a defrost cycle in my logs. Bit 2 of byte 24 (0x18, “field 25”)

05:20:00: <<< AA:C0:00:00:00:00:30:10:84:00:14:XX:XX:XX:XX:00:00:00:00:03:00:00:00:00:00:00:00:00:00:00:XX:55
                :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :19:  :  :  :  :  :  :  :  :  :  :  :
05:28:19: <<< AA:C0:00:00:00:00:30:10:84:00:14:XX:XX:XX:XX:00:00:00:00:02:00:00:00:00:00:00:00:00:00:00:XX:55
                :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :24:  :  :  :  :  :  :
05:28:38: <<< AA:C0:00:00:00:00:30:10:84:00:14:XX:XX:XX:XX:00:00:00:00:02:00:00:00:00:02:00:00:00:00:00:XX:55
                :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :19:  :  :  :  :  :  :  :  :  :  :  :
05:28:40: <<< AA:C0:00:00:00:00:30:10:84:00:14:XX:XX:XX:XX:00:00:00:00:00:00:00:00:00:02:00:00:00:00:00:XX:55
                :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :19:  :  :  :  :  :  :  :  :  :  :  :
05:28:57: <<< AA:C0:00:00:00:00:30:10:84:00:14:XX:XX:XX:XX:00:00:00:00:01:00:00:00:00:02:00:00:00:00:00:XX:55
                :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :19:  :  :  :  :  :  :  :  :  :  :  :
05:29:27: <<< AA:C0:00:00:00:00:30:10:84:00:14:XX:XX:XX:XX:00:00:00:00:00:00:00:00:00:02:00:00:00:00:00:XX:55
                :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :19:  :  :  :  :  :  :  :  :  :  :  :
05:29:39: <<< AA:C0:00:00:00:00:30:10:84:00:14:XX:XX:XX:XX:00:00:00:00:02:00:00:00:00:02:00:00:00:00:00:XX:55
                :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :24:  :  :  :  :  :  :
05:30:08: <<< AA:C0:00:00:00:00:30:10:84:00:14:XX:XX:XX:XX:00:00:00:00:02:00:00:00:00:00:00:00:00:00:00:XX:55
                :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :  :19:  :  :  :  :  :  :  :  :  :  :  :
05:30:17: <<< AA:C0:00:00:00:00:30:10:84:00:14:XX:XX:XX:XX:00:00:00:00:03:00:00:00:00:00:00:00:00:00:00:XX:55

And the protect flags already have entities exposed, yay! So in HA this sequence looks like:

Meanwhile, I am having great success modulating the compressor’s speed via C6 feels like messages. This is consistently behaving the same as it was via IR. The new trick I’ve figured out is a simpler and more robust way to increment & decrement the compressor speed via a specific sequence of feels like values in quick succession. My new technique also works in heating mode, which I never got working properly before.

Aside from interacting better with my custom PID thermostat / VAV zone controller, this would enable more precise tracking of surplus solar PV production as it effectively commands a ~200W increase/decrease of power consumption.

For beeper?
beeper=true
Not work

That variable appears to be left over from copy/paste. My system never beeps on control via RS485.

To me this is desirable. I didn’t know how to prevent it from beeping when controlling via IR.

Hi Matt,

I am a bit of a newbie here. While I feel comfortable with all kinds of wiring, and some coding, I get a bit lost with this hardware. I understand that the reference to the hardware you made is the RS485 that connects to the XYE terminals on the AC unit. However, I guess we would also need something to send this through wifi to the Home Assistant machine right? I am quite overwhelmed by the amount of boards available. Any advice?

Thanks in advance, and a lot of kudos, you seem to have already decoded most of the signals.

I suggest M5 Atom Lite with one of their RS485 interface boards, which all include a 4 wire terminal block that easily wires in and powers it from the 12V DC supply to the wall controller. The “Tail485” variant is particularly neat and compact, perfect for this application.

Full bill of materials:

1 Like

Do I need RS485 port on motherboard or I can use XYE terminals? All I found on my HVAC motherboard is XYE along with wifi 4 pin connectors. That’s duct Midea DCTB-48R32IVT unit

Interesting work. I use an earlier version connected to the XYE port on my Midea 24K (Panasonic branded) ducted heat pump hooked up to Home Assistant. It meets my needs but what I am really interested in is defrost control. I think this represents the best opportunity for improving efficiency. It seems to me that manufacturers use an overly aggressive defrost strategy to reduce the likelihood of problems. I also have a Midea minisplit and can tell you that its defrost logic is very inefficient often defrosting with no frost on the coil (and of course turning on the 150 watt pan heater!). Any progress in that direction would be of great interest.

I’ve noticed that my system does a defrost every second time it cycles on in heating mode. Turning it “off” in between cycles suppresses this behaviour and has been a big efficiency win in my mild climate.

I’m not sure how to suppress defrost during continuous operation though.

This will be our first winter so I will be testing out some different ideas if the weather gets cold enough - we spend from mid-Nov to Apr in Mexico. I actually used the DRY mode for AC. I found that in COOL the unit had excellent temperature control but often cycled frequently - like every 4 minutes. I just cycled it between OFF and DRY with an HA thermostat. This worked very well. Dry mode had a very uniform output - around 700 watts. I will test out a few ideas but really what is needed is an HA defrost control. I have added additional temperature sensors to the outside coil and know from past experience that it is quite easy to get a very good read of frost formation. Any ideas in that direction would be of great interest…

I recently installed a new HVAC system in my home. Its a Mr. Cool MVP-36-HP-MUAH-230A00-O. This model is not a mini split, but a “normal” air handler. The air handler has an XYE port on it so I wired up an ESP32 using @mdrobnak 's client_id branch. Very impressive work, folks!

I have found the coil temperature sensor somewhat inaccurate. I was hoping that I could use the follow me function to feed the esp32 temperature information from another temperature sensor in the house. Is that possible? Any direction on how to set something like that up?

I would be glad to assist development in any way that I can including testing new branches, logging output, etc. Please just let me know. Thanks again everyone who has contributed.

Where did you find the XYE port on that board? Was there a clearly marked XYE port? I also have a hybrid mini split outdoor / air handler indoor set up that is Midea OEM and trying to figure out where I could plug into as doesn’t seem to have an XYE port.

Does anyone know if these other signaling ports found in Midea boards with S1/S2 and PQE labeling are the same thing as XYE - or are they a different protocol?

Sorry I’ve been busy with life fun…

You can do the follow me action with a senior already with the code I’ve been using for the last few months.
Seems like it got rebooted 25 days ago (or crashed 25 days ago) but automatically recovered…

I’m away from being able to get at my config for a few days but will update this thread this weekend.

-Matt

My board appears to have a few different comms buses.

But yes, there is an explicitly labeled XYE port that I am using. There is another port where the “wall controller” plugs in. If you look on page 45 of this manual, it shows the connections on the boards inside of the unit. You can see I have an XYE, but also an S1/S2 (for outside), and a HA/HB for the wall controller (which I am not using)

See here for info on the “follow me” code for esp32 w/ MRCOOL Hyper Heat 2nd Gen. Still working on getting it figured out myself. Hooked it up with the esp32 atom lite but not able to query the data

substitutions:
  name: midea-xye-48bbf4
  friendly_name: Midea XYE 48bbf4
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}

api:
  encryption:
    key: FIXME
  services:
    - service: follow_me
      variables:
        temperature: float
      then:
        midea_ac.follow_me:
          temperature: !lambda "return temperature;"
          beeper: false


esp32:
  board: esp32dev
  framework:
    type: arduino



wifi:
  use_address: FIXED_IP_HERE
  ssid: !secret wifi_ssid
  password: !secret wifi_password


ota:
  - platform: esphome

# Enable logging (but not via UART)
logger:
  #baud_rate: 0
  #logs:
  #  component: ERROR

# url: https://github.com/exciton/esphome
external_components:
  - source: github://mdrobnak/esphome@delays
    components: [midea_xye]
    refresh: 0s
  
# UART settings for RS485 converter dongle (required)
uart:
  tx_pin: GPIO17
  rx_pin: GPIO16
  baud_rate: 4800
  debug: #If you want to help reverse engineer
    direction: BOTH
    #dummy_receiver: true
    #after:
    #  delimiter: [0x55]


# Main settings
climate:
  - platform: midea_xye
    name: Heatpump
    period: 1s                  # Optional. Defaults to 1s
    timeout: 200ms              # Optional. Defaults to 100ms
    beeper: false               # Optional. Beep on commands.
    #default_target_temperature_low: 18°C
    #default_target_temperature_high: 24°C
    #custom_auto: true
    use_fahrenheit: true
    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. 
      - FAN_ONLY
      - HEAT_COOL              
      - COOL
      - HEAT
      - DRY
    supported_presets:      # Optional
      - BOOST
    outdoor_temperature:        # Optional. Outdoor temperature sensor
      name: Outside Temp
    temperature_2a:             # Optional. Inside coil temperature
      name: Inside Coil Inlet Temp
    temperature_3:
      name: Outside Coil Temperature
    timer_start:                # Optional. On timer duration
      name: Timer Start
    timer_stop:                 # Optional. Off timer duration
      name: Timer Stop
    error_flags:                # Optional.
      name: Error Flags
    protect_flags:              # Optional. 
      name: Protect Flags
    static_pressure:
      name: Static Pressure
      min_value: 0

sensor:
  - platform: homeassistant
    entity_id: sensor.tp357s_5ebf_temperature
    id: hallway_thermostat_follow_me
    name: "Hallway Temperature Sensor"
    filters:
      - throttle: 10s
      - heartbeat: 1min
      - debounce: 1s
      - lambda: return (x - 32.0) * (5.0/9.0);
    on_value:
      midea_ac.follow_me:
        temperature: !lambda "return x;"
  - platform: wifi_signal
    name: ${friendly_name} Wi-Fi Signal
    update_interval: 60s
  - platform: uptime
    name: "Uptime"
    id: uptime_sec
    internal: true
  - platform: template
    name: ${friendly_name} Uptime Days
    lambda: |-
      return (id(uptime_sec).state/60)/60/24;
    icon: mdi:clock-start
    unit_of_measurement: days
    update_interval: 60s

That is what I’m using as my current config and hopefully should get you somewhere…

-Matt