Midea-local python lib
Control your Midea M-Smart appliances via local area network.
This library is part of https://github.com/georgezhao2010/midea_ac_lan code. It was separated to segregate responsibilities.
⭐If this component is helpful for you, please star it, it encourages me a lot.
Getting started
Finding your device
from midealocal.discover import discover
# Without knowing the ip address
discover()
# If you know the ip address
discover(ip_address="203.0.113.11")
# The device type is in hexadecimal as in midealocal/devices/TYPE
type_code = hex(list(discover().values())[0]["type"])[2:]
Getting data from device
from midealocal.discover import discover
from midealocal.devices import device_selector
token = "..."
key = "..."
# Get the first device
d = list(discover().values())[0]
# Select the device
ac = device_selector(
name="AC",
device_id=d["device_id"],
device_type=d["type"],
ip_address=d["ip_address"],
port=d["port"],
token=token,
key=key,
device_protocol=d["protocol"],
model=d["model"],
subtype=0,
customize="",
)
# Connect and authenticate
ac.connect()
# Getting the attributes
print(ac.attributes)
# Setting the temperature
ac.set_target_temperature(23.0, None)
# Setting the swing
ac.set_swing(False, False)
command line tool
python3 -m midealocal.cli -h
Development
This project uses uv for its development environment. After installing uv:
git clone https://github.com/midea-lan/midea-local.git
cd midea-local
./scripts/setup.sh # Linux / macOS / WSL2 (Windows: scripts\setup.ps1)
This creates a .venv, installs all dependencies, and sets up the prek hooks.
Run tools with uv run, e.g. uv run python -m pytest ./tests/. See the contributing
guide for the full workflow and per-OS uv install instructions.
Contributing Guide
Release files for midea-local 10.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| midea_local-10.1.0.tar.gz | 144.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| midea_local-10.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 342.1 kB
Release files / midea_local-10.1.0.tar.gz
| Download URL | midea_local-10.1.0.tar.gz |
|---|---|
| Size | 144.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f659ce30254119891e0c472fb08cd4c379ae4dc28b23e5d4ff6ec3a41b51072
|
|
BLAKE2b-256 checksum How to use checksums |
c1899ae36be8bf2005072f84a41e4483201c8adcaebac77fce94b07c20134732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logRelease files / midea_local-10.1.0-py3-none-any.whl
| Download URL | midea_local-10.1.0-py3-none-any.whl |
|---|---|
| Size | 197.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1f64c91a7e0404527939886665813c396c0a8d10187791567a8828c2ed52abf
|
|
BLAKE2b-256 checksum How to use checksums |
57be8ef62352aff1711ca4253dd908f5c290b919063f2266eb69f80ead321c12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency log