midea-local
Control your Midea M-Smart appliances via local area network
What it is and what it does
Midea-local is a Python library for controlling Midea M-Smart appliances directly over your local network without relying on cloud services. It discovers devices on the LAN, establishes authenticated connections using device tokens and keys, and exposes appliance attributes and control methods—such as setting temperature or swing mode on air conditioners—through a unified device interface.
The library handles the low-level protocol details (encryption via pycryptodome, async I/O via aiohttp and aiofiles) and provides both a programmatic API and a command-line tool. It targets Python 3.12+ and has been actively maintained with frequent releases; it's part of a larger ecosystem for Midea device automation.
Use it for:
- Discover and list all Midea M-Smart appliances on your home network by IP and device type.
- Build a home automation dashboard that reads and controls AC temperature, swing, and other attributes in real time.
- Integrate Midea appliances into a broader smart-home system via local-only control without cloud dependency.
- Automate appliance schedules or responses (e.g., turn off AC when leaving home) using the device control API.
- Debug or inspect Midea device state and protocol details using the included CLI tool.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Control Midea M-Smart appliances over local network using their native protocol, with device discovery and attribute management.
Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive MIT license. Install it if you own Midea M-Smart appliances and want local-network control without cloud dependency. The main prerequisite is obtaining device tokens and keys from your Midea account, which the documentation does not fully detail—verify that step before committing.
Install
midea-local on PyPI
pip
pip install midea-localuv
uv add midea-localpoetry
poetry add midea-localInstalling midea-local
Before you install
Low install friction with straightforward async-capable dependencies. Active maintenance with a release within the last day and 96 repository stars; requires Python 3.12 or later.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both personal and commercial projects.
Quickstart
from midealocal.discover import discover
from midealocal.devices import device_selector
# Discover devices on local network
devices = discover()
d = list(devices.values())[0]
# Connect to device with token and key
ac = device_selector(
name="AC",
device_id=d['device_id'],
device_type=d['type'],
ip_address=d['ip_address'],
port=d['port'],
token='...',
key='...',
device_protocol=d['protocol'],
model=d['model'],
subtype=0,
customize=""
)
ac.connect()
ac.set_target_temperature(23.0, None)
Requires Python 3.12 or later; token and key credentials from Midea account needed for device authentication.
Verify before relying
- Whether token and key acquisition process is documented or requires separate Midea account setup steps
- Supported Midea device types and models beyond the AC examples shown
- Whether the CLI tool provides a complete alternative to programmatic control
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — aiofiles, aiohttp, colorlog, defusedxml, ifaddr, pycryptodome, platformdirs, typing_extensions |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 307,816/month — #7,773 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: midea_local-8.0.1-py3-none-any.whl
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
msmart-ngA Python library for discovering and…
permissive · top 15,000 on PyPI
whirlpool-sixth-senseProvides an unofficial API client for…
permissive · top 15,000 on PyPI
py-ccm15Provides an async Python interface to…
permissive · top 15,000 on PyPI
pyaehw4a1Provides a Python interface to control Hisense…
permissive · top 15,000 on PyPI
homeconnect-websocketControl HomeConnect appliances over a local…
unclear · top 15,000 on PyPI
miniupnpcPython binding for MiniUPnPc library that…
permissive · top 15,000 on PyPI
gehomesdkSDK for controlling and monitoring GE…
permissive · top 15,000 on PyPI
wakeonlanSends wake-on-LAN magic packets to power on…
permissive · top 15,000 on PyPI
zhaZHA is a hardware-independent Zigbee gateway…
permissive · top 15,000 on PyPI
pydaikinPyDaikin provides a Python library and CLI for…
copyleft · top 15,000 on PyPI