From d0efa0a20219ec4c5f457d96b51bf95ff1836256 Mon Sep 17 00:00:00 2001 From: frlequ Date: Sun, 13 Oct 2024 17:37:14 +0200 Subject: [PATCH 1/9] HACS-support --- .github/workflows/hacs_check.yml | 17 +++++++++++ .github/workflows/python_check.yml | 46 ++++++++++++++++++++++++++++++ .github/workflows/validate.yaml | 18 ++++++++++++ hacs.json | 5 ++++ mypy.ini | 5 ++++ requirements.txt | 1 + requirements_dev.txt | 5 ++++ 7 files changed, 97 insertions(+) create mode 100644 .github/workflows/hacs_check.yml create mode 100644 .github/workflows/python_check.yml create mode 100644 .github/workflows/validate.yaml create mode 100644 hacs.json create mode 100644 mypy.ini create mode 100644 requirements.txt create mode 100644 requirements_dev.txt diff --git a/.github/workflows/hacs_check.yml b/.github/workflows/hacs_check.yml new file mode 100644 index 0000000..ea6cf6f --- /dev/null +++ b/.github/workflows/hacs_check.yml @@ -0,0 +1,17 @@ +name: HACS Action + +on: + push: + pull_request: + schedule: + - cron: "0 0 * * *" + +jobs: + hacs: + name: HACS Action + runs-on: "ubuntu-latest" + steps: + - name: HACS Action + uses: "hacs/action@main" + with: + category: "integration" diff --git a/.github/workflows/python_check.yml b/.github/workflows/python_check.yml new file mode 100644 index 0000000..2809d50 --- /dev/null +++ b/.github/workflows/python_check.yml @@ -0,0 +1,46 @@ +name: Python check + +on: + workflow_dispatch: + push: + branches: [ "Code-clean-up" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - home-assistant: "2024.1.0" + python-version: "3.11" + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install homeassistant~=${{ matrix.home-assistant }} + python -m pip install --upgrade pip + python -m pip install -r requirements_dev.txt + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics + - name: Type check with mypy + run: | + touch "$(python -c 'import inspect, homeassistant, os; print(os.path.dirname(inspect.getfile(homeassistant)))')"/py.typed + mypy -p custom_components.mojelektro + # - name: Analysing the code with pylint + # run: | + # pylint --max-line-length 88 $(git ls-files '*.py') + - name: Check black style + run: | + black . --check diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml new file mode 100644 index 0000000..c422ec3 --- /dev/null +++ b/.github/workflows/validate.yaml @@ -0,0 +1,18 @@ +name: Validate + +on: + push: + pull_request: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + validate-hacs: + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v3" + - name: HACS validation + uses: "hacs/action@main" + with: + category: "integration" diff --git a/hacs.json b/hacs.json new file mode 100644 index 0000000..360f506 --- /dev/null +++ b/hacs.json @@ -0,0 +1,5 @@ +{ + "name": "Moj Elektro", + "homeassistant": "2023.8.0", + "render_readme": true +} diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..ee45470 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,5 @@ +[mypy] +ignore_missing_imports = True + +[mypy-voluptuous] +ignore_missing_imports = True diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ + diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..1f92b21 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,5 @@ +black>=22.12 +flake8>=6.0 +mypy>=0.991 +pylint>=2.15 +types-requests From b544eaa952562920199115ceb1e8a581e81e6f49 Mon Sep 17 00:00:00 2001 From: frlequ Date: Sun, 13 Oct 2024 17:39:28 +0200 Subject: [PATCH 2/9] Update hacs.json --- hacs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hacs.json b/hacs.json index 360f506..ca9272e 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { - "name": "Moj Elektro", + "name": "Network Tariff", "homeassistant": "2023.8.0", "render_readme": true } From e5a72da0685948d1818e4ee01fc56e6ac30fab02 Mon Sep 17 00:00:00 2001 From: frlequ Date: Sun, 13 Oct 2024 18:46:04 +0200 Subject: [PATCH 3/9] Update --- .github/workflows/hassfest.yaml | 14 +++++++++ .github/workflows/python_check.yml | 46 ------------------------------ .github/workflows/validate.yaml | 3 +- 3 files changed, 15 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/hassfest.yaml delete mode 100644 .github/workflows/python_check.yml diff --git a/.github/workflows/hassfest.yaml b/.github/workflows/hassfest.yaml new file mode 100644 index 0000000..bf1b612 --- /dev/null +++ b/.github/workflows/hassfest.yaml @@ -0,0 +1,14 @@ +name: Validate with hassfest + +on: + push: + pull_request: + schedule: + - cron: "0 0 * * *" + +jobs: + validate: + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v3" + - uses: home-assistant/actions/hassfest@master \ No newline at end of file diff --git a/.github/workflows/python_check.yml b/.github/workflows/python_check.yml deleted file mode 100644 index 2809d50..0000000 --- a/.github/workflows/python_check.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Python check - -on: - workflow_dispatch: - push: - branches: [ "Code-clean-up" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - home-assistant: "2024.1.0" - python-version: "3.11" - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install homeassistant~=${{ matrix.home-assistant }} - python -m pip install --upgrade pip - python -m pip install -r requirements_dev.txt - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics - - name: Type check with mypy - run: | - touch "$(python -c 'import inspect, homeassistant, os; print(os.path.dirname(inspect.getfile(homeassistant)))')"/py.typed - mypy -p custom_components.mojelektro - # - name: Analysing the code with pylint - # run: | - # pylint --max-line-length 88 $(git ls-files '*.py') - - name: Check black style - run: | - black . --check diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index c422ec3..290f9af 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -1,7 +1,7 @@ name: Validate on: - push: + push: pull_request: schedule: - cron: "0 0 * * *" @@ -11,7 +11,6 @@ jobs: validate-hacs: runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v3" - name: HACS validation uses: "hacs/action@main" with: From d2137693e0c2bf426bc1983c92c517769004e7e5 Mon Sep 17 00:00:00 2001 From: frlequ Date: Sun, 13 Oct 2024 18:49:53 +0200 Subject: [PATCH 4/9] Update --- .../elektro_network_tariff/manifest.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/elektro_network_tariff/manifest.json b/custom_components/elektro_network_tariff/manifest.json index 0651cbd..bab7094 100644 --- a/custom_components/elektro_network_tariff/manifest.json +++ b/custom_components/elektro_network_tariff/manifest.json @@ -1,11 +1,11 @@ { "domain": "elektro_network_tariff", "name": "Elektro Network Tariff", - "documentation": "https://github.com/frlequ/elektro_network_tariff", - "dependencies": [], "codeowners": ["@frlequ"], - "version": "0.1.1", - "requirements": [], + "dependencies": [], + "documentation": "https://github.com/frlequ/elektro_network_tariff", "integration_type": "entity", - "iot_class": "local_polling" -} + "iot_class": "local_polling", + "requirements": [], + "version": "0.1.1" +} \ No newline at end of file From 99ae4718e5332f7999c88efe6c34a3666ead2e2c Mon Sep 17 00:00:00 2001 From: frlequ Date: Sun, 13 Oct 2024 18:52:27 +0200 Subject: [PATCH 5/9] update --- custom_components/elektro_network_tariff/manifest.json | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/elektro_network_tariff/manifest.json b/custom_components/elektro_network_tariff/manifest.json index bab7094..7c033cb 100644 --- a/custom_components/elektro_network_tariff/manifest.json +++ b/custom_components/elektro_network_tariff/manifest.json @@ -5,6 +5,7 @@ "dependencies": [], "documentation": "https://github.com/frlequ/elektro_network_tariff", "integration_type": "entity", + "issue_tracker": "https://github.com/frlequ/elektro_network_tariff/issues", "iot_class": "local_polling", "requirements": [], "version": "0.1.1" From 810604ad193e9234e2e483a952ffe9cfb8675841 Mon Sep 17 00:00:00 2001 From: frlequ Date: Sun, 13 Oct 2024 18:56:44 +0200 Subject: [PATCH 6/9] Update --- custom_components/elektro_network_tariff/manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/elektro_network_tariff/manifest.json b/custom_components/elektro_network_tariff/manifest.json index 7c033cb..b996de8 100644 --- a/custom_components/elektro_network_tariff/manifest.json +++ b/custom_components/elektro_network_tariff/manifest.json @@ -5,8 +5,8 @@ "dependencies": [], "documentation": "https://github.com/frlequ/elektro_network_tariff", "integration_type": "entity", - "issue_tracker": "https://github.com/frlequ/elektro_network_tariff/issues", "iot_class": "local_polling", "requirements": [], - "version": "0.1.1" + "version": "0.1.1", + "issue_tracker": "https://github.com/frlequ/elektro_network_tariff/issues" } \ No newline at end of file From 16134860046866dd948cfe963acb3b9e174d80d6 Mon Sep 17 00:00:00 2001 From: frlequ Date: Sun, 13 Oct 2024 19:01:51 +0200 Subject: [PATCH 7/9] Update --- custom_components/elektro_network_tariff/manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/elektro_network_tariff/manifest.json b/custom_components/elektro_network_tariff/manifest.json index b996de8..a52037f 100644 --- a/custom_components/elektro_network_tariff/manifest.json +++ b/custom_components/elektro_network_tariff/manifest.json @@ -4,9 +4,9 @@ "codeowners": ["@frlequ"], "dependencies": [], "documentation": "https://github.com/frlequ/elektro_network_tariff", + "issue_tracker": "https://github.com/frlequ/elektro_network_tariff/issues", "integration_type": "entity", "iot_class": "local_polling", "requirements": [], - "version": "0.1.1", - "issue_tracker": "https://github.com/frlequ/elektro_network_tariff/issues" + "version": "0.1.1" } \ No newline at end of file From 788e0433996ead60a16bb7d83db7f848b8f46339 Mon Sep 17 00:00:00 2001 From: frlequ Date: Sun, 13 Oct 2024 19:02:23 +0200 Subject: [PATCH 8/9] Update --- .github/workflows/hacs_check.yml | 17 ----------------- .github/workflows/validate.yaml | 17 ----------------- 2 files changed, 34 deletions(-) delete mode 100644 .github/workflows/hacs_check.yml delete mode 100644 .github/workflows/validate.yaml diff --git a/.github/workflows/hacs_check.yml b/.github/workflows/hacs_check.yml deleted file mode 100644 index ea6cf6f..0000000 --- a/.github/workflows/hacs_check.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: HACS Action - -on: - push: - pull_request: - schedule: - - cron: "0 0 * * *" - -jobs: - hacs: - name: HACS Action - runs-on: "ubuntu-latest" - steps: - - name: HACS Action - uses: "hacs/action@main" - with: - category: "integration" diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml deleted file mode 100644 index 290f9af..0000000 --- a/.github/workflows/validate.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: Validate - -on: - push: - pull_request: - schedule: - - cron: "0 0 * * *" - workflow_dispatch: - -jobs: - validate-hacs: - runs-on: "ubuntu-latest" - steps: - - name: HACS validation - uses: "hacs/action@main" - with: - category: "integration" From 3d20cee304d1e9b454f532607d95d7bdc32a3eb2 Mon Sep 17 00:00:00 2001 From: frlequ Date: Sun, 13 Oct 2024 19:04:25 +0200 Subject: [PATCH 9/9] Update --- custom_components/elektro_network_tariff/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/elektro_network_tariff/manifest.json b/custom_components/elektro_network_tariff/manifest.json index a52037f..1424bc3 100644 --- a/custom_components/elektro_network_tariff/manifest.json +++ b/custom_components/elektro_network_tariff/manifest.json @@ -4,9 +4,9 @@ "codeowners": ["@frlequ"], "dependencies": [], "documentation": "https://github.com/frlequ/elektro_network_tariff", - "issue_tracker": "https://github.com/frlequ/elektro_network_tariff/issues", "integration_type": "entity", "iot_class": "local_polling", + "issue_tracker": "https://github.com/frlequ/elektro_network_tariff/issues", "requirements": [], "version": "0.1.1" } \ No newline at end of file