https://github.com/midea-lan/midea-local
Control your Midea M-Smart appliances via local area network.
https://github.com/midea-lan/midea-local
midea python
Last synced: 5 months ago
JSON representation
Control your Midea M-Smart appliances via local area network.
- Host: GitHub
- URL: https://github.com/midea-lan/midea-local
- Owner: midea-lan
- License: mit
- Created: 2024-04-23T15:55:35.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-14T15:07:45.000Z (6 months ago)
- Last Synced: 2026-01-14T18:57:15.908Z (6 months ago)
- Topics: midea, python
- Language: Python
- Homepage:
- Size: 1.33 MB
- Stars: 68
- Watchers: 5
- Forks: 29
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Midea-local python lib
[](https://github.com/rokam/midea-local/actions/workflows/python-build.yml)
[](https://codecov.io/github/rokam/midea-local)
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
```python3
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
```python3
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
python3 -m midealocal.cli -h
```
## Contributing Guide
[CONTRIBUTING](.github/CONTRIBUTING.md)
[中文版CONTRIBUTING](.github/CONTRIBUTING.zh.md)