Skip to main content

Midea-local python lib

Python build codecov

中文版 / Chinese README

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

CONTRIBUTING 中文版CONTRIBUTING

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

midea_local-8.0.1.tar.gz (138.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

midea_local-8.0.1-py3-none-any.whl (193.1 kB view details)

Uploaded Python 3

File details

Details for the file midea_local-8.0.1.tar.gz.

File metadata

  • Download URL: midea_local-8.0.1.tar.gz
  • Upload date:
  • Size: 138.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for midea_local-8.0.1.tar.gz
Algorithm Hash digest
SHA256 feef29577d5a5b7b706d210dc6b1f1b1cca6293f4afd5b2bf0c4e5b6e3b09548
MD5 ade706995fb127ff99ee12e95e83a7f8
BLAKE2b-256 c238baa50cdf30b197f2d1117e7be3d02a35856207c2a271490a31c1aa4bf1f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for midea_local-8.0.1.tar.gz:

Publisher: python-build.yml on midea-lan/midea-local

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file midea_local-8.0.1-py3-none-any.whl.

File metadata

  • Download URL: midea_local-8.0.1-py3-none-any.whl
  • Upload date:
  • Size: 193.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for midea_local-8.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a330b0c84376bfa1f7b1dd82b806cb5955faafbe99cf0ba80c6aa7e7a37746b3
MD5 234a1a41a68b3d3e09a90d48d1184e66
BLAKE2b-256 a6995825fae25316b1989aef1d9b8188ec19a09de11ef122253fe627d98a8180

See more details on using hashes here.

Provenance

The following attestation bundles were made for midea_local-8.0.1-py3-none-any.whl:

Publisher: python-build.yml on midea-lan/midea-local

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page