Midea Air Conditioner

The midea component creates a Midea air conditioner climate device.

Note

This protocol also used by some vendors:

Control is possible with a custom dongle. Example of hardware implementation is IoT Uni Dongle.

# Example configuration entry

# Disable logging over UART (required)
logger:
  baud_rate: 0

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

# Main settings
climate:
  - platform: midea
    name: Midea Climate         # Use a unique name.
    transmitter_id:             # Optional. Add this option to use IR transmitter.
    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:            # All capabilities in this section detected by autoconf.
      - FAN_ONLY                # This capability is always used.
      - HEAT_COOL
      - COOL
      - HEAT
      - DRY
    custom_fan_modes:
      - SILENT
      - TURBO
    supported_presets:          # All capabilities in this section detected by autoconf.
      - ECO
      - BOOST
      - SLEEP                   # This capability is always used.
    custom_presets:             # All capabilities in this section detected by autoconf.
      - FREEZE_PROTECTION
    supported_swing_modes:
      - VERTICAL                # This capability is always used.
      - HORIZONTAL
      - BOTH
    outdoor_temperature:        # Optional. Outdoor temperature sensor (may display incorrect values after long inactivity).
      name: Temp
    power_usage:                # Optional. Power usage sensor (only for devices that support this feature).
      name: Power
    humidity_setpoint:          # Optional. Indoor humidity sensor (only for devices that support this feature).
      name: Humidity

Configuration variables:

  • id (Optional, ID): Manually specify the ID used for code generation.

  • uart_id (Optional, ID): Manually specify the ID of the UART Bus if you want to use multiple UART buses.

  • name (Required, string): The name of the climate device.

  • transmitter_id (Optional, ID): Set if you use Remote Transmitter component for IR commands transmit.

  • period (Optional, time): Minimal period between requests to the appliance. Defaults to 1s.

  • timeout (Optional, time): Request response timeout until next request attempt. Defaults to 2s.

  • num_attempts (Optional, integer 1-5): Number of request attempts. Defaults to 3.

  • autoconf (Optional, boolean): Get capabilities automatically. Allows you not to manually define most of the capabilities of the appliance. Defaults to True.

  • beeper (Optional, boolean): Beeper feedback on command. Defaults to False.

  • supported_modes (Optional, list): List of supported modes. Possible values are: HEAT_COOL, COOL, HEAT, DRY, FAN_ONLY.

  • custom_fan_modes (Optional, list): List of supported custom fan modes. Possible values are: SILENT, TURBO.

  • supported_presets (Optional, list): List of supported presets. Possible values are: ECO, BOOST, SLEEP.

  • custom_presets (Optional, list): List of supported custom presets. Possible values are: FREEZE_PROTECTION.

  • supported_swing_modes (Optional, list): List of supported swing modes. Possible values are: VERTICAL, HORIZONTAL, BOTH.

  • outdoor_temperature (Optional): The information for the outdoor temperature sensor.

    • name (Required, string): The name of the sensor.

    • id (Optional, ID): Set the ID of this sensor for use in lambdas.

    • All other options from Sensor.

  • power_usage (Optional): The information for the current power consumption sensor.

    • name (Required, string): The name of the sensor.

    • id (Optional, ID): Set the ID of this sensor for use in lambdas.

    • All other options from Sensor.

  • humidity_setpoint (Optional): The information for the humidity indoor sensor (experimental).

    • name (Required, string): The name of the sensor.

    • id (Optional, ID): Set the ID of this sensor for use in lambdas.

    • All other options from Sensor.

  • All other options from Climate.

Automations

midea_ac.power_on Action

This action turn on power. The mode and preset will be restored to the last state before turned off.

on_...:
  then:
    - midea_ac.power_on:

midea_ac.power_off Action

This action turn off power.

on_...:
  then:
    - midea_ac.power_off:

midea_ac.follow_me Action

This action transmit IR FollowMe command telling the air conditioner a more accurate room temperature value to be used instead of the internal indoor unit sensor.

on_...:
  then:
    - midea_ac.follow_me:
        temperature: !lambda "return x;"
        beeper: false

Configuration variables:

  • temperature (Required, float, templatable): Set the value of a internal temperature sensor.

  • beeper (Optional, bool, templatable): set beep on update. Defaults to False

midea_ac.display_toggle Action

This action toggle ac screen. Works via UART if supported or Remote Transmitter.

on_...:
  then:
    - midea_ac.display_toggle:

midea_ac.swing_step Action

This action adjust the louver by one step. Remote Transmitter required.

on_...:
  then:
    - midea_ac.swing_step:

midea_ac.beeper_on Action

This action turn on beeper feedback.

on_...:
  then:
    - midea_ac.beeper_on:

midea_ac.beeper_off Action

This action turn off beeper feedback.

on_...:
  then:
    - midea_ac.beeper_off:

Additional control options using IR commands

It is possible to use the FollowMe function and some other features available only through IR commands. Below is an example of how to send FollowMe commands with the values of your sensor using the Remote Transmitter component, as well as control the light of the LED display.

# Example configuration entry

remote_transmitter:
  pin: GPIO13                       # For iot-uni-stick.
  carrier_duty_percent: 100%        # 50% for IR LED, 100% for direct connect to TSOP IR receiver output.

sensor:
  - platform: homeassistant
    entity_id: sensor.room_sensor   # Sensor from HASS
    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.

# template momentary switches for sending display control command and swing step actions
switch:
  - platform: template
    name: Display Toggle
    icon: mdi:theme-light-dark
    turn_on_action:
      midea_ac.display_toggle:
  - platform: template
    name: Swing Step
    icon: mdi:tailwind
    turn_on_action:
      midea_ac.swing_step:

Example of Beeper Control Using a Switch

switch:
  - platform: template
    name: Beeper
    icon: mdi:volume-source
    optimistic: true
    turn_on_action:
      midea_ac.beeper_on:
    turn_off_action:
      midea_ac.beeper_off:

Acknowledgments:

Thanks to the following people for their contributions to reverse engineering the UART protocol and source code in the following repositories:

Special thanks to the project IRremoteESP8266 for describing the IR protocol.

See Also