-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'template/master' into develop
# Conflicts: # .editorconfig # .gitattributes # .github/ISSUE_TEMPLATE/bug_report.md # .github/ISSUE_TEMPLATE/feature_request.md # .github/PULL_REQUEST_TEMPLATE.md # .github/settings.yml # .github/workflows/release.yml # .gitignore # .pre-commit-config.yaml # CONTRIBUTING.md # LICENSE.md # README.md # bin/gen_releasenotes # bin/release # bin/run-in-env # bin/setup # bin/update # bin/update_requirements # hacs.json # info.md # requirements-dev.txt # requirements.txt # setup.cfg
- Loading branch information
Showing
53 changed files
with
1,425 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## Developing with Visual Studio Code + devcontainer | ||
|
||
The easiest way to get started with custom integration development is to use Visual Studio Code with devcontainers. This approach will create a preconfigured development environment with all the tools you need. | ||
|
||
In the container you will have a dedicated Home Assistant core instance running with your custom component code. You can configure this instance by updating the `./devcontainer/configuration.yaml` file. | ||
|
||
**Prerequisites** | ||
|
||
- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) | ||
- Docker | ||
- For Linux, macOS, or Windows 10 Pro/Enterprise/Education use the [current release version of Docker](https://docs.docker.com/install/) | ||
- Windows 10 Home requires [WSL 2](https://docs.microsoft.com/windows/wsl/wsl2-install) and the current Edge version of Docker Desktop (see instructions [here](https://docs.docker.com/docker-for-windows/wsl-tech-preview/)). This can also be used for Windows Pro/Enterprise/Education. | ||
- [Visual Studio code](https://code.visualstudio.com/) | ||
- [Remote - Containers (VSC Extension)][extension-link] | ||
|
||
[More info about requirements and devcontainer in general](https://code.visualstudio.com/docs/remote/containers#_getting-started) | ||
|
||
[extension-link]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers | ||
|
||
**Getting started:** | ||
|
||
1. Fork the repository. | ||
2. Clone the repository to your computer. | ||
3. Open the repository using Visual Studio code. | ||
|
||
When you open this repository with Visual Studio code you are asked to "Reopen in Container", this will start the build of the container. | ||
|
||
_If you don't see this notification, open the command palette and select `Remote-Containers: Reopen Folder in Container`._ | ||
|
||
### Tasks | ||
|
||
The devcontainer comes with some useful tasks to help you with development, you can start these tasks by opening the command palette and select `Tasks: Run Task` then select the task you want to run. | ||
|
||
When a task is currently running (like `Run Home Assistant on port 9123` for the docs), it can be restarted by opening the command palette and selecting `Tasks: Restart Running Task`, then select the task you want to restart. | ||
|
||
The available tasks are: | ||
|
||
Task | Description | ||
-- | -- | ||
Run Home Assistant on port 9123 | Launch Home Assistant with your custom component code and the configuration defined in `.devcontainer/configuration.yaml`. | ||
Run Home Assistant configuration against /config | Check the configuration. | ||
Upgrade Home Assistant to latest dev | Upgrade the Home Assistant core version in the container to the latest version of the `dev` branch. | ||
Install a specific version of Home Assistant | Install a specific version of Home Assistant core in the container. | ||
|
||
### Step by Step debugging | ||
|
||
With the development container, | ||
you can test your custom component in Home Assistant with step by step debugging. | ||
|
||
You need to modify the `configuration.yaml` file in `.devcontainer` folder | ||
by uncommenting the line: | ||
|
||
```yaml | ||
# debugpy: | ||
``` | ||
|
||
Then launch the task `Run Home Assistant on port 9123`, and launch the debbuger | ||
with the existing debugging configuration `Python: Attach Local`. | ||
|
||
For more information, look at [the Remote Python Debugger integration documentation](https://www.home-assistant.io/integrations/debugpy/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
default_config: | ||
|
||
logger: | ||
default: info | ||
logs: | ||
custom_components.integration_blueprint: debug | ||
|
||
# If you need to debug uncomment the line below (doc: https://www.home-assistant.io/integrations/debugpy/) | ||
# debugpy: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// See https://aka.ms/vscode-remote/devcontainer.json for format details. | ||
{ | ||
"image": "ludeeus/container:integration-debian", | ||
"name": "Blueprint integration development", | ||
"context": "..", | ||
"appPort": [ | ||
"9123:8123" | ||
], | ||
"postCreateCommand": "container install", | ||
"extensions": [ | ||
"ms-python.python", | ||
"github.vscode-pull-request-github", | ||
"ryanluker.vscode-coverage-gutters", | ||
"ms-python.vscode-pylance" | ||
], | ||
"settings": { | ||
"files.eol": "\n", | ||
"editor.tabSize": 4, | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"python.pythonPath": "/usr/bin/python3", | ||
"python.analysis.autoSearchPaths": false, | ||
"python.linting.pylintEnabled": true, | ||
"python.linting.enabled": true, | ||
"python.formatting.provider": "black", | ||
"editor.formatOnPaste": false, | ||
"editor.formatOnSave": true, | ||
"editor.formatOnType": true, | ||
"files.trimTrailingWhitespace": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
* text=auto eol=lf | ||
|
||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
|
||
/docs export-ignore | ||
README.md export-ignore | ||
tracker.json export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# These are supported funding model platforms | ||
|
||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
patreon: limych | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
custom: [ | ||
"https://sochain.com/a/mjz640g" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Basic set up for three package managers | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
# Workflow files stored in the | ||
# default location of `.github/workflows` | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,103 @@ | ||
repository: | ||
# Either `true` to make the repository private, or `false` to make it public. | ||
private: false | ||
|
||
# Either `true` to enable issues for this repository, `false` to disable them. | ||
has_issues: true | ||
|
||
# Either `true` to enable projects for this repository, or `false` to disable them. | ||
# If projects are disabled for the organization, passing `true` will cause an API error. | ||
has_projects: false | ||
|
||
# Either `true` to enable the wiki for this repository, `false` to disable it. | ||
has_wiki: false | ||
|
||
# Either `true` to enable downloads for this repository, `false` to disable them. | ||
has_downloads: false | ||
|
||
# Updates the default branch for this repository. | ||
default_branch: master | ||
|
||
# Either `true` to allow merging pull requests with a merge commit, or `false` | ||
# to prevent merging pull requests with merge commits. | ||
allow_merge_commit: true | ||
|
||
# Either `true` to allow squash-merging pull requests, or `false` to prevent | ||
# squash-merging. | ||
allow_squash_merge: true | ||
allow_merge_commit: false | ||
|
||
# Either `true` to allow rebase-merging pull requests, or `false` to prevent | ||
# rebase-merging. | ||
allow_rebase_merge: false | ||
|
||
labels: | ||
- name: "breaking" | ||
color: ffcc00 | ||
description: "Breaking change." | ||
- name: "bug" | ||
color: "d73a4a" | ||
color: d73a4a | ||
description: "Something isn't working." | ||
- name: "dependencies" | ||
color: 0366d6 | ||
description: "Pull requests that update a dependency file." | ||
- name: "documentation" | ||
color: "0075ca" | ||
color: 0075ca | ||
description: "Improvements or additions to documentation." | ||
- name: "duplicate" | ||
color: "cfd3d7" | ||
color: cfd3d7 | ||
description: "This issue or pull request already exists." | ||
- name: "enhancement" | ||
color: "a2eeef" | ||
color: a2eeef | ||
description: "New feature or request." | ||
- name: "invalid" | ||
color: "e4e669" | ||
color: e4e669 | ||
description: "This doesn't seem right." | ||
- name: "stale" | ||
color: "930191" | ||
color: 930191 | ||
description: "Stale issues and PRs." | ||
- name: "question" | ||
color: "dd9c2c" | ||
color: dd9c2c | ||
description: "Further information is requested." | ||
- name: "tests" | ||
color: bfd4f2 | ||
description: "CI, CD and testing related changes." | ||
- name: "wontfix" | ||
color: "ffffff" | ||
color: ffffff | ||
description: "This will not be worked on." | ||
|
||
branches: | ||
- name: master | ||
# https://developer.github.com/v3/repos/branches/#update-branch-protection | ||
# Branch Protection settings. Set to null to disable | ||
protection: | ||
# Required. Require at least one approving review on a pull request, before | ||
# merging. Set to null to disable. | ||
required_pull_request_reviews: | ||
# The number of approvals required. (1-6) | ||
required_approving_review_count: 1 | ||
# Dismiss approved reviews automatically when a new commit is pushed. | ||
dismiss_stale_reviews: true | ||
# Blocks merge until code owners have reviewed. | ||
require_code_owner_reviews: true | ||
# Specify which users and teams can dismiss pull request reviews. Pass an empty | ||
# dismissal_restrictions object to disable. User and team dismissal_restrictions | ||
# are only available for organization-owned repositories. Omit this parameter | ||
# for personal repositories. | ||
dismissal_restrictions: | ||
users: [] | ||
teams: [] | ||
# Required. Require status checks to pass before merging. Set to null to disable. | ||
required_status_checks: | ||
# Required. Require branches to be up to date before merging. | ||
strict: true | ||
# Required. The list of status checks to require in order to merge into this branch. | ||
contexts: [] | ||
# Required. Enforce all configured restrictions for administrators. Set to true to | ||
# enforce required status checks for repository administrators. Set to null to disable. | ||
enforce_admins: true | ||
# Required. Restrict who can push to this branch. Team and user restrictions are | ||
# only available for organization-owned repositories. Set to null to disable. | ||
restrictions: | ||
apps: [] | ||
users: [] | ||
teams: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
name: "Python Find Dead Code" | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
lint: | ||
name: "Find Dead Code" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@master | ||
|
||
- run: | | ||
echo "package=$(ls -F | grep \/$ | grep -v "bin\|examples\|tests" | sed -n "s/\///g;1p")" >> $GITHUB_ENV | ||
- name: "Set up Python" | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: "Cache pip" | ||
uses: actions/cache@v2.1.4 | ||
with: | ||
# This path is specific to Ubuntu | ||
path: ~/.cache/pip | ||
# Look to see if there is a cache hit for the corresponding requirements file | ||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: "Install dependencies" | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements-test.txt ]; then | ||
pip install -r requirements-test.txt | ||
elif [ -f requirements-dev.txt ]; then | ||
pip install -r requirements-dev.txt | ||
elif [ -f requirements.txt ]; then | ||
pip install -r requirements.txt | ||
fi | ||
pip install flake8-eradicate | ||
if [ -d custom_components ]; then | ||
echo '"""Stub."""' >custom_components/__init__.py | ||
fi | ||
- name: "Lint with flake8 & mypy" | ||
run: | | ||
flake8 ${{ env.package }} tests | ||
mypy --warn-unreachable ${{ env.package }} tests |
Oops, something went wrong.