generated from ludeeus/integration_blueprint
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jesse Hills
committed
Jul 10, 2020
0 parents
commit 486ffab
Showing
25 changed files
with
902 additions
and
0 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,43 @@ | ||
## 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 compnent 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 devcontainter 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 compnent 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 Assitant core version in the container to the latest version of the `dev` branch. | ||
Install a spesific version of Home Assistant | Install a specific version of Home Assistant core in the container. |
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,8 @@ | ||
default_config: | ||
|
||
automation: !include automations.yaml | ||
|
||
logger: | ||
default: error | ||
logs: | ||
custom_components.leafspy: debug |
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,31 @@ | ||
// See https://aka.ms/vscode-remote/devcontainer.json for format details. | ||
{ | ||
"image": "ludeeus/container:integration", | ||
"context": "..", | ||
"appPort": [ | ||
"9123:8123" | ||
], | ||
"postCreateCommand": "container install", | ||
"runArgs": [ | ||
"-v", | ||
"${env:HOME}${env:USERPROFILE}/.ssh:/tmp/.ssh" | ||
], | ||
"extensions": [ | ||
"ms-python.python", | ||
"github.vscode-pull-request-github", | ||
"tabnine.tabnine-vscode" | ||
], | ||
"settings": { | ||
"files.eol": "\n", | ||
"editor.tabSize": 4, | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"python.pythonPath": "/usr/bin/python3", | ||
"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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
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,17 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
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,42 @@ | ||
--- | ||
name: Issue | ||
about: Create a report to help us improve | ||
|
||
--- | ||
|
||
<!-- Before you open a new issue, search through the existing issues to see if others have had the same problem. | ||
Issues not containing the minimum requirements will be closed: | ||
- Issues without a description (using the header is not good enough) will be closed. | ||
- Issues without debug logging will be closed. | ||
- Issues without configuration will be closed | ||
--> | ||
|
||
## Version of the custom_component | ||
<!-- If you are not using the newest version, download and try that before opening an issue | ||
If you are unsure about the version check the const.py file. | ||
--> | ||
|
||
## Configuration | ||
|
||
```yaml | ||
|
||
Add your logs here. | ||
|
||
``` | ||
|
||
## Describe the bug | ||
A clear and concise description of what the bug is. | ||
|
||
|
||
## Debug log | ||
|
||
<!-- To enable debug logs check this https://www.home-assistant.io/components/logger/ --> | ||
|
||
```text | ||
Add your logs here. | ||
``` |
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,21 @@ | ||
name: Cron actions | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
validate: | ||
runs-on: "ubuntu-latest" | ||
name: Validate | ||
steps: | ||
- uses: "actions/checkout@v2" | ||
|
||
- name: HACS validation | ||
uses: "hacs/integration/action@master" | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CATEGORY: "integration" | ||
|
||
- name: Hassfest validation | ||
uses: "home-assistant/actions/hassfest@master" |
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,31 @@ | ||
name: Pull actions | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
validate: | ||
runs-on: "ubuntu-latest" | ||
name: Validate | ||
steps: | ||
- uses: "actions/checkout@v2" | ||
|
||
- name: HACS validation | ||
uses: "hacs/integration/action@master" | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CATEGORY: "integration" | ||
|
||
- name: Hassfest validation | ||
uses: "home-assistant/actions/hassfest@master" | ||
|
||
style: | ||
runs-on: "ubuntu-latest" | ||
name: Check style formatting | ||
steps: | ||
- uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v1" | ||
with: | ||
python-version: "3.x" | ||
- run: python3 -m pip install black | ||
- run: black . |
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,34 @@ | ||
name: Push actions | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- dev | ||
|
||
jobs: | ||
validate: | ||
runs-on: "ubuntu-latest" | ||
name: Validate | ||
steps: | ||
- uses: "actions/checkout@v2" | ||
|
||
- name: HACS validation | ||
uses: "hacs/integration/action@master" | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CATEGORY: "integration" | ||
|
||
- name: Hassfest validation | ||
uses: "home-assistant/actions/hassfest@master" | ||
|
||
style: | ||
runs-on: "ubuntu-latest" | ||
name: Check style formatting | ||
steps: | ||
- uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v1" | ||
with: | ||
python-version: "3.x" | ||
- run: python3 -m pip install black | ||
- run: black . |
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 @@ | ||
__pycache__ |
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,29 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run Home Assistant on port 9123", | ||
"type": "shell", | ||
"command": "container start", | ||
"problemMatcher": [] | ||
}, | ||
{ | ||
"label": "Run Home Assistant configuration against /config", | ||
"type": "shell", | ||
"command": "container check", | ||
"problemMatcher": [] | ||
}, | ||
{ | ||
"label": "Upgrade Home Assistant to latest dev", | ||
"type": "shell", | ||
"command": "container install", | ||
"problemMatcher": [] | ||
}, | ||
{ | ||
"label": "Install a spesific version of Home Assistant", | ||
"type": "shell", | ||
"command": "container set-version", | ||
"problemMatcher": [] | ||
} | ||
] | ||
} |
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,61 @@ | ||
# Contribution guidelines | ||
|
||
Contributing to this project should be as easy and transparent as possible, whether it's: | ||
|
||
- Reporting a bug | ||
- Discussing the current state of the code | ||
- Submitting a fix | ||
- Proposing new features | ||
|
||
## Github is used for everything | ||
|
||
Github is used to host code, to track issues and feature requests, as well as accept pull requests. | ||
|
||
Pull requests are the best way to propose changes to the codebase. | ||
|
||
1. Fork the repo and create your branch from `master`. | ||
2. If you've changed something, update the documentation. | ||
3. Make sure your code lints (using black). | ||
4. Test you contribution. | ||
5. Issue that pull request! | ||
|
||
## Any contributions you make will be under the MIT Software License | ||
|
||
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. | ||
|
||
## Report bugs using Github's [issues](../../issues) | ||
|
||
GitHub issues are used to track public bugs. | ||
Report a bug by [opening a new issue](../../issues/new/choose); it's that easy! | ||
|
||
## Write bug reports with detail, background, and sample code | ||
|
||
**Great Bug Reports** tend to have: | ||
|
||
- A quick summary and/or background | ||
- Steps to reproduce | ||
- Be specific! | ||
- Give sample code if you can. | ||
- What you expected would happen | ||
- What actually happens | ||
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) | ||
|
||
People *love* thorough bug reports. I'm not even kidding. | ||
|
||
## Use a Consistent Coding Style | ||
|
||
Use [black](https://github.com/ambv/black) to make sure the code follows the style. | ||
|
||
## Test your code modification | ||
|
||
This custom component is based on [blueprint template](https://github.com/custom-components/blueprint). | ||
|
||
It comes with development environement in a container, easy to launch | ||
if you use Visual Studio Code. With this container you will have a stand alone | ||
Home Assistant instance running and already configured with the included | ||
[`.devcontainer/configuration.yaml`](https://github.com/oncleben31/ha-pool_pump/blob/master/.devcontainer/configuration.yaml) | ||
file. | ||
|
||
## License | ||
|
||
By contributing, you agree that your contributions will be licensed under its MIT License. |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Joakim Sørensen @ludeeus | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.