Skip to content

Commit 14a4c75

Browse files
authored
Initial commit
0 parents  commit 14a4c75

34 files changed

+1135
-0
lines changed

.devcontainer.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "ludeeus/integration_blueprint",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.12",
4+
"postCreateCommand": "scripts/setup",
5+
"forwardPorts": [
6+
8123
7+
],
8+
"portsAttributes": {
9+
"8123": {
10+
"label": "Home Assistant",
11+
"onAutoForward": "notify"
12+
}
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"charliermarsh.ruff",
18+
"github.vscode-pull-request-github",
19+
"ms-python.python",
20+
"ms-python.vscode-pylance",
21+
"ryanluker.vscode-coverage-gutters"
22+
],
23+
"settings": {
24+
"files.eol": "\n",
25+
"editor.tabSize": 4,
26+
"editor.formatOnPaste": true,
27+
"editor.formatOnSave": true,
28+
"editor.formatOnType": false,
29+
"files.trimTrailingWhitespace": true,
30+
"python.analysis.typeCheckingMode": "basic",
31+
"python.analysis.autoImportCompletions": true,
32+
"python.defaultInterpreterPath": "/usr/local/bin/python",
33+
"[python]": {
34+
"editor.defaultFormatter": "charliermarsh.ruff"
35+
}
36+
}
37+
}
38+
},
39+
"remoteUser": "vscode",
40+
"features": {}
41+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/ISSUE_TEMPLATE/bug.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: "Bug report"
3+
description: "Report a bug with the integration"
4+
labels: "Bug"
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: Before you open a new issue, search through the existing issues to see if others have had the same problem.
9+
- type: textarea
10+
attributes:
11+
label: "System Health details"
12+
description: "Paste the data from the System Health card in Home Assistant (https://www.home-assistant.io/more-info/system-health#github-issues)"
13+
validations:
14+
required: true
15+
- type: checkboxes
16+
attributes:
17+
label: Checklist
18+
options:
19+
- label: I have enabled debug logging for my installation.
20+
required: true
21+
- label: I have filled out the issue template to the best of my ability.
22+
required: true
23+
- label: This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
24+
required: true
25+
- label: This issue is not a duplicate issue of any [previous issues](https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Bug%22+)..
26+
required: true
27+
- type: textarea
28+
attributes:
29+
label: "Describe the issue"
30+
description: "A clear and concise description of what the issue is."
31+
validations:
32+
required: true
33+
- type: textarea
34+
attributes:
35+
label: Reproduction steps
36+
description: "Without steps to reproduce, it will be hard to fix. It is very important that you fill out this part. Issues without it will be closed."
37+
value: |
38+
1.
39+
2.
40+
3.
41+
...
42+
validations:
43+
required: true
44+
- type: textarea
45+
attributes:
46+
label: "Debug logs"
47+
description: "To enable debug logs check this https://www.home-assistant.io/integrations/logger/, this **needs** to include _everything_ from startup of Home Assistant to the point where you encounter the issue."
48+
render: text
49+
validations:
50+
required: true
51+
52+
- type: textarea
53+
attributes:
54+
label: "Diagnostics dump"
55+
description: "Drag the diagnostics dump file here. (see https://www.home-assistant.io/integrations/diagnostics/ for info)"

.github/ISSUE_TEMPLATE/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: "Feature request"
3+
description: "Suggest an idea for this project"
4+
labels: "Feature+Request"
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: Before you open a new feature request, search through the existing feature requests to see if others have had the same idea.
9+
- type: checkboxes
10+
attributes:
11+
label: Checklist
12+
options:
13+
- label: I have filled out the template to the best of my ability.
14+
required: true
15+
- label: This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
16+
required: true
17+
- label: This issue is not a duplicate feature request of [previous feature requests](https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Feature+Request%22+).
18+
required: true
19+
20+
- type: textarea
21+
attributes:
22+
label: "Is your feature request related to a problem? Please describe."
23+
description: "A clear and concise description of what the problem is."
24+
placeholder: "I'm always frustrated when [...]"
25+
validations:
26+
required: true
27+
28+
- type: textarea
29+
attributes:
30+
label: "Describe the solution you'd like"
31+
description: "A clear and concise description of what you want to happen."
32+
validations:
33+
required: true
34+
35+
- type: textarea
36+
attributes:
37+
label: "Describe alternatives you've considered"
38+
description: "A clear and concise description of any alternative solutions or features you've considered."
39+
validations:
40+
required: true
41+
42+
- type: textarea
43+
attributes:
44+
label: "Additional context"
45+
description: "Add any other context or screenshots about the feature request here."
46+
validations:
47+
required: true

.github/dependabot.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
9+
- package-ecosystem: "pip"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
ignore:
14+
# Dependabot should not update Home Assistant as that should match the homeassistant key in hacs.json
15+
- dependency-name: "homeassistant"

.github/workflows/lint.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Lint"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- "main"
10+
11+
jobs:
12+
ruff:
13+
name: "Ruff"
14+
runs-on: "ubuntu-latest"
15+
steps:
16+
- name: "Checkout the repository"
17+
uses: "actions/[email protected]"
18+
19+
- name: "Set up Python"
20+
uses: actions/[email protected]
21+
with:
22+
python-version: "3.12"
23+
cache: "pip"
24+
25+
- name: "Install requirements"
26+
run: python3 -m pip install -r requirements.txt
27+
28+
- name: "Lint"
29+
run: python3 -m ruff check .
30+
31+
- name: "Format"
32+
run: python3 -m ruff format . --check

.github/workflows/release.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Release"
2+
3+
on:
4+
release:
5+
types:
6+
- "published"
7+
8+
permissions: {}
9+
10+
jobs:
11+
release:
12+
name: "Release"
13+
runs-on: "ubuntu-latest"
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: "Checkout the repository"
18+
uses: "actions/[email protected]"
19+
20+
- name: "ZIP the integration directory"
21+
shell: "bash"
22+
run: |
23+
cd "${{ github.workspace }}/custom_components/integration_blueprint"
24+
zip integration_blueprint.zip -r ./
25+
26+
- name: "Upload the ZIP file to the release"
27+
uses: "softprops/[email protected]"
28+
with:
29+
files: ${{ github.workspace }}/custom_components/integration_blueprint/integration_blueprint.zip

.github/workflows/validate.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Validate"
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * *"
7+
push:
8+
branches:
9+
- "main"
10+
pull_request:
11+
branches:
12+
- "main"
13+
14+
jobs:
15+
hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest
16+
name: "Hassfest Validation"
17+
runs-on: "ubuntu-latest"
18+
steps:
19+
- name: "Checkout the repository"
20+
uses: "actions/[email protected]"
21+
22+
- name: "Run hassfest validation"
23+
uses: "home-assistant/actions/hassfest@master"
24+
25+
hacs: # https://github.com/hacs/action
26+
name: "HACS Validation"
27+
runs-on: "ubuntu-latest"
28+
steps:
29+
- name: "Checkout the repository"
30+
uses: "actions/[email protected]"
31+
32+
- name: "Run HACS validation"
33+
uses: "hacs/action@main"
34+
with:
35+
category: "integration"
36+
# Remove this 'ignore' key when you have added brand images for your integration to https://github.com/home-assistant/brands
37+
ignore: "brands"

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# artifacts
2+
__pycache__
3+
.pytest*
4+
*.egg-info
5+
*/build/*
6+
*/dist/*
7+
8+
9+
# misc
10+
.coverage
11+
.vscode
12+
coverage.xml
13+
.ruff_cache
14+
15+
16+
# Home Assistant configuration
17+
config/*
18+
!config/configuration.yaml

.ruff.toml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml
2+
3+
target-version = "py312"
4+
5+
[lint]
6+
select = [
7+
"ALL",
8+
]
9+
10+
ignore = [
11+
"ANN101", # Missing type annotation for `self` in method
12+
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
13+
"D203", # no-blank-line-before-class (incompatible with formatter)
14+
"D212", # multi-line-summary-first-line (incompatible with formatter)
15+
"COM812", # incompatible with formatter
16+
"ISC001", # incompatible with formatter
17+
]
18+
19+
[lint.flake8-pytest-style]
20+
fixture-parentheses = false
21+
22+
[lint.pyupgrade]
23+
keep-runtime-typing = true
24+
25+
[lint.mccabe]
26+
max-complexity = 25

.vscode/tasks.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Run Home Assistant on port 8123",
6+
"type": "shell",
7+
"command": "scripts/develop",
8+
"problemMatcher": []
9+
}
10+
]
11+
}

CONTRIBUTING.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Contribution guidelines
2+
3+
Contributing to this project should be as easy and transparent as possible, whether it's:
4+
5+
- Reporting a bug
6+
- Discussing the current state of the code
7+
- Submitting a fix
8+
- Proposing new features
9+
10+
## Github is used for everything
11+
12+
Github is used to host code, to track issues and feature requests, as well as accept pull requests.
13+
14+
Pull requests are the best way to propose changes to the codebase.
15+
16+
1. Fork the repo and create your branch from `main`.
17+
2. If you've changed something, update the documentation.
18+
3. Make sure your code lints (using `scripts/lint`).
19+
4. Test you contribution.
20+
5. Issue that pull request!
21+
22+
## Any contributions you make will be under the MIT Software License
23+
24+
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
25+
26+
## Report bugs using Github's [issues](../../issues)
27+
28+
GitHub issues are used to track public bugs.
29+
Report a bug by [opening a new issue](../../issues/new/choose); it's that easy!
30+
31+
## Write bug reports with detail, background, and sample code
32+
33+
**Great Bug Reports** tend to have:
34+
35+
- A quick summary and/or background
36+
- Steps to reproduce
37+
- Be specific!
38+
- Give sample code if you can.
39+
- What you expected would happen
40+
- What actually happens
41+
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
42+
43+
People *love* thorough bug reports. I'm not even kidding.
44+
45+
## Use a Consistent Coding Style
46+
47+
Use [black](https://github.com/ambv/black) to make sure the code follows the style.
48+
49+
## Test your code modification
50+
51+
This custom component is based on [integration_blueprint template](https://github.com/ludeeus/integration_blueprint).
52+
53+
It comes with development environment in a container, easy to launch
54+
if you use Visual Studio Code. With this container you will have a stand alone
55+
Home Assistant instance running and already configured with the included
56+
[`configuration.yaml`](./config/configuration.yaml)
57+
file.
58+
59+
## License
60+
61+
By contributing, you agree that your contributions will be licensed under its MIT License.

0 commit comments

Comments
 (0)