This document describes how to enable debug logging and how to temporarily modify / test the midea_ac_lan custom component and its dependency library midea-lan (package name: midealan) on Home Assistant OS (HAOS).
Important reminders
- Always disable debug logging after you finish testing. Leaving
loggeratdebuglevel for a long time generates large log files, consumes disk space and can impact performance. If you enabled debug viaconfiguration.yaml, you must remove or comment out the logger section and restart Home Assistant again for the change to take effect.- Always restore source-code / manifest changes after testing. Temporary modifications to
manifest.jsonor Python source files should be reverted once you have collected the needed debug data.
- In Home Assistant go to Settings → Add-ons → Add-on Store.
- Search for and install Advanced SSH & Web Terminal.
- Open the add-on configuration:
- Set a strong password (or configure SSH keys).
- Disable “Protected Mode” (required to run
dockercommands and access the HA Core container).
- Start the add-on and (optionally) enable “Show in sidebar”.
- Connect with any SSH client (or use the add-on’s web terminal) to your HAOS host IP on the configured port (default 22).
Disabling Protected Mode allows the
dockercommand to see and enter thehomeassistantcontainer.
Two methods are available. Method 1 (edit configuration.yaml + restart) is strongly recommended because it also captures startup errors.
- SSH into HAOS.
cd /config- Edit
configuration.yaml(e.g. withvior the File Editor add-on) and add:
logger:
default: warn
logs:
custom_components.midea_ac_lan: debug
midealan: debugBoth
custom_components.midea_ac_lanandmidealanmust be set todebug.
- Fully restart Home Assistant.
- Perform the actions that trigger the bug / error.
- Download the complete log via Settings → System → Logs.
After testing: remove (or comment out) the logger section above and restart Home Assistant again so that debug logging is turned off.
- Open Home Assistant Web UI.
- Go to Developer Tools → Actions.
- Select Logger: Set level and switch to YAML mode.
- Paste and run:
action: logger.set_level
data:
custom_components.midea_ac_lan: debug
midealan: debug- Trigger the problematic action.
- Download the log via Settings → System → Logs.
This method does not capture errors that occur during Home Assistant startup. Prefer Method 1 for debugging.
The integration itself lives under /config/custom_components/midea_ac_lan and is easy to edit.
- SSH into HAOS.
cd /config/custom_components/midea_ac_lan- Edit files with
vi, upload viascp/SFTP, or download a raw GitHub file, e.g.:
wget https://github.com/wuwentao/midea_ac_lan/raw/<commit-or-branch>/custom_components/midea_ac_lan/light.py -O light.py- Fully restart Home Assistant to load the changes.
After testing: restore the original files (or reinstall the integration via HACS).
midealan is a pip package installed inside the Home Assistant Core Docker container. Several approaches exist; choose the one that best fits your needs.
This is the cleanest way when the change already exists on GitHub (a PR, a branch or a commit).
- SSH into HAOS.
- Edit
/config/custom_components/midea_ac_lan/manifest.json. - Temporarily change the
requirementsentry, for example:
"requirements": [
"midea-lan @ git+https://github.com/wuwentao/midea-lan.git@b59cfbc"
](Replace b59cfbc with the desired commit hash, branch name or tag.)
- Fully restart Home Assistant. Home Assistant will install the specified version of the library.
After testing: restore the original requirements line in manifest.json and restart again (or reinstall the integration via HACS).
Useful for quick local experiments when you do not want to push a Git commit yet.
- SSH into HAOS.
- Enter the HA Core container:
docker exec -it homeassistant /bin/bash- Locate the package:
pip show midea-lanTypical location (Python version may differ):
Location: /usr/local/lib/python3.13/site-packages
- Change into the package directory:
cd /usr/local/lib/python3.13/site-packages/midealan/- Edit files with
vi, or download a raw file, e.g.:
wget https://github.com/wuwentao/midea-lan/raw/<commit>/midealan/devices/cd/message.py -O devices/cd/message.pyTip:
/configis mounted inside the container, so you can copy files to/from/configto transfer them easily.
- Exit the container and fully restart Home Assistant.
After testing: the next HA Core upgrade or a reinstall of the requirement will overwrite your changes. You can also manually restore the original files or reinstall the package.
- Copy a whole modified tree into
/configand adjust imports (advanced): place a local copy ofmidealanunder/configand change the import paths inside the custom component. This is more work but survives container restarts until you clean it up. - Use a development environment (VS Code + Remote SSH / Dev Container, or a full HA Core development setup) when you plan to contribute many changes. This is the most comfortable long-term workflow.
- HACS reinstall / “Re-download” after you have pushed a temporary branch can also force a fresh library install when combined with Method A.
When a device is successfully added, midea_ac_lan stores its configuration under /config/.storage/midea_ac_lan/.
- SSH into HAOS.
cd /config/.storage/midea_ac_lanlsto list files;cat <device_id>.jsonto view a specific device.
Do not delete or edit these files unless you know what you are doing. Rename/backup them first if you need to experiment.
- SSH into HAOS.
- Enter the HA Core container:
docker exec -it homeassistant /bin/bash- Run (replace the IP with your device’s address):
python3 -m midealan.cli discover --get_sn --host 192.168.2.127Example output:
2025-01-21 18:06:33.552 INFO (MainThread) [cli] Found 1 devices.
2025-01-21 18:06:33.552 INFO (MainThread) [cli] Found devices: {193514046726897: {'device_id': 193514046726897, 'type': 176, 'ip_address': '192.168.2.127', 'port': 6444, 'model': '0TG025JG', 'sn': 'xxxx', 'protocol': 3}}
Please share this output when reporting issues – it contains the device type, SN and protocol needed for debugging.
- Disable debug logging (remove logger section from
configuration.yaml+ restart, or set level back towarn/info). - Restore any changes made to
manifest.json. - Restore any manually edited source files (or reinstall the integration / library).
- Confirm that Home Assistant starts cleanly and the integration works with the official package again.