Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwentao committed Jun 26, 2024
0 parents commit ee0754c
Show file tree
Hide file tree
Showing 149 changed files with 20,555 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
# Declare the build argument VARIANT in the global scope, can be overwrite with devcontainer.json build args
ARG VARIANT=3.12
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}-bullseye

# Consume the build argument in the build stage from global scope
ARG VARIANT
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# Uninstall pre-installed tools
# They would conflict with our requirements.txt
RUN pipx uninstall mypy

# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
COPY requirements*.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements-all-${VARIANT}.txt \
&& rm -rf /tmp/pip-tmp

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "midea_lan",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"postCreateCommand": "scripts/setup.sh",
"forwardPorts": [8123],
"portsAttributes": {
"8123": {
"label": "Home Assistant",
"onAutoForward": "notify"
}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance",
"github.vscode-github-actions",
"GitHub.vscode-pull-request-github",
"ms-python.black-formatter"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"python.pythonPath": "/usr/local/bin/python3",
"python.analysis.autoSearchPaths": false,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true
}
}
},
"remoteUser": "vscode"
}
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/1-issue_zh-cn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: 错误报告
description: 集成或实体无法正常工作
labels: ["bug"]
body:
- type: input
attributes:
label: HA版本
placeholder: 2024.5.3
- type: input
validations:
required: true
attributes:
label: 集成版本
placeholder: 0.3.23
- type: input
validations:
required: true
attributes:
label: 设备类型及型号
placeholder: Air Conditioner 22012225
description: 可以在 配置 -> 设备与服务 -> Midea LAN -> 设备 -> 设备信息 找到
- type: input
validations:
required: true
attributes:
label: 使用的App
placeholder: 美的美居
description: 使用的哪个App控制设备
- type: textarea
validations:
required: true
attributes:
label: 问题详细描述
- type: textarea
attributes:
label: The logs
description: 打开Midea LAN的调试日志,并将发生错误时的日志发送或上传到这里
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/2-issue_en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
description: Integration or entity is not working right
labels: ["bug"]
body:
- type: input
attributes:
label: HA core version
placeholder: 2023.4.2
- type: input
validations:
required: true
attributes:
label: Integration version
placeholder: 0.3.18
- type: input
validations:
required: true
attributes:
label: Device type and model
placeholder: Air Conditioner 22012225
description: Can be found in Settings -> Devices & Services -> \
Midea LAN -> Devices -> Device Info
- type: input
validations:
required: true
attributes:
label: Used App
placeholder: MSmartHome
description: Which app is used to control the device
- type: textarea
validations:
required: true
attributes:
label: The description of problem
- type: textarea
attributes:
label: The logs
description: Should enable the debug log of Midea LAN, and post or \
upload the log when the error occurs to here
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/3-enhancement_zh-cn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: 新功能请求
description: 请求增加新设备支持或请求为已有设备增加新的功能
labels: ["enhancement"]
body:
- type: input
validations:
required: true
attributes:
label: 设备类型及型号 (或SN)
placeholder: Air Conditioner 22012225
description: |
> 设备型号可以在 配置 -> 设备与服务 -> Midea LAN -> 设备 -> 设备信息 找到
> SN可以在 配置 -> 设备与服务 -> Midea LAN -> 添加设备 -> Just list appliances 找到
> 出于隐私原因, 你应该将SN后10个字节隐藏
> 如将"0000BF31163200988193162YLW17116Y"替换成"0000BF3116320098819316XXXXXXXXXX"
- type: textarea
validations:
required: true
attributes:
label: 新功能的描述
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/4-enhancement_en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Enhancement
description: New feature or new device support request
labels: ["enhancement"]
body:
- type: input
validations:
required: true
attributes:
label: Device type and model (or SN)
placeholder: Air Conditioner 22012225
description: |
> The model can be found in Settings -> Devices & Services -> Midea LAN -> Devices -> Device Info
> The SN can be found in Settings -> Devices & Services -> Midea LAN -> Add device -> Just list appliances
> For privacy reason, You should mask the last 10 bytes of the SN.
> e.g., replace "0000BF31163200988193162YLW17116Y" with "0000BF3116320098819316XXXXXXXXXX"
- type: textarea
validations:
required: true
attributes:
label: The description of new feature
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
blank_issues_enabled: true
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: "pip"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
open-pull-requests-limit: 10
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
3 changes: 3 additions & 0 deletions .github/linters/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 500
extend-ignore = E128,E203,E701
4 changes: 4 additions & 0 deletions .github/linters/.python-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[FORMAT]
max-line-length=500
[MESSAGES CONTROL]
disable=import-error, logging-fstring-interpolation, missing-class-docstring,missing-function-docstring
6 changes: 6 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
extends: default
rules:
line-length:
max: 500
level: warning
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# PR Description

## Reason & Detail

## Related issue

fix #X

<!--
please change X to issue id, it will auto close this issue once PR closed
Example:
fix #1
it will auto close issue #1 once PR closed
-->
44 changes: 44 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: "CodeQL"

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
# schedule:
# - cron: "42 8 * * 6"

permissions: {}

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [python]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
21 changes: 21 additions & 0 deletions .github/workflows/issue-translator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "issue-translator"
on:
issue_comment:
types: [created]
issues:
types: [opened]

permissions:
issues: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: usthe/issues-translate-action@v2.7
with:
IS_MODIFY_TITLE: false
# not require, default false, . Decide whether to modify the issue title
# if true, the robot account @Issues-translate-bot must have modification permissions, invite @Issues-translate-bot to your project or use your custom bot.
CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿
# not require. Customize the translation robot prefix message.
45 changes: 45 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Lint

on: # yamllint disable-line rule:truthy
# push: null
pull_request: null

permissions: {}

jobs:
build:
name: Lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12", "3.11"]
os: ["windows-latest", "ubuntu-latest", "macos-latest"]

permissions:
contents: read
packages: read
# To report GitHub Actions status checks
statuses: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# super-linter needs the full git history to get the
# list of files that changed across commits
fetch-depth: 0

- uses: actions/setup-python@v5
name: Set up Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-all-${{ matrix.python-version }}.txt
shell: bash

- name: Pre-commit
uses: pre-commit/action@v3.0.1
Loading

0 comments on commit ee0754c

Please sign in to comment.