How To Integrate Midea Group Air Conditioners in Home Assistant


Recently a friend asked me to look into integrating his Hyundai Air Conditioner in Home Assistant, so he can control it locally and get rid of the app. After digging around and testing a couple of custom integrations, I feel I am confident enough to share the one that worked the best.

With the midea-ac-py integration for Home Assistant, the app can be freely removed and never used again once you’ve obtained the necessary keys and tokens. It also gave me the smoothest and lag-less experience compared to other custom components of the same type.

Midea Group AC Home Assistant Integration Featured

In this article, I am sharing how to integrate any AC from the Midea group, including: Hualing, Senville, Klimaire, AirCon, Century, Pridiom, Thermocore, Comfee, Alpine Home Air, Artel, Beko, Electrolux, Galactic, Idea, Inventor, Kaisai, Mitsui, Mr. Cool, Neoclima, Olimpia Splendid, Pioneer, QLIMA, Rotenso, Royal Clima, Qzen, Toshiba, Carrier, Goodman, Friedrich, Samsung, Kenmore, Trane, Lennox, LG, Hyundai and much more.

How to know if your model is supported?

If your AC is on the list of manufacturers above, chances are it will be supported. They all rely on the same wi-fi dongle that ships with the AC and are either used in the NetHome Plus app of the manufacturer app.

In any case, the Python script let’s you actually check if your particular model is supported once executed in a terminal, so let’s get to it.

Installing Midea Smart Aircon Integration

HACS

  • hacs-repository-smarthomescene<< Click OR:
    • Navigate to HACS > Integrations
    • Click + Explore & Download Repositories
    • Search for Midea Smart Aircon
    • Click Download
    • Restart Home Assistant

Manual

  • Navigate to config folder
    • If you do not have a custom_components folder, create it.
  • In the custom_components folder, create a new folder called midea_ac
  • Restart Home Assistant

Setting up Midea Smart Aircon Integration

This integration requires some information about your AC, which can be found by utilizing the included script. But first, the AC needs to connect to your network. Go through the process of adding the AC in the app (NetHome Plus, Midea Home etc.) and make sure it works and is controllable. Use a throwaway account if you want, you won’t be needing it later.

Obtaining Information with SSH Terminal

In Home Assistant, we need to install the Advanced SSH & Web Terminal Add-on so we can run the script:

  • Navigate to Settings > Add-ons
  • Search for Advanced SSH & Web Terminal
  • Install It but don’t start it
  • Select the configuration tab at the top
  • Create user credentials like in the photo bellow

    Midea Group AC Home Assistant Integration SSH Terminal

  • Click Save
  • Go back to the Info tab
  • Toggle Watchdog, Show in Sidebar and Start on Boot
  • Disable Protection Mode
  • Start the Add-on

After you are done, you can remove the SSH add-on if you don’t need it or simply enable protection mode again. Open the Terminal from the sidebar and execute the following command:

pip3 install msmart
Code language: YAML (yaml)
Midea Group AC Home Assistant Integration SSH Terminal Install

The command will install the component needed to obtain configuration variables for your AC. You will get a warning at the bottom about running pip as root, you can ignore it. Execute the following command:

midea-discover -a YOUR_ACCOUNT -p YOUR_PASSWORD
Code language: YAML (yaml)

If you AC is connected to your Wi-Fi, you will get a bunch of information broken down in a few variables:

Midea Group AC Home Assistant Integration SSH Terminal Variables

The first thing you need to notice is the support: True variable. If it’s False, the custom component does not support your AC and you won’t be able to integrate it using this method. In summary:

  • If support: True you can use this custom component
  • If support: False you cannot integrate your AC using this custom component
  • If version: 3, you need to copy key and token
  • If version: <3, you need only ID

Copy the following information (Tip: Shift + Double click copies the string) and save them it a file somewhere, so if you need to reintegrate the AC at a later stage you won’t have to run the script again. You need to save the following:

  • ip: IP address of the AC
  • id: 15 characters
  • key: 64 characters
  • token: 128 characters

Adding the AC to Home Assistant

Once you’ve collected and saved your information, integrating the AC in Home Assistant is simply copying a few YAML lines. This custom component doesn’t have a UI configuration flow, so we need to edit Home Assistant’s configuration.yaml file. Add the following:

For version: 3

climate:
  - platform: midea_ac
    host: 192.168.1.100
    id: 123456789012345
    token: ACEDDA53831AE5DC...
    k1: CFFA10FC...
Code language: YAML (yaml)

For version: <3

climate:
  - platform: midea_ac
    host: 192.168.1.100
    id: 123456789012345

#No need for Token and Key (K1)
Code language: YAML (yaml)

Replace your ip, id, token and key from the information you collected, save the file and restart Home Assistant. Done, your Midea Group AC is successfully integrated in Home Assistant!

If you navigate to Developer Options > States you can see the entity created by the integration and any controls it has are now available in Home Assistant as well.

Midea Group AC Home Assistant Integration Entity

Bonus: Custom Cards

Once the AC is added in Home Assistant, you can control it using the built in pop-card like any other climate entity. This includes a drop-down menu for selecting the operation mode, preset, fan mode and swing mode. Degrees can be changed by clicking the up/down arrows on the card.

Midea Group AC Home Assistant Integration Card

Alternatively, you can utilize a custom card to control the AC entity. Check out the Top 8 Thermostat Cards for Home Assistant. Here are two alternatives that I find to be quite intuitive for climate/thermostat entities: Mushroom Climate Card and Simple Thermostat Card.

Mushroom Climate Card by piitaya

Midea Group AC Home Assistant Integration Mushroom

Midea Group AC Home Assistant Integration Mushroom 2

Simple Thermostat Card by nervetatto

Midea Group AC Home Assistant Integration Simple Thermostat Card

SmartHomeScene.com is a participant in the Amazon Services LLC Associates Program & AliExpress Portals Affiliate Program.
We may earn a small commission on qualifying purchases from these websites, which incurs no additional cost to you.
SmartHomeScene © 2023 All rights reserved
Ko-Fi SmartHomeScene.com

5 thoughts on “How To Integrate Midea Group Air Conditioners in Home Assistant”

  1. Very nice. Thanks for sharing.
    I’m looking into ASHPs and Midea is on the shortlist. I am hoping there’s a way to integrate an ASHP with Home Assistant.

Comments are closed.