Metadata-Version: 2.1
Name: midea-local
Version: 1.0.3
Summary: Control your Midea M-Smart appliances via local area network
Home-page: https://github.com/rokam/midea-local
Author: rokam
Author-email: lucas@mindello.com.br
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp
Requires-Dist: ifaddr
Requires-Dist: pycryptodome

# Midea-local python lib
[![Python build](https://github.com/rokam/midea-local/actions/workflows/python-build.yml/badge.svg)](https://github.com/rokam/midea-local/actions/workflows/python-build.yml)
![Python tests](https://raw.githubusercontent.com/rokam/midea-local/badges/tests.svg)
[![Python coverage](https://raw.githubusercontent.com/rokam/midea-local/badges/coverage.svg)](https://app.codecov.io/github/rokam/midea-local)
![Python fake8](https://raw.githubusercontent.com/rokam/midea-local/badges/flake8.svg)

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 responsabilities.

⭐If this component is helpful for you, please star it, it encourages me a lot.

## Getting started

### Finding your device
```python
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 and in midealocal/devices/TYPE
type_code = hex(list(discover().values())[0]['type'])[2:]
```

### Getting data from device
```python
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,
  protocol=d['protocol'],
  model=d['model'],
  subtype=0,
  customize="",
)

# Connect and authenticate
ac.connect()
ac.authenticate()

# Getting the attributes
print(ac.attributes)
# Setting the temperature
ac.set_target_temperature(23.0, None)
# Setting the swing
ac.set_swing(False, False)
```
