Skip to content

Commit 10db2cc

Browse files
lbbrhzndrc38
lbbrhzn
andauthoredJun 26, 2021
major restructoring (lbbrhzn#20)
* major restructoring * add bandit configuration * add requirements.txt * add more settings to the condig_flow add translations * ocpp: log errors rather than raise exception, check on "Meter.Start", rename get_configure * ocpp: use measurands defined in config_flow * Revert "ocpp: use measurands defined in config_flow" This reverts commit 3d04c5e. * ocpp: use config flow measurands to setup metrics * ocpp: tidy up unused imports * ocpp: correct exception * ocpp: revert configure websocket ping, if not supported by charger will throw warning only * update config flow for measurand selection Co-authored-by: lbbrhzn <@lbbrhzn> Co-authored-by: drc38 <[email protected]>
1 parent 952b11a commit 10db2cc

40 files changed

+1731
-520
lines changed
 

‎.devcontainer/configuration.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
default_config:
2+
3+
logger:
4+
default: info
5+
logs:
6+
custom_components.occp: debug
7+
8+
# If you need to debug uncomment the line below (doc: https://www.home-assistant.io/integrations/debugpy/)
9+
# debugpy:

‎.devcontainer/devcontainer.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
2+
{
3+
"image": "ludeeus/container:integration-debian",
4+
"name": "OCPP integration development",
5+
"context": "..",
6+
"appPort": ["9123:8123", "9000:9000"],
7+
"postCreateCommand": "container install",
8+
"extensions": [
9+
"ms-python.python",
10+
"github.vscode-pull-request-github",
11+
"ryanluker.vscode-coverage-gutters",
12+
"ms-python.vscode-pylance"
13+
],
14+
"settings": {
15+
"files.eol": "\n",
16+
"editor.tabSize": 4,
17+
"terminal.integrated.shell.linux": "/bin/bash",
18+
"python.pythonPath": "/usr/bin/python3",
19+
"python.analysis.autoSearchPaths": false,
20+
"python.linting.pylintEnabled": true,
21+
"python.linting.enabled": true,
22+
"python.formatting.provider": "black",
23+
"editor.formatOnPaste": false,
24+
"editor.formatOnSave": true,
25+
"editor.formatOnType": true,
26+
"files.trimTrailingWhitespace": true
27+
}
28+
}

‎.github/.DS_Store

6 KB
Binary file not shown.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
---
5+
6+
**Is your feature request related to a problem? Please describe.**
7+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
8+
9+
**Describe the solution you'd like**
10+
A clear and concise description of what you want to happen.
11+
12+
**Describe alternatives you've considered**
13+
A clear and concise description of any alternative solutions or features you've considered.
14+
15+
**Additional context**
16+
Add any other context or screenshots about the feature request here.

‎.github/ISSUE_TEMPLATE/issue.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Issue
3+
about: Create a report to help us improve
4+
---
5+
6+
<!-- Before you open a new issue, search through the existing issues to see if others have had the same problem.
7+
8+
Issues not containing the minimum requirements will be closed:
9+
10+
- Issues without a description (using the header is not good enough) will be closed.
11+
- Issues without debug logging will be closed.
12+
- Issues without configuration will be closed
13+
14+
-->
15+
16+
## Version of the custom_component
17+
18+
<!-- If you are not using the newest version, download and try that before opening an issue
19+
If you are unsure about the version check the const.py file.
20+
-->
21+
22+
## Configuration
23+
24+
```yaml
25+
Add your logs here.
26+
```
27+
28+
## Describe the bug
29+
30+
A clear and concise description of what the bug is.
31+
32+
## Debug log
33+
34+
<!-- To enable debug logs check this https://www.home-assistant.io/components/logger/ -->
35+
36+
```text
37+
38+
Add your logs here.
39+
40+
```

‎.github/dependabot.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: pip
8+
directory: "/.github/workflows"
9+
schedule:
10+
interval: daily
11+
- package-ecosystem: pip
12+
directory: "/"
13+
schedule:
14+
interval: daily

‎.github/labels.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
# Labels names are important as they are used by Release Drafter to decide
3+
# regarding where to record them in changelog or if to skip them.
4+
#
5+
# The repository labels will be automatically configured using this file and
6+
# the GitHub Action https://github.com/marketplace/actions/github-labeler.
7+
- name: breaking
8+
description: Breaking Changes
9+
color: bfd4f2
10+
- name: bug
11+
description: Something isn't working
12+
color: d73a4a
13+
- name: build
14+
description: Build System and Dependencies
15+
color: bfdadc
16+
- name: ci
17+
description: Continuous Integration
18+
color: 4a97d6
19+
- name: dependencies
20+
description: Pull requests that update a dependency file
21+
color: 0366d6
22+
- name: documentation
23+
description: Improvements or additions to documentation
24+
color: 0075ca
25+
- name: duplicate
26+
description: This issue or pull request already exists
27+
color: cfd3d7
28+
- name: enhancement
29+
description: New feature or request
30+
color: a2eeef
31+
- name: github_actions
32+
description: Pull requests that update Github_actions code
33+
color: "000000"
34+
- name: good first issue
35+
description: Good for newcomers
36+
color: 7057ff
37+
- name: help wanted
38+
description: Extra attention is needed
39+
color: 008672
40+
- name: invalid
41+
description: This doesn't seem right
42+
color: e4e669
43+
- name: performance
44+
description: Performance
45+
color: "016175"
46+
- name: python
47+
description: Pull requests that update Python code
48+
color: 2b67c6
49+
- name: question
50+
description: Further information is requested
51+
color: d876e3
52+
- name: refactoring
53+
description: Refactoring
54+
color: ef67c4
55+
- name: removal
56+
description: Removals and Deprecations
57+
color: 9ae7ea
58+
- name: style
59+
description: Style
60+
color: c120e5
61+
- name: testing
62+
description: Testing
63+
color: b1fc6f
64+
- name: wontfix
65+
description: This will not be worked on
66+
color: ffffff

‎.github/release-drafter.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
categories:
2+
- title: ":boom: Breaking Changes"
3+
label: "breaking"
4+
- title: ":rocket: Features"
5+
label: "enhancement"
6+
- title: ":fire: Removals and Deprecations"
7+
label: "removal"
8+
- title: ":beetle: Fixes"
9+
label: "bug"
10+
- title: ":racehorse: Performance"
11+
label: "performance"
12+
- title: ":rotating_light: Testing"
13+
label: "testing"
14+
- title: ":construction_worker: Continuous Integration"
15+
label: "ci"
16+
- title: ":books: Documentation"
17+
label: "documentation"
18+
- title: ":hammer: Refactoring"
19+
label: "refactoring"
20+
- title: ":lipstick: Style"
21+
label: "style"
22+
- title: ":package: Dependencies"
23+
labels:
24+
- "dependencies"
25+
- "build"
26+
template: |
27+
## Changes
28+
29+
$CHANGES

‎.github/workflows/constraints.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pip==21.0
2+
pre-commit==2.9.3
3+
black==20.8b1
4+
flake8==3.8.4
5+
reorder-python-imports==2.3.6

‎.github/workflows/labeler.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Manage labels
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
9+
jobs:
10+
labeler:
11+
name: Labeler
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out the repository
15+
uses: actions/checkout@v2.3.4
16+
17+
- name: Run Labeler
18+
uses: crazy-max/ghaction-github-labeler@v3.1.1
19+
with:
20+
skip-delete: true

‎.github/workflows/release-drafter.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Draft a release note
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- master
7+
jobs:
8+
draft_release:
9+
name: Release Drafter
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Run release-drafter
13+
uses: release-drafter/release-drafter@v5.13.0
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/tests.yaml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- dev
9+
pull_request:
10+
schedule:
11+
- cron: "0 0 * * *"
12+
13+
env:
14+
DEFAULT_PYTHON: 3.9
15+
16+
jobs:
17+
pre-commit:
18+
runs-on: "ubuntu-latest"
19+
name: Pre-commit
20+
steps:
21+
- name: Check out the repository
22+
uses: actions/checkout@v2.3.4
23+
24+
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
25+
uses: actions/setup-python@v2.2.1
26+
with:
27+
python-version: ${{ env.DEFAULT_PYTHON }}
28+
29+
- name: Upgrade pip
30+
run: |
31+
pip install --constraint=.github/workflows/constraints.txt pip
32+
pip --version
33+
34+
- name: Install Python modules
35+
run: |
36+
pip install --constraint=.github/workflows/constraints.txt pre-commit black flake8 reorder-python-imports
37+
38+
- name: Run pre-commit on all files
39+
run: |
40+
pre-commit run --all-files --show-diff-on-failure --color=always
41+
42+
hacs:
43+
runs-on: "ubuntu-latest"
44+
name: HACS
45+
steps:
46+
- name: Check out the repository
47+
uses: "actions/checkout@v2.3.4"
48+
49+
- name: HACS validation
50+
uses: "hacs/action@20.12.0"
51+
with:
52+
category: "integration"
53+
ignore: brands
54+
55+
hassfest:
56+
runs-on: "ubuntu-latest"
57+
name: Hassfest
58+
steps:
59+
- name: Check out the repository
60+
uses: "actions/checkout@v2.3.4"
61+
62+
- name: Hassfest validation
63+
uses: "home-assistant/actions/hassfest@master"
64+
tests:
65+
runs-on: "ubuntu-latest"
66+
name: Run tests
67+
steps:
68+
- name: Check out code from GitHub
69+
uses: "actions/checkout@v2.3.4"
70+
- name: Setup Python ${{ env.DEFAULT_PYTHON }}
71+
uses: "actions/setup-python@v2.2.1"
72+
with:
73+
python-version: ${{ env.DEFAULT_PYTHON }}
74+
- name: Install requirements
75+
run: |
76+
pip install --constraint=.github/workflows/constraints.txt pip
77+
pip install -r requirements_test.txt
78+
- name: Tests suite
79+
run: |
80+
pytest \
81+
--timeout=9 \
82+
--durations=10 \
83+
-n auto \
84+
-p no:sugar \
85+
tests

‎.pre-commit-config.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
repos:
2+
- repo: https://github.com/asottile/pyupgrade
3+
rev: v2.19.4
4+
hooks:
5+
- id: pyupgrade
6+
args: [--py37-plus]
7+
- repo: https://github.com/psf/black
8+
rev: 21.6b0
9+
hooks:
10+
- id: black
11+
args:
12+
- --safe
13+
- --quiet
14+
files: ^((custom_components|homeassistant|script|tests)/.+)?[^/]+\.py$
15+
- repo: https://github.com/codespell-project/codespell
16+
rev: v2.1.0
17+
hooks:
18+
- id: codespell
19+
args:
20+
- --ignore-words-list=hass,alot,datas,dof,dur,farenheit,hist,iff,ines,ist,lightsensor,mut,nd,pres,referer,ser,serie,te,technik,ue,uint,visability,wan,wanna,withing
21+
- --skip="./.*,*.csv,*.json"
22+
- --quiet-level=2
23+
exclude_types: [csv, json]
24+
- repo: https://gitlab.com/pycqa/flake8
25+
rev: 3.9.2
26+
hooks:
27+
- id: flake8
28+
additional_dependencies:
29+
- flake8-docstrings==1.5.0
30+
- pydocstyle==5.0.2
31+
files: ^(custom_components|homeassistant|script|tests)/.+\.py$
32+
- repo: https://github.com/PyCQA/bandit
33+
rev: 1.7.0
34+
hooks:
35+
- id: bandit
36+
args:
37+
- --quiet
38+
- --format=custom
39+
- --configfile=bandit.yaml
40+
files: ^(custom_components|homeassistant|script|tests|)/.+\.py$
41+
- repo: https://github.com/pre-commit/mirrors-isort
42+
rev: v5.9.1
43+
hooks:
44+
- id: isort
45+
- repo: https://github.com/pre-commit/pre-commit-hooks
46+
rev: v4.0.1
47+
hooks:
48+
- id: check-executables-have-shebangs
49+
stages: [manual]
50+
- id: check-json
51+
stages: [manual]
52+
- id: requirements-txt-fixer
53+
stages: [manual]
54+
- id: check-ast
55+
stages: [manual]
56+
- id: mixed-line-ending
57+
stages: [manual]
58+
args:
59+
- --fix=lf

0 commit comments

Comments
 (0)
Please sign in to comment.