This is a library that allows communication with Midea air conditioner and dehumidifier via the local area network.
# midea-beautiful-air
[![Build Status](https://github.com/nbogojevic/midea-beautiful-air/actions/workflows/python-publish.yml/badge.svg)](https://github.com/nbogojevic/midea-beautiful-air/actions/workflows/python-publish.yml)
[![PyPI](https://img.shields.io/pypi/v/midea_beautiful_air.svg?maxAge=3600)](https://pypi.org/project/midea_beautiful_air/)
This library allows discovering Midea air conditioners and dehumidifiers on local network, getting their state and controlling then. The name comes from Chinese name for Midea (美的) which translates to _beautiful_ in English.
This library inspired from the repository at [mac-zhou/midea-msmart](https://github.com/mac-zhou/midea-msmart) which provides similar functionality for air conditioners and [barban-dev/midea_inventor_dehumidifier](https://github.com/barban-dev/midea_inventor_dehumidifier) cloud based functionality for dehumidifiers. This library may include verbatim or adapted portions of the code from those two projects.
Thanks also to [yitsushi's project](https://github.com/yitsushi/midea-air-condition), [NeoAcheron's project](https://github.com/NeoAcheron/midea-ac-py), [andersonshatch's project](https://github.com/andersonshatch/midea-ac-py).
## Supported appliances
The library works with Midea air conditioners and dehumidifiers supporting V2 and V3 protocol.
Some examples of supported dehumidifiers:
* Comfee MDDF-16DEN7-WF or MDDF-20DEN7-WF (tested with 20L version)
* Inventor EVA ΙΟΝ Pro Wi-Fi (EP3-WiFi 16L/20L) (tested with 20L version)
* Inventor Eva II Pro Wi-Fi (EVP-WF16L/20L)
* Pro Breeze 30L Smart Dehumidifier with Wifi / App Control
* Midea SmartDry dehumidifiers (22, 35, 50 pint models )
* Midea Cube dehumidifiers (20, 35, 50 pint models)
It may as well work with other Midea Wi-Fi air conditioners and dehumidifiers.
## Dehumidifier data
The following dehumidifier data is accessible through this library:
* on/off switch (boolean, can be set)
* current relative humidity (read-only)
* target relative humidity (can be set)
* active mode (can be set)
* fan speed (can be set)
* (an)ion mode status (boolean, can be set)
* tank is full (boolean, read-only)
* appliance name (read-only). Set through Midea mobile application.
* appliance serial number (read-only)
* appliance IPv4 address (read-only)
* token and key for local network access (read-only, only v3 appliances)
* filter replacement indicator (boolean, read-only, if supported on appliance)
* pump on/off switch (boolean, can be set, if supported on appliance)
* sleep mode on/off switch (boolean, can be set, if supported on appliance)
* defrosting mode indicator (boolean, read-only, if supported on appliance)
* internal error code (read-only)
* appliance characteristics, i.e. support for special modes, fan presets etc (read-only)
* beep prompt (write-only)
* tank water level (read-only, if supported by appliance)
* current ambient temperature (read-only)
## Air Conditioner Data
The following air conditioner data is accessible through this library:
* on/off switch (boolean, can be set)
* target temperature(celsius, can be set)
* indoor temperature (celsius, read-only)
* outdoor temperature (celsius, read-only)
* active mode (can be set)
* air purifier mode (boolean, can be set)
* air drying mode (boolean, can be set)
* horizontal swing operation (boolean, can be set)
* vertical swing operation (boolean, can be set)
* fahrenheit degree display (boolean, can be set)
* internal error code (read-only)
* appliance characteristics, i.e. support for special modes, fan presets etc (read-only)
* beep prompt (write-only)
* appliance name (read-only). Set through Midea mobile application.
* appliance serial number (read-only)
* appliance IPv4 address (read-only)
* token and key for local network access (read-only, only v3 appliances)
## Discovery
This library is able to discover appliances on local network. This is done by broadcasting UDP packets to port 6445. Appliances will respond to this broadcast with their description packet. Following discovery, communication switchers to TCP over port 6444. This communication is encrypted, and, for appliances with version 3 firmware the library needs a token/key (K1) combination associated to each appliance. This can be either provided as arguments or retrieved from Midea app account. Once obtained, the token/key (K1) pair can be reused for an appliance multiple times. The library can also retrieve the list of registered appliances from Midea app account and obtain additional information for devices (eg. name).
Library connects to Midea cloud API using credentials from NetHome Plus mobile app. You can use other Midea app mobile applications if you obtain their application key and id. See [midea_beautiful/midea.py](midea_beautiful/midea.py) for some examples. Application key and application id must match, otherwise library won't be able to sign in.
The discovery should work on Linux and Windows based systems, however it doesn't work in Windows Subsystem for Linux and may not work in Docker containers or VMs depending on network setup. For example, a VM or a container needs to have rights to broadcast to physical network to make discovery work. One workaround, if physical network access is not possible, is to run discovery from non-virtualized environment host.
If this discovery mechanism doesn't work on particular set-up, it is still possible to either target appliances directly using their IP address when it is known or to retrieve or set their status using cloud service.
### Network considerations
Discovery requires that both appliance and the machine performing discovery are present on the same broadcast subnet. By default library issues broadcast to all network, i.e. address `255.255.255.255`, but it is possible to restrict broadcast subnet (e.g. 192.0.5.255)
## Local protocol support
Library supports following protocols:
* cloud based status reading and writing (no local access needed)
* v3 local protocol with compatible devices (requires TOKEN/KEY combination)
* v2 local protocol with compatible devices
## Logging
Library logs additional information at log levels 5 and 1. Credentials information like username, password or token keys should not be logged on levels 5 and higher, but you can use command line tool to display token and key (K1) data.
## Command Line Usage
### Installing package
```shell
pip install --upgrade midea-beautiful-air
```
### Command line tool help
```shell
midea-beautiful-air-cli --help
midea-beautiful-air-cli discover --help
midea-beautiful-air-cli set --help
midea-beautiful-air-cli status --help
```
### Discovery
Discover appliances on the local network:
```shell
midea-beautiful-air-cli discover --account ACCOUNT_EMAIL --password PASSWORD
```
Show tokens used to connect to appliances via local network
```shell
midea-beautiful-air-cli discover --account ACCOUNT_EMAIL --password PASSWORD --credentials
```
Search for devices by providing explicit network address
```shell
midea-beautiful-air-cli discover --account ACCOUNT_EMAIL --password PASSWORD --address 192.0.1.3 --credentials
```
Search for devices by providing broadcast address
```shell
midea-beautiful-air-cli discover --account ACCOUNT_EMAIL --password PASSWORD --address 192.0.1.255 --credentials
```
### Appliance status
Get status of an appliance using known TOKEN and KEY (e.g. retrieved using `discover` command)
```shell
midea-beautiful-air-cli status --ip APPLIANCE_IP_ADDRESS --token TOKEN --key KEY
```
Get status of an appliance using Midea app credentials
```shell
midea-beautiful-air-cli status --ip APPLIANCE_IP_ADDRESS --account ACCOUNT_EMAIL --password PASSWORD
```
Get status of an appliance through Midea cloud API (note the usage of `--id` and `--cloud` options)
```shell
midea-beautiful-air-cli status --id APPLIANCE_ID --account ACCOUNT_EMAIL
PyPI 官网下载 | midea-beautiful-air-0.8.5.tar.gz
版权申诉
169 浏览量
2022-02-01
08:23:07
上传
评论
收藏 38KB GZ 举报
挣扎的蓝藻
- 粉丝: 12w+
- 资源: 15万+
最新资源
- 全卷积网络基于voc2012数据集简单pytorch实现
- pycharm的一些介绍-用于更好的学习python
- 基于C++的程序设计大赛天梯赛L2答案(天梯赛)
- 基于python实现的三次样条插值和均值插值法实现
- Python语言教程2-python批量图片大小处理-多文件夹
- Python语言教程1-python批量图片重命名,将后缀某几个不想要的字去除
- Space Combat Kit 太空战斗套件Unity游戏开发插件资源unitypackage C#
- Universal Device Preview 通用设备预览Unity游戏开发插件资源unitypackage
- Paladin Anim Set 圣骑士动画集Unity游戏动作动画插件资源unitypackage
- 计算机财务管理期末考报表部分题目及答案.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈