Skip to content

Commit

Permalink
update with superlinter error
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwentao committed May 16, 2024
1 parent d863512 commit c4d7814
Show file tree
Hide file tree
Showing 54 changed files with 103 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1-issue_zh-cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ body:
- type: textarea
attributes:
label: The logs
description: 打开Midea AC LAN的调试日志,并将发生错误时的日志发送或上传到这里
description: 打开Midea AC LAN的调试日志,并将发生错误时的日志发送或上传到这里
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/2-issue_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ body:
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
upload the log when the error occurs to here
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/3-enhancement_zh-cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ body:
validations:
required: true
attributes:
label: 新功能的描述
label: 新功能的描述
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/4-enhancement_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ body:
validations:
required: true
attributes:
label: The description of new feature
label: The description of new feature
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
blank_issues_enabled: true
blank_issues_enabled: true
7 changes: 7 additions & 0 deletions .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
plugins:
- json
rules:
json/*:
- error
- allowComments: true
2 changes: 1 addition & 1 deletion .github/linters/.python-lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[FORMAT]
max-line-length=500
[MESSAGES CONTROL]
disable=import-error, logging-fstring-interpolation, missing-class-docstring
disable=import-error, logging-fstring-interpolation, missing-class-docstring,missing-function-docstring
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PR Brief Description
# PR Description

## Reason & Detail

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
# schedule:
# - cron: "42 8 * * 6"

permissions: { }
permissions: {}

jobs:
analyze:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
branches:
- master

permissions: { }
permissions: {}

jobs:
build:
Expand Down Expand Up @@ -37,3 +37,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_GITLEAKS: false
VALIDATE_JSCPD: false
VALIDATE_PYTHON_PYLINT: false
VALIDATE_PYTHON_MYPY: false
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
release:
types: [released]

permissions: { }
permissions: {}

defaults:
run:
Expand All @@ -24,7 +24,8 @@ jobs:
clean: true
- name: Zip release file
run: |
apt-get update && apt-get install zip || exit 1
apt-get update || exit 1
apt-get install zip || exit 1
echo "show runner hostname"
hostname
echo "show runner user"
Expand All @@ -40,7 +41,7 @@ jobs:
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 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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
# schedule:
# - cron: "0 0 * * *"

permissions: { }
permissions: {}

jobs:
validate:
Expand Down
14 changes: 7 additions & 7 deletions README_hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@

## 安装

**在HACS中搜索'Midea AC LAN'并安装的方式当前还不可用**,请耐心等待HACS审核和处理流程。
**在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]
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**.

方式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**.
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**.

Once it done, open [Settings], [Device & services], [Integrations], [Midea AC Lan], do init config and add all your devices.
重启完成后, 打开 `[Settings]`, `[Device & services]`, `[Integrations]`, `[Midea AC Lan]`, 进行初始化设置并添加所有设备.

## 添加设备

Expand Down
28 changes: 25 additions & 3 deletions custom_components/midea_ac_lan/climate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
climate.py
"""

import logging

from homeassistant.components.climate import (
Expand Down Expand Up @@ -242,7 +243,14 @@ def set_temperature(self, **kwargs) -> None:
"""
if ATTR_TEMPERATURE not in kwargs:
return
temperature = float(int((float(kwargs.get(ATTR_TEMPERATURE)) * 2) + 0.5)) / 2
# get temperature_value
temperature_value = kwargs.get(ATTR_TEMPERATURE)
# check temperature_value is not None
if temperature_value is not None:
temperature = float(int((float(temperature_value) * 2) + 0.5)) / 2
else:
# if temperature_value None,set default value to 0.0
temperature = 0.0
hvac_mode = kwargs.get(ATTR_HVAC_MODE)
if hvac_mode == HVACMode.OFF:
self.turn_off()
Expand Down Expand Up @@ -659,7 +667,14 @@ def set_temperature(self, **kwargs) -> None:
"""
if ATTR_TEMPERATURE not in kwargs:
return
temperature = float(int((float(kwargs.get(ATTR_TEMPERATURE)) * 2) + 0.5)) / 2
# get temperature_value
temperature_value = kwargs.get(ATTR_TEMPERATURE)
# check temperature_value is not None
if temperature_value is not None:
temperature = float(int((float(temperature_value) * 2) + 0.5)) / 2
else:
# if temperature_value None,set default value to 0.0
temperature = 0.0
hvac_mode = kwargs.get(ATTR_HVAC_MODE)
if hvac_mode == HVACMode.OFF:
self.turn_off()
Expand Down Expand Up @@ -781,7 +796,14 @@ def set_temperature(self, **kwargs) -> None:
"""
if ATTR_TEMPERATURE not in kwargs:
return
temperature = float(int((float(kwargs.get(ATTR_TEMPERATURE)) * 2) + 0.5)) / 2
# get temperature_value
temperature_value = kwargs.get(ATTR_TEMPERATURE)
# check temperature_value is not None
if temperature_value is not None:
temperature = float(int((float(temperature_value) * 2) + 0.5)) / 2
else:
# if temperature_value None,set default value to 0.0
temperature = 0.0
hvac_mode = kwargs.get(ATTR_HVAC_MODE)
if hvac_mode == HVACMode.OFF:
self.turn_off()
Expand Down
15 changes: 8 additions & 7 deletions custom_components/midea_ac_lan/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
config_flow.py
"""

import os
import logging
import os
from typing import Any, Dict, List

import voluptuous as vol

Expand Down Expand Up @@ -78,12 +79,12 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
ConfigFlow
"""

available_device = []
devices = {}
found_device = {}
supports = {}
unsorted = {}
account = {}
available_device: List[Any] = []
devices: Dict[Any, Any] = {}
found_device: Dict[Any, Any] = {}
supports: Dict[Any, Any] = {}
unsorted: Dict[Any, Any] = {}
account: Dict[Any, Any] = {}
cloud = None
session = None
for device_type, device_info in MIDEA_DEVICES.items():
Expand Down
1 change: 1 addition & 0 deletions custom_components/midea_ac_lan/humidifier.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
humidifier.py
"""

import logging

from homeassistant.components.humidifier import (
Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/core/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
try:
from enum import StrEnum
except ImportError:
from ..backports.enum import StrEnum
from ..backports.myenum import StrEnum

import logging
import socket
Expand Down
1 change: 1 addition & 0 deletions custom_components/midea_ac_lan/midea/core/discover.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
discover.py
"""

import logging
import socket
from ipaddress import IPv4Network
Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/a1/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/ac/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/b0/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/b1/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/b3/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/b4/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/b6/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/bf/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/c2/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/c3/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/ca/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/cc/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/cd/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/ce/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/cf/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac_lan/midea/devices/da/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
try:
from enum import StrEnum
except ImportError:
from ...backports.enum import StrEnum
from ...backports.myenum import StrEnum

from ...core.device import MiedaDevice

Expand Down
Loading

0 comments on commit c4d7814

Please sign in to comment.