From a127855783e2007bf590158ca3c54b8c3a36754d Mon Sep 17 00:00:00 2001 From: Wentao Wu Date: Fri, 17 May 2024 17:58:05 +0800 Subject: [PATCH] add release action and update markdown docs with linter rule --- .github/ISSUE_TEMPLATE/1-issue_zh-cn.yml | 7 +- .github/ISSUE_TEMPLATE/2-issue_en.yml | 7 +- .../ISSUE_TEMPLATE/3-enhancement_zh-cn.yml | 3 +- .github/ISSUE_TEMPLATE/4-enhancement_en.yml | 3 +- .github/ISSUE_TEMPLATE/config.yml | 3 +- .github/linters/.eslintrc.yml | 7 ++ .github/linters/.flake8 | 3 + .github/linters/.python-lint | 4 + .github/linters/.yaml-lint.yml | 6 ++ .github/pull_request_template.md | 14 +++ .github/workflows/release.yml | 96 +++++++++++++++++++ .github/workflows/validate.yml | 20 ++-- LICENSE | 2 +- README.md | 76 +++++++++++---- README_hans.md | 68 +++++++++---- doc/AC.md | 8 +- doc/C3.md | 9 +- doc/C3_hans.md | 7 +- doc/E2.md | 10 +- doc/E3.md | 9 +- doc/E3_hans.md | 7 +- doc/E6.md | 6 +- doc/E6_hans.md | 5 +- doc/E8.md | 6 +- doc/E8_hans.md | 6 +- doc/EA.md | 5 +- doc/EA_hans.md | 5 +- doc/EC.md | 5 +- doc/EC_hans.md | 5 +- doc/ED.md | 5 +- doc/ED_hans.md | 5 +- doc/FA.md | 11 ++- doc/FA_hans.md | 7 +- doc/FB.md | 6 +- doc/FB_hans.md | 6 +- doc/FC.md | 6 +- doc/FC_hans.md | 4 +- doc/FD.md | 8 +- doc/FD_hans.md | 7 +- scripts/run.sh | 4 +- scripts/setup.sh | 6 +- 41 files changed, 390 insertions(+), 97 deletions(-) create mode 100755 .github/linters/.eslintrc.yml create mode 100644 .github/linters/.flake8 create mode 100644 .github/linters/.python-lint create mode 100644 .github/linters/.yaml-lint.yml create mode 100644 .github/pull_request_template.md create mode 100755 .github/workflows/release.yml diff --git a/.github/ISSUE_TEMPLATE/1-issue_zh-cn.yml b/.github/ISSUE_TEMPLATE/1-issue_zh-cn.yml index 2fddbef9..dd9f4458 100644 --- a/.github/ISSUE_TEMPLATE/1-issue_zh-cn.yml +++ b/.github/ISSUE_TEMPLATE/1-issue_zh-cn.yml @@ -1,3 +1,4 @@ +--- name: 错误报告 description: 集成或实体无法正常工作 labels: ["bug"] @@ -5,13 +6,13 @@ body: - type: input attributes: label: HA版本 - placeholder: 2023.4.2 + placeholder: 2024.5.3 - type: input validations: required: true attributes: label: 集成版本 - placeholder: 0.3.18 + placeholder: 0.3.23 - type: input validations: required: true @@ -34,4 +35,4 @@ body: - type: textarea attributes: label: The logs - description: 打开Midea AC LAN的调试日志,并将发生错误时的日志发送或上传到这里 \ No newline at end of file + description: 打开Midea AC LAN的调试日志,并将发生错误时的日志发送或上传到这里 diff --git a/.github/ISSUE_TEMPLATE/2-issue_en.yml b/.github/ISSUE_TEMPLATE/2-issue_en.yml index 2c6bde0f..cd6643a7 100644 --- a/.github/ISSUE_TEMPLATE/2-issue_en.yml +++ b/.github/ISSUE_TEMPLATE/2-issue_en.yml @@ -1,3 +1,4 @@ +--- name: Bug report description: Intergration or entity is not working right labels: ["bug"] @@ -18,7 +19,8 @@ body: attributes: label: Device type and model placeholder: Air Conditioner 22012225 - description: Can be found in Settings -> Devices & Services -> Midea AC LAN -> Devices -> Device Info + description: Can be found in Settings -> Devices & Services -> \ + Midea AC LAN -> Devices -> Device Info - type: input validations: required: true @@ -34,4 +36,5 @@ body: - type: textarea attributes: label: The logs - description: Should enable the debug log of Midea AC LAN, and post or upload the log when the error occurs to here \ No newline at end of file + description: Should enable the debug log of Midea AC LAN, and post or \ + upload the log when the error occurs to here diff --git a/.github/ISSUE_TEMPLATE/3-enhancement_zh-cn.yml b/.github/ISSUE_TEMPLATE/3-enhancement_zh-cn.yml index e52552a1..5b4d0a24 100644 --- a/.github/ISSUE_TEMPLATE/3-enhancement_zh-cn.yml +++ b/.github/ISSUE_TEMPLATE/3-enhancement_zh-cn.yml @@ -1,3 +1,4 @@ +--- name: 新功能请求 description: 请求增加新设备支持或请求为已有设备增加新的功能 labels: ["enhancement"] @@ -17,4 +18,4 @@ body: validations: required: true attributes: - label: 新功能的描述 \ No newline at end of file + label: 新功能的描述 diff --git a/.github/ISSUE_TEMPLATE/4-enhancement_en.yml b/.github/ISSUE_TEMPLATE/4-enhancement_en.yml index 0cd2a3e3..03f27acf 100644 --- a/.github/ISSUE_TEMPLATE/4-enhancement_en.yml +++ b/.github/ISSUE_TEMPLATE/4-enhancement_en.yml @@ -1,3 +1,4 @@ +--- name: Enhancement description: New feature or new device support request labels: ["enhancement"] @@ -17,4 +18,4 @@ body: validations: required: true attributes: - label: The description of new feature \ No newline at end of file + label: The description of new feature diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index a49eab2f..341f6afa 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1 +1,2 @@ -blank_issues_enabled: true \ No newline at end of file +--- +blank_issues_enabled: true diff --git a/.github/linters/.eslintrc.yml b/.github/linters/.eslintrc.yml new file mode 100755 index 00000000..9f1876de --- /dev/null +++ b/.github/linters/.eslintrc.yml @@ -0,0 +1,7 @@ +--- +plugins: + - json +rules: + json/*: + - error + - allowComments: true diff --git a/.github/linters/.flake8 b/.github/linters/.flake8 new file mode 100644 index 00000000..bd92aba3 --- /dev/null +++ b/.github/linters/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 500 +extend-ignore = E203,E701 diff --git a/.github/linters/.python-lint b/.github/linters/.python-lint new file mode 100644 index 00000000..4fae9dfb --- /dev/null +++ b/.github/linters/.python-lint @@ -0,0 +1,4 @@ +[FORMAT] +max-line-length=500 +[MESSAGES CONTROL] +disable=import-error, logging-fstring-interpolation, missing-class-docstring,missing-function-docstring diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml new file mode 100644 index 00000000..7f05aa68 --- /dev/null +++ b/.github/linters/.yaml-lint.yml @@ -0,0 +1,6 @@ +--- +extends: default +rules: + line-length: + max: 500 + level: warning diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..3cc9bda0 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,14 @@ +# PR Description + +## Reason & Detail + +## Releted issue + +fix #X + + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100755 index 00000000..03255769 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,96 @@ +--- +name: Release + +on: + release: + types: [released] + +permissions: {} + +defaults: + run: + shell: bash + +jobs: + generate_zip: + name: Generate release zip + runs-on: [ubuntu-latest] + timeout-minutes: 60 + steps: + - name: Checkout Source Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + clean: true + - name: Zip release file + run: | + apt-get update || exit 1 + apt-get install zip || exit 1 + echo "show runner hostname" + hostname + echo "show runner user" + whoami + echo "show runner pwd" + pwd + echo "show runner kernel" + uname -a + echo "show runner pwd file list" + ls + ls -alht "custom_components/midea_ac_lan/" || exit 1 + echo "show manifest.json for debug" + cat "custom_components/midea_ac_lan/manifest.json" || exit 1 + dst_dir="/github/workspace/artifacts" + sudo mkdir -p "$dst_dir" || exit 1 + sudo chown -R "$(id -u):$(id -g)" "$dst_dir" || exit 1 + sudo chmod -R 755 "$dst_dir" || exit 1 + cd "custom_components/midea_ac_lan/" || exit 1 + zip -r "../midea_ac_lan.zip" "./*" || exit 1 + cp "../midea_ac_lan.zip" "$dst_dir/midea_ac_lan.zip" || exit 1 + ls -alht "$dst_dir" || exit 1 + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: midea_ac_lan.zip + path: /github/workspace/artifacts + + upload_release: + needs: generate_zip + name: Publish release + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + runs-on: ubuntu-latest + steps: + - name: Download All Artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + pattern: midea_ac_lan.zip + merge-multiple: true + + - name: Display Structure of Artifacts Files + run: ls -R + + - name: Show Working Directory For Debug Purpose + run: | + echo "show runner hostname" + hostname + echo "show runner user" + whoami + echo "show runner disk usage" + df -h + echo "show runner pwd" + pwd + echo "show runner kernel" + uname -a + echo "show runner pwd file list" + ls + ls -alht + echo "show runner artifacts" + ls -alht artifacts || exit 0 + echo "github.ref: ${{github.ref}}" + + - name: Upload images to Release Asset + uses: softprops/action-gh-release@v2 + with: + files: artifacts/midea_ac_lan.zip + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 37d63485..a2bd38b9 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,23 +1,23 @@ - +--- name: HACS Validation - on: pull_request: - push: # schedule: # - cron: "0 0 * * *" +permissions: {} + jobs: validate: name: HASS and Hassfest Validation runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v4" + - uses: "actions/checkout@v4" - - name: HACS Action - uses: hacs/action@main - with: - category: "integration" + - name: HACS Action + uses: hacs/action@main + with: + category: "integration" - - name: Hassfest validation - uses: "home-assistant/actions/hassfest@master" + - name: Hassfest validation + uses: "home-assistant/actions/hassfest@master" diff --git a/LICENSE b/LICENSE index 0387ca43..0401ec35 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -MIT License +# MIT License Copyright (c) 2021 George Zhao diff --git a/README.md b/README.md index b67caff2..2765d454 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # Midea AC LAN + [![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/hacs/integration) [![Donate](https://img.shields.io/badge/donate-BuyMeCoffee-yellow.svg)](https://www.buymeacoffee.com/georgezhao2010) [![Stable](https://img.shields.io/github/v/release/wuwentao/midea_ac_lan)](https://github.com/wuwentao/midea_ac_lan/releases/latest) +[![Super-Linter](https://github.com/wuwentao/midea_ac_lan/actions/workflows/linter.yml/badge.svg)](https://github.com/marketplace/actions/super-linter) -> :warning: **This is a fork of Midea_ac_lan done by Georgezhao **: As the project is in a vegetative state we have done a fork and merged some pending fixes. -I'm trying to get in touch with the maintainer at the moment to find a solution, and at the same time we're looking for people available to maintain the project, which is actively used by the community. please contact me if you can help ! +> :warning: **This is a fork of midea_ac_lan done by Georgezhao** English | [简体中文](README_hans.md) @@ -22,13 +23,18 @@ Thanks also to [@NeoAcheron](https://github.com/NeoAcheron/midea-ac-py). ***❗Note: Home Assistant 2023.1 or higher required for this integration*** -# Supported brands +## Supported brands -![ariston](brands/ariston.png) ![beverly](brands/beverly.png) ![bugu](brands/bugu.png) ![carrier](brands/carrier.png) ![colmo](brands/colmo.png) ![comfee](brands/comfee.png) ![electrolux](brands/electrolux.png) ![invertor](brands/invertor.png) ![littleswan](brands/littleswan.png) ![midea](brands/midea.png) ![netsu](brands/netsu.png) ![ProBreeze](brands/probreeze.png) ![rotenso](brands/rotenso.png) ![toshiba](brands/toshiba.png) ![vandelo](brands/vandelo.png) ![wahin](brands/wahin.png) +![ariston](brands/ariston.png) ![beverly](brands/beverly.png) ![bugu](brands/bugu.png) \ +![carrier](brands/carrier.png) ![colmo](brands/colmo.png) ![comfee](brands/comfee.png) \ +![electrolux](brands/electrolux.png) ![invertor](brands/invertor.png) ![littleswan](brands/littleswan.png) \ +![midea](brands/midea.png) ![netsu](brands/netsu.png) ![ProBreeze](brands/probreeze.png) \ +![rotenso](brands/rotenso.png) ![toshiba](brands/toshiba.png) ![vandelo](brands/vandelo.png) \ +![wahin](brands/wahin.png) And more. -# Supported appliances +## Supported appliances | Type | Name | Documents | |------|----------------------------|--------------------| @@ -67,12 +73,28 @@ And more. | FC | Air Purifier | [FC.md](doc/FC.md) | | FD | Humidifier | [FD.md](doc/FD.md) | -# Installation -Search 'Midea AC LAN' in HACS and install, or copy all files in `custom_components/midea_ac_lan` from [Latest Release](https://github.com/georgezhao2010/midea_ac_lan/releases/latest) to your `/custom_components/midea_ac_lan` in Home Assistant manually. +## Installation + +**Search `Midea AC LAN` in HACS not available now, it will be ready later** + +Please use manual install as below: + +Option 1: + +1. make sure you have installed HACS to Home Assistant [HACS install guide](https://hacs.xyz/docs/setup/download) +2. open HACS, click [Custom repositories], Repository input: `https://github.com/wuwentao/midea_ac_lan`, Category select [Integration] +3. **Restart Home Assistant**. -Restart Home Assistant. +Option 2: + +1. Download `midea_ac_lan.zip` from [Latest Release](https://github.com/wuwentao/midea_ac_lan/releases/latest) +2. copy `midea_ac_lan.zip` to `/custom_components/midea_ac_lan` in Home Assistant. +3. **Restart Home Assistant**. + +Once it done, open `[Settings]`, `[Device & services]`, `[Integrations]`, `[Midea AC Lan]`, do init config and add all your devices. + +## Add device -# Add device ***❗Note: First, set a static IP address for your appliance in the router, in case the IP address of the appliance changes after set-up.*** After installation, search and add component Midea AC LAN in Home Assistant integrations page. @@ -83,15 +105,18 @@ Or click [![Configuration](https://my.home-assistant.io/badges/config_flow_start After the account is configured, Click 'ADD DEVICE' once more to add new device. You could repeat the above action to add multiple devices. -## Discover automatically +### Discover automatically + Using this option, the component could auto-discover and list Midea M-Smart appliances in network or specified IP address, select one and add it in. You can also use an IP address to search within a specified network, such as `192.168.1.255`. ***❗Note: Discovery automatically requires your appliances and your Home Assistant must be in the same sub-network. Otherwise, devices may not be auto-discovered. Check this by yourself.*** -## Configure manually +### Configure manually + If you already know following information, you could add the appliance manually. + - Appliance code - Appliance type (one of [Supported appliances](README.md#supported-appliances)) - IP address @@ -100,30 +125,39 @@ If you already know following information, you could add the appliance manually. - Token - Key -## List all appliances only +### List all appliances only + Using this option, you can list all discoverable Midea M-Smart devices on the network, along with their IDs, types, SNs, and other information. ***❗Note: For certain reasons, not all supported devices may be listed here.*** -# Configure +## Configure Configure can be found in `Settings -> Devices & Services -> Midea AC LAN -> Devices -> CONFIGURE`. You can re-set the IP address when device IP changed. You can also add extra sensor and switch entities or customize your own device. -## IP address +### IP address + Set the IP address of device. You can reset this when your device IP is changed. -## Refresh interval +### Refresh interval + Set the interval for actively refreshing the status of a single device (the unit is second) (30 by default and 0 means not refresh actively) -Mostly the status update of Midea devices relies on the active information notification of the device, in which condition the status update in HA still works normally even if the refresh interval is set to be “0”. This component will also actively query the device status at regular intervals, and the default time is 30 seconds. Some devices do not have active information notifications when their status changed, so synchronization with the status in HA will be slower. If you are very concerned about the synchronization speed of the status, you can try to set a shorter status refresh interval. +Mostly the status update of Midea devices relies on the active information notification of the device, \ +in which condition the status update in HA still works normally even if the refresh interval is set to be "0". \ +This component will also actively query the device status at regular intervals, and the default time is 30 seconds. \ +Some devices do not have active information notifications when their status changed, so synchronization with the status in HA will be slower. \ +If you are very concerned about the synchronization speed of the status, you can try to set a shorter status refresh interval. ***❗Note: shorter refresh interval may mean more power consumption*** -## Extra sensor and switch entities +### Extra sensor and switch entities + After configuration, one of few main entity (e.g. climate entity) may be generated . If you want to make the attributes to extra sensor and switch entities, click CONFIGURE in Midea AC LAN integration card to choose (if your devices supported). -## Customize +### Customize + Some types of device have their own configuration items, if your device does not work properly, you may need to customize it. Refer to the device documentation for specific information. The format of customizations must be JSON. @@ -131,13 +165,15 @@ The format of customizations must be JSON. If multiple customization items need to be configured, the settings must comply with the JSON format. Example + ```json {"refresh_interval": 15, "fan_speed": 100} ``` -# Debug +## Debug Turn on the debug log out,config in configuration.yaml + ```yaml logger: default: warn @@ -145,7 +181,7 @@ logger: custom_components.midea_ac_lan: debug ``` -# Support my works +## Support my works If you like this integration, why do not you support my works by buying me a coffee? diff --git a/README_hans.md b/README_hans.md index bcf132a7..3853e00e 100644 --- a/README_hans.md +++ b/README_hans.md @@ -1,7 +1,9 @@ # Midea AC LAN + [![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/hacs/integration) [![Donate](https://img.shields.io/badge/donate-BuyMeCoffee-yellow.svg)](https://www.buymeacoffee.com/georgezhao2010) [![Stable](https://img.shields.io/github/v/release/wuwentao/midea_ac_lan)](https://github.com/wuwentao/midea_ac_lan/releases/latest) +[![Super-Linter](https://github.com/wuwentao/midea_ac_lan/actions/workflows/linter.yml/badge.svg)](https://github.com/marketplace/actions/super-linter) [English](README.md) | 简体中文 @@ -19,13 +21,17 @@ ***❗注意: 本集成需要Home Assistant 2023.1或更高版本*** -# 已支持的品牌 +## 已支持的品牌 -![beverly](brands/beverly.png) ![bugu](brands/bugu.png) ![carrier](brands/carrier.png) ![colmo](brands/colmo.png) ![comfee](brands/comfee.png) ![electrolux](brands/electrolux.png) ![invertor](brands/invertor.png) ![littleswan](brands/littleswan.png) ![midea](brands/midea.png) ![netsu](brands/netsu.png) ![ProBreeze](brands/probreeze.png) ![rotenso](brands/rotenso.png) ![toshiba](brands/toshiba.png) ![vandelo](brands/vandelo.png) ![wahin](brands/wahin.png) +![beverly](brands/beverly.png) ![bugu](brands/bugu.png) ![carrier](brands/carrier.png) \ +![colmo](brands/colmo.png) ![comfee](brands/comfee.png) ![electrolux](brands/electrolux.png) \ +![invertor](brands/invertor.png) ![littleswan](brands/littleswan.png) ![midea](brands/midea.png) \ +![netsu](brands/netsu.png) ![ProBreeze](brands/probreeze.png) ![rotenso](brands/rotenso.png) \ +![toshiba](brands/toshiba.png) ![vandelo](brands/vandelo.png) ![wahin](brands/wahin.png) 以及更多。 -# 已支持的设备 +## 已支持的设备 | 类型 | 名称 | 文档 | |----|-------------------|------------------------------| @@ -64,12 +70,28 @@ | FC | 空气净化器 | [FC_hans.md](doc/FC_hans.md) | | FD | 加湿器 | [FD_hans.md](doc/FD_hans.md) | -# 安装 -在HACS中搜索'Midea AC LAN'并安装, 或者从[Latest release](https://github.com/georgezhao2010/midea_ac_lan/releases/latest)下载最新的Release版本, 将其中的`custom_components/midea_ac_lan`放到你的Home Assistant的`custom_components/midea_ac_lan`中。 +## 安装 + +**在HACS中搜索`Midea AC LAN`并安装的方式当前还不可用**,请耐心等待HACS审核和处理流程。 + +请先使用以下二种方式手工安装: + +方式1: + +1. 确保`Home Assistant`中已安装HACS [HACS install docs](https://hacs.xyz/docs/setup/download) +2. 打开`HACS`, 点击`[Custom repositories]`, `Repository` 输入: `https://github.com/wuwentao/midea_ac_lan`, `Category` 选择 `[Integration]` +3. **重启Home Assistant**. -重启Home Assistant +方式2: + +1. 从[Latest Release](https://github.com/wuwentao/midea_ac_lan/releases/latest) 下载 `midea_ac_lan.zip` +2. 复制 `midea_ac_lan.zip` 到 `/custom_components/midea_ac_lan`. +3. **重启 Home Assistant**. + +重启完成后, 打开 `[Settings]`, `[Device & services]`, `[Integrations]`, `[Midea AC Lan]`, 进行初始化设置并添加所有设备. + +## 添加设备 -# 添加设备 ***❗注意: 首先, 在路由器上为你的设备设置一个静态IP地址, 以防设置后设备的IP地址发生改变。*** 安装之后, 在Home Assistant的集成界面搜索添加集成Midea AC LAN, 如果需要添加多台设备, 多次添加本集成并执行自动配置即可。 @@ -80,15 +102,18 @@ 完成美的账户配置之后, 点击'添加设备'进行设备添加。你可以多次重复操作以添加多台设备。 -## Discover automatically / 自动搜索 +### Discover automatically / 自动搜索 + 使用此选项, 组件会列出网络上或者指定IP地址上的设备, 选择一个并进行添加。 你也可以使用IP地址在指定网络中搜索, 比如`192.168.1.255` ***❗注意: 自动配置要求设备必须与HA在同一网段, 否则可能搜索不到设备, 请自行确认这点*** -## Configure manually / 手动配置 +### Configure manually / 手动配置 + 如果之前你已经通过其它集成手工配置过设备, 并知道以下信息, 也可以进行手动配置 + - 设备ID - 设备类型 ([已支持的设备](README_hans.md#%E5%B7%B2%E6%94%AF%E6%8C%81%E7%9A%84%E8%AE%BE%E5%A4%87)之一) - IP地址 @@ -97,20 +122,23 @@ - Token - Key -## List all appliances only / 仅列出所有设备 +### List all appliances only / 仅列出所有设备 使用此选择, 可以列出网络中所有可以被搜索到的美的M-Smart设备, 以及他们的ID, 类型, SN等信息 ***❗注意: 出于某些原因, 可能不是所有受支持的设备都能于此列出*** -# 配置 +## 配置 + 集成配置位于`配置 -> 设备与服务 -> Midea AC LAN -> 设备 -> 选项`。 在配置中, 你可以在设备IP改变后重新指定IP地址, 也可以增加扩展的传感器或开关等实体或者自定义你的设备 -## IP地址 +### IP地址 + 指定设备的IP地址。当你的设备IP地址变动后, 可以重新设定它 -## 刷新间隔 +### 刷新间隔 + 指定单台设备的主动状态刷新间隔 (单位为秒) (默认值为30, 设0代表不进行主动刷新) 大部分的美的设备在自身状态改变时会主动发送通知, 在这种情况下, 即使将改值设为0, 也不会影响HA中的设备状态更新。组件默认每间隔30秒会进行主动刷新。部分设备没有状态改变时主动通知的机制, 状态同步就会表现得很慢, 这种情况下可以尝试更短的主动状态更新间隔。 @@ -118,9 +146,11 @@ ***❗注意: 更小的更新间隔意味着更多的能源消耗*** ## 额外的传感器及开关实体 + 配置完成后, 可能会默认生成一个或几个主要实体(比如climate实体)。如果需要其它属性生成为扩展的传感器及开关实体, 在Midea AC LAN集成卡片上点击'选项', 并选择要生成的传感器及开关(如果你的设备支持该属性)。 -## 自定义 +### 自定义 + 某些类型的设备有它们自己的自定义项, 可以通过自定义项定制设备的特点。如果你的设备无法正常工作, 也许你需要自定义它。请参阅设备文档以获取具体信息。 自定义的格式必须是JSON。 @@ -128,12 +158,15 @@ 如果要设置多个自定义项, 请注意遵循JSON的格式要求 示例 + ```json {"refresh_interval": 15, "fan_speed": 100} ``` -# 调试 +## 调试 + 要打开调试日志输出, 在configuration.yaml中做如下配置 + ```yaml logger: default: warn @@ -141,7 +174,8 @@ logger: custom_components.midea_ac_lan: debug ``` -# 支持我的工作 +## 支持我的工作 + 如果喜欢这个集成, 可以使用支付宝或者微信支付赞助我来支持我的工作。 -![alipay](doc/images/alipay.png) ![wechatpay](doc/images/wechatpay.png) \ No newline at end of file +![alipay](doc/images/alipay.png) ![wechatpay](doc/images/wechatpay.png) diff --git a/doc/AC.md b/doc/AC.md index 6a058270..972231a4 100644 --- a/doc/AC.md +++ b/doc/AC.md @@ -1,5 +1,7 @@ # Air Conditioner + ## Features + - Supports target temperature - Supports run mode - Supports fan mode @@ -8,6 +10,7 @@ - Supports build-in fresh air system ### Supported Run-Modes + - Comfort Mode - ECO Mode - Boost Mode @@ -31,7 +34,9 @@ ``` ## Entities + ### Default entity + | EntityID | Class | Description | |----------------------------|---------|----------------| | climate.{DEVICEID}_climate | climate | Climate entity | @@ -89,6 +94,7 @@ Set the attribute of appliance. Service data: | value | Range 1 to 100 or "auto" | Example + ```yaml service: midea_ac_lan.set_attribute data: @@ -103,4 +109,4 @@ data: device_id: XXXXXXXXXXXX attribute: fan_speed value: auto -``` \ No newline at end of file +``` diff --git a/doc/C3.md b/doc/C3.md index 7fb75463..f7438269 100644 --- a/doc/C3.md +++ b/doc/C3.md @@ -1,10 +1,14 @@ # Heat Pump Wi-Fi Controller + ## Features + - Supports target temperature - Supports run mode ## Entities + ### Default entity + | EntityID | Class | Description | |--------------------------------------|--------------|----------------------| | climate.{DEVICEID}_climate_zone1 | climate | Zone1 climate entity | @@ -20,7 +24,7 @@ | binary_sensor.{DEVICEID}_zone1_room_temp_mode | binary_sensor | Zone1 Room Temperature Mode | | binary_sensor.{DEVICEID}_zone2_room_temp_mode | binary_sensor | Zone2 Room Temperature Mode | | binary_sensor.{DEVICEID}_status_dhw | binary_sensor | DHW Status | -| binary_sensor.{DEVICEID}_status_tbh | binary_sensor | TBH Status |**** +| binary_sensor.{DEVICEID}_status_tbh | binary_sensor | TBH Status | | binary_sensor.{DEVICEID}_status_ibh | binary_sensor | IBH Status | | binary_sensor.{DEVICEID}_status_heating | binary_sensor | Heating Status | | sensor.{DEVICEID}_error_code | sensor | Error Code | @@ -54,10 +58,11 @@ Set the attribute of appliance. Service data: | value | true or false | Example + ```yaml service: midea_ac_lan.set_attribute data: device_id: XXXXXXXXXXXX attribute: zone1_curve value: true -``` \ No newline at end of file +``` diff --git a/doc/C3_hans.md b/doc/C3_hans.md index 1974af15..2feed9d2 100644 --- a/doc/C3_hans.md +++ b/doc/C3_hans.md @@ -1,10 +1,14 @@ # 热泵空调Wi-Fi线控器 + ## 特性 + - 支持目标温度设定 - 支持运行模式设定 ## 生成实体 + ### 默认生成实体 + | 实体ID | 类型 | 描述 | |--------------------------------------|--------------|----------| | climate.{DEVICEID}_climate_zone1 | climate | 区域1恒温器实体 | @@ -54,10 +58,11 @@ | value | true 或 false | 示例 + ```yaml service: midea_ac_lan.set_attribute data: device_id: XXXXXXXXXXXX attribute: zone1_curve value: true -``` \ No newline at end of file +``` diff --git a/doc/E2.md b/doc/E2.md index 2ed23381..efb72367 100644 --- a/doc/E2.md +++ b/doc/E2.md @@ -1,9 +1,11 @@ # Electric Water Heater + ## Features -- Supports target temperature +- Supports target temperature ## Customize + - Set the protocol of device ("auto" by default). There are 2 different protocol version to control Electric Water Heater, "old protocol" or "new protocol". If you can't control your device, try change this item and see if it works. @@ -14,7 +16,9 @@ The options include true, false, and "auto". ``` ## Entities + ### Default entity + | EntityID | Class | Description | |--------------------------------------|--------------|---------------------| | water_heater.{DEVICEID}_water_heater | water_heater | Water heater entity | @@ -35,7 +39,6 @@ The options include true, false, and "auto". ## Services - ### midea_ac_lan.set_attribute [![Service](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=midea_ac_lan.set_attribute) @@ -49,10 +52,11 @@ Set the attribute of appliance. Service data: | value | true or false | Example + ```yaml service: midea_ac_lan.set_attribute data: device_id: XXXXXXXXXXXX attribute: variable_heating value: true -``` \ No newline at end of file +``` diff --git a/doc/E3.md b/doc/E3.md index e9afee87..420f740b 100644 --- a/doc/E3.md +++ b/doc/E3.md @@ -1,7 +1,8 @@ # Gas Water Heater + ## Features -- Supports target temperature +- Supports target temperature ## Customize @@ -14,7 +15,9 @@ ``` ## Entities + ### Default entity + | EntityID | Class | Description | |--------------------------------------|--------------|---------------------| | water_heater.{DEVICEID}_water_heater | water_heater | Water heater entity | @@ -33,7 +36,6 @@ ## Services - ### midea_ac_lan.set_attribute [![Service](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=midea_ac_lan.set_attribute) @@ -47,10 +49,11 @@ Set the attribute of appliance. Service data: | value | true or false | Example + ```yaml service: midea_ac_lan.set_attribute data: device_id: XXXXXXXXXXXX attribute: smart_volume value: true -``` \ No newline at end of file +``` diff --git a/doc/E3_hans.md b/doc/E3_hans.md index 53864e2a..35eeb79f 100644 --- a/doc/E3_hans.md +++ b/doc/E3_hans.md @@ -1,5 +1,7 @@ # 燃气热水器 + ## 特性 + - 支持温度设定 ## 自定义 @@ -13,7 +15,9 @@ ``` ## 生成实体 + ### 默认生成实体 + | 实体ID | 类型 | 描述 | |--------------------------------------|--------------|-------| | water_heater.{DEVICEID}_water_heater | water_heater | 热水器实体 | @@ -45,10 +49,11 @@ | value | true or false | 示例 + ```yaml service: midea_ac_lan.set_attribute data: device_id: XXXXXXXXXXXX attribute: smart_volume value: true -``` \ No newline at end of file +``` diff --git a/doc/E6.md b/doc/E6.md index 677f32f0..f54964e9 100644 --- a/doc/E6.md +++ b/doc/E6.md @@ -1,7 +1,9 @@ # Gas Boilers ## Entities + ### Default entity + | EntityID | Class | Description | |----------------------------------------------|--------------|-----------------------------| | water_heater.{DEVICEID}_water_heater_heating | water_heater | Heating water heater entity | @@ -20,7 +22,6 @@ ## Service - ### midea_ac_lan.set_attribute [![Service](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=midea_ac_lan.set_attribute) @@ -34,10 +35,11 @@ Set the attribute of appliance. Service data: | value | true or false | Example + ```yaml service: midea_ac_lan.set_attribute data: device_id: XXXXXXXXXXXX attribute: main_power value: true -``` \ No newline at end of file +``` diff --git a/doc/E6_hans.md b/doc/E6_hans.md index 1f3ca6a8..6d481ab8 100644 --- a/doc/E6_hans.md +++ b/doc/E6_hans.md @@ -1,7 +1,9 @@ # 壁挂炉 ## 生成实体 + ### 默认实体 + | 实体ID | 类型 | 描述 | |----------------------------------------------|--------------|---------| | water_heater.{DEVICEID}_water_heater_heating | water_heater | 取暖热水器实体 | @@ -33,10 +35,11 @@ | value | true or false | 示例 + ```yaml service: midea_ac_lan.set_attribute data: device_id: XXXXXXXXXXXX attribute: main_power value: true -``` \ No newline at end of file +``` diff --git a/doc/E8.md b/doc/E8.md index 0af848e3..e2c75c6b 100644 --- a/doc/E8.md +++ b/doc/E8.md @@ -1,7 +1,9 @@ # Electric Slow Cooker ## Entities + ### Default entity + No default entity. ### Extra entities @@ -17,6 +19,6 @@ No default entity. | sensor.{DEVICEID}_target_temperature | sensor | Target Temperature | | sensor.{DEVICEID}_current_temperature | sensor | Current Temperature | - ## Service -No services. \ No newline at end of file + +No services. diff --git a/doc/E8_hans.md b/doc/E8_hans.md index 05755269..605603c3 100644 --- a/doc/E8_hans.md +++ b/doc/E8_hans.md @@ -1,7 +1,9 @@ # 慢炖锅 ## 实体 + ### 默认实体 + 无默认实体 ### 扩展实体 @@ -17,6 +19,6 @@ | sensor.{DEVICEID}_target_temperature | sensor | Target Temperature | 设定温度 | | sensor.{DEVICEID}_current_temperature | sensor | Current Temperature | 当前温度 | - ## 服务 -无服务 \ No newline at end of file + +无服务 diff --git a/doc/EA.md b/doc/EA.md index b07c5e6d..1e51d4d9 100644 --- a/doc/EA.md +++ b/doc/EA.md @@ -1,7 +1,9 @@ # Electric Rice Cooker ## Entities + ### Default entity + No default entity. ### Extra entities @@ -18,4 +20,5 @@ No default entity. | sensor.{DEVICEID}_top_temperature | sensor | Top Temperature | ## Service -No services. \ No newline at end of file + +No services. diff --git a/doc/EA_hans.md b/doc/EA_hans.md index 5e79971b..8fb91828 100644 --- a/doc/EA_hans.md +++ b/doc/EA_hans.md @@ -1,7 +1,9 @@ # 电饭煲 ## 生成实体 + ### 默认实体 + 无默认实体 ### 额外生成实体 @@ -18,4 +20,5 @@ | sensor.{DEVICEID}_top_temperature | sensor | Top Temperature | 顶部温度 | ## 服务 -无服务 \ No newline at end of file + +无服务 diff --git a/doc/EC.md b/doc/EC.md index f4907aae..ed9d7bec 100644 --- a/doc/EC.md +++ b/doc/EC.md @@ -1,7 +1,9 @@ # Electric Pressure Cooker ## Entities + ### Default entity + No default entity. ### Extra entities @@ -18,4 +20,5 @@ No default entity. | sensor.{DEVICEID}_top_temperature | sensor | Top Temperature | ## Service -No services. \ No newline at end of file + +No services. diff --git a/doc/EC_hans.md b/doc/EC_hans.md index d65529b7..5dcf98f6 100644 --- a/doc/EC_hans.md +++ b/doc/EC_hans.md @@ -1,7 +1,9 @@ # 电压力锅 ## 生成实体 + ### 默认实体 + 无默认实体 ### 额外生成实体 @@ -18,4 +20,5 @@ | sensor.{DEVICEID}_top_temperature | sensor | Top Temperature | 顶部温度 | ## 服务 -无服务 \ No newline at end of file + +无服务 diff --git a/doc/ED.md b/doc/ED.md index cfce3672..fffd2401 100644 --- a/doc/ED.md +++ b/doc/ED.md @@ -1,7 +1,9 @@ # Water Drinking Appliance ## Entities + ### Default entity + No default entity. ### Extra entities @@ -21,4 +23,5 @@ No default entity. | switch.{DEVICEID}_power | switch | Power | ## Service -No services. \ No newline at end of file + +No services. diff --git a/doc/ED_hans.md b/doc/ED_hans.md index 4bfd17c4..711d9e9e 100644 --- a/doc/ED_hans.md +++ b/doc/ED_hans.md @@ -1,7 +1,9 @@ # 饮用水设备 ## 生成实体 + ### 默认实体 + 无默认实体 ### 额外生成实体 @@ -21,4 +23,5 @@ | switch.{DEVICEID}_power | switch | Power | 电源开关 | ## 服务 -无服务 \ No newline at end of file + +无服务 diff --git a/doc/FA.md b/doc/FA.md index e8f7323d..cfc8d86b 100644 --- a/doc/FA.md +++ b/doc/FA.md @@ -1,5 +1,7 @@ # Fan + ## Features + - Supports fan speed - Supports preset mode - Supports oscillation @@ -14,7 +16,9 @@ Set the levels of the fan device except "Off" (3 by default). ``` ## Entities + ### Default entity + | EntityID | Class | Description | |--------------------|-------|-------------| | fan.{DEVICEID}_fan | fan | Fan entity | @@ -63,7 +67,8 @@ Set the attribute of appliance. Service data: | value | "Off"
"30"
"60"
"90"
"120"
"180"
"360"
"+60"
"-60"
"40" | Example -``` + +```yaml service: midea_ac_lan.set_attribute data: device_id: XXXXXXXXXXXX @@ -71,10 +76,10 @@ data: value: true ``` -``` +```yaml service: midea_ac_lan.set_attribute data: device_id: XXXXXXXXXXXX attribute: oscillation_angle value: "90" -``` \ No newline at end of file +``` diff --git a/doc/FA_hans.md b/doc/FA_hans.md index 962f14b2..33426dd0 100644 --- a/doc/FA_hans.md +++ b/doc/FA_hans.md @@ -1,5 +1,7 @@ # 电风扇 + ## 特性 + - 支持风速调节 - 支持预设模式 - 支持水平摆头 @@ -14,7 +16,9 @@ ``` ## 生成实体 + ### 默认生成实体 + | 实体ID | 类型 | 描述 | |--------------------|-----|------| | fan.{DEVICEID}_fan | fan | 风扇实体 | @@ -63,6 +67,7 @@ | value | "Off"
"30"
"60"
"90"
"120"
"180"
"360"
"+60"
"-60"
"40" | 示例 + ```yaml service: midea_ac_lan.set_attribute data: @@ -77,4 +82,4 @@ data: device_id: XXXXXXXXXXXX attribute: oscillation_angle value: "90" -``` \ No newline at end of file +``` diff --git a/doc/FB.md b/doc/FB.md index 222b6d9c..a09062fc 100644 --- a/doc/FB.md +++ b/doc/FB.md @@ -1,11 +1,14 @@ # Electric Heater ## Features + - Supports target temperature - Supports preset mode ## Entities + ### Default entity + | EntityID | Class | Description | |----------------------------|---------|----------------| | climate.{DEVICEID}_climate | climate | Climate entity | @@ -40,6 +43,7 @@ Set the attribute of appliance. Service data: | value | 1 - 10 | Example + ```yaml service: midea_ac_lan.set_attribute data: @@ -54,4 +58,4 @@ data: device_id: XXXXXXXXXXXX attribute: heating_level value: 9 -``` \ No newline at end of file +``` diff --git a/doc/FB_hans.md b/doc/FB_hans.md index 217dd5eb..a5a84463 100644 --- a/doc/FB_hans.md +++ b/doc/FB_hans.md @@ -1,11 +1,14 @@ # 电取暖器 ## Features + - 支持目标温度设定 - 支持预设模式设定 ## 生成实体 + ### 默认生成实体 + | 实体ID | 类型 | 描述 | |----------------------------|---------|-------| | climate.{DEVICEID}_climate | climate | 恒温器实体 | @@ -40,6 +43,7 @@ | value | 1 - 10 | 示例 + ```yaml service: midea_ac_lan.set_attribute data: @@ -54,4 +58,4 @@ data: device_id: XXXXXXXXXXXX attribute: heating_level value: 9 -``` \ No newline at end of file +``` diff --git a/doc/FC.md b/doc/FC.md index d02e20c6..e71b41bd 100644 --- a/doc/FC.md +++ b/doc/FC.md @@ -9,7 +9,9 @@ Set the high/low value of PM2.5 to automatically turn standby mode on or off. ``` ## Entities + ### Default entity + No default entity. ### Extra entities @@ -33,7 +35,6 @@ No default entity. ## Service - ### midea_ac_lan.set_attribute [![Service](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=midea_ac_lan.set_attribute) @@ -71,6 +72,7 @@ Set the attribute of appliance. Service data: | value | "Bright"
"Dim"
"Off" | Example + ```yaml service: midea_ac_lan.set_attribute data: @@ -85,4 +87,4 @@ data: device_id: XXXXXXXXXXXX attribute: fan_speed value: Auto -``` \ No newline at end of file +``` diff --git a/doc/FC_hans.md b/doc/FC_hans.md index e1cdfc13..f6dc04ae 100644 --- a/doc/FC_hans.md +++ b/doc/FC_hans.md @@ -9,7 +9,9 @@ ``` ## 生成实体 + ### 默认生成实体 + 无默认实体 ### 额外生成实体 @@ -84,4 +86,4 @@ data: device_id: XXXXXXXXXXXX attribute: fan_speed value: Auto -``` \ No newline at end of file +``` diff --git a/doc/FD.md b/doc/FD.md index c71371be..325d4728 100644 --- a/doc/FD.md +++ b/doc/FD.md @@ -1,11 +1,15 @@ # Humidifier + ## Features + - Supports preset mode - Supports fan mode - Supports humidity setting ## Entities + ### Default entity + | EntityID | Class | Description | |----------------------------------|------------|-------------------| | humidifier.{DEVICEID}_humidifier | humidifier | Humidifier entity | @@ -24,7 +28,6 @@ ## Service - ### midea_ac_lan.set_attribute [![Service](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=midea_ac_lan.set_attribute) @@ -50,6 +53,7 @@ Set the attribute of appliance. Service data: | value | "Bright"
"Dim"
"Off" | Example + ```yaml service: midea_ac_lan.set_attribute data: @@ -64,4 +68,4 @@ data: device_id: XXXXXXXXXXXX attribute: fan_speed value: Medium -``` \ No newline at end of file +``` diff --git a/doc/FD_hans.md b/doc/FD_hans.md index ba6be127..3cd9f5fe 100644 --- a/doc/FD_hans.md +++ b/doc/FD_hans.md @@ -1,11 +1,15 @@ # 加湿器 + ## 特性 + - 支持运行模式 - 支持风扇模式设定 - 支持湿度设定 ## 生成实体 + ### 默认生成实体 + | 实体ID | 类型 | 描述 | |----------------------------------|------------|-------| | humidifier.{DEVICEID}_humidifier | humidifier | 加湿器实体 | @@ -49,6 +53,7 @@ | value | "Bright"
"Dim"
"Off" | 示例 + ```yaml service: midea_ac_lan.set_attribute data: @@ -63,4 +68,4 @@ data: device_id: XXXXXXXXXXXX attribute: fan_speed value: Medium -``` \ No newline at end of file +``` diff --git a/scripts/run.sh b/scripts/run.sh index 1c529a66..035649a3 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -6,8 +6,8 @@ cd "$(dirname "$0")/.." # Create config dir if not present if [[ ! -d "${PWD}/config" ]]; then - mkdir -p "${PWD}/config" - hass --config "${PWD}/config" --script ensure_config + mkdir -p "${PWD}/config" + hass --config "${PWD}/config" --script ensure_config fi # Set the path to custom_components diff --git a/scripts/setup.sh b/scripts/setup.sh index 692cc8b7..43421316 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -8,6 +8,6 @@ python3 -m pip install --requirement requirements.txt # Create config dir if not present if [[ ! -d "${PWD}/config" ]]; then - mkdir -p "${PWD}/config" - hass --config "${PWD}/config" --script ensure_config -fi \ No newline at end of file + mkdir -p "${PWD}/config" + hass --config "${PWD}/config" --script ensure_config +fi