Skip to content

Commit 1e57eaf

Browse files
committed
Initial commit
0 parents  commit 1e57eaf

26 files changed

+1297
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM python:3.7
2+
3+
RUN apt-get update \
4+
&& apt-get install -y --no-install-recommends \
5+
git \
6+
&& apt-get clean \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
RUN python -m pip install --upgrade colorlog black pylint
10+
RUN python -m pip install --upgrade git+git://github.com/home-assistant/home-assistant.git@dev
11+
RUN cd && mkdir -p /config/custom_components
12+
13+
14+
WORKDIR /workspace
15+
16+
# Set the default shell to bash instead of sh
17+
ENV SHELL /bin/bash

.devcontainer/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Devcontainer
2+
3+
_The easiest way to contribute to and/or test this repository._
4+
5+
## Requirements
6+
7+
- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
8+
- [docker](https://docs.docker.com/install/)
9+
- [VS Code](https://code.visualstudio.com/)
10+
- [Remote - Containers (VSC Extention)](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
11+
12+
[More info about requirements and devcontainer in general](https://code.visualstudio.com/docs/remote/containers#_getting-started)
13+
14+
## How to use Devcontainer for development/test
15+
16+
1. Make sure your computer meets the requirements.
17+
1. Fork this repository.
18+
1. Clone the repository to your computer.
19+
1. Open the repository using VS Code.
20+
21+
When you open this repository with VSCode and your computer meets the requirements you are asked to "Reopen in Container", do that.
22+
23+
![reopen](images/reopen.png)
24+
25+
If you don't see this notification, open the command pallet (ctrl+shift+p) and select `Remote-Containers: Reopen Folder in Container`.
26+
27+
_It will now build the devcontainer._
28+
29+
The container have some "tasks" to help you testing your changes.
30+
31+
## Custom Tasks in this repository
32+
33+
_Start "tasks" by opening the the command pallet (ctrl+shift+p) and select `Tasks: Run Task`_
34+
35+
Running tasks like `Start Home Assistant on port 8124` can be restarted by opening the the command pallet (ctrl+shift+p) and select `Tasks: Restart Running Task`, then select the task you want to restart.
36+
37+
### Start Home Assistant on port 8124
38+
39+
This will copy the configuration and the integration files to the expected location in the container.
40+
41+
And start up Home Assistant on [port 8124.](http://localhost:8124)
42+
43+
### Upgrade Home Assistant to latest dev
44+
45+
This will upgrade Home Assistant to the latest dev version.
46+
47+
### Set Home Assistant Version
48+
49+
This allows you to specify a version of Home Assistant to install inside the devcontainer.
50+
51+
### Home Assistant Config Check
52+
53+
This runs a config check to make sure your config is valid.

.devcontainer/configuration.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
default_config:
2+
logger:
3+
default: error
4+
logs:
5+
custom_components.blueprint: debug
6+
7+
8+
9+
blueprint:
10+
username: my_username
11+
password: my_password
12+
binary_sensor:
13+
- enabled: true
14+
name: My custom name
15+
sensor:
16+
- enabled: true
17+
name: My custom name
18+
switch:
19+
- enabled: true
20+
name: My custom name

.devcontainer/custom_component_helper

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
function StartHomeAssistant {
4+
echo "Copy configuration.yaml"
5+
cp -f .devcontainer/configuration.yaml /config || echo ".devcontainer/configuration.yaml are missing!" exit 1
6+
7+
echo "Copy the custom component"
8+
rm -R /config/custom_components/ || echo ""
9+
cp -r custom_components /config/custom_components/ || echo "Could not copy the custom_component" exit 1
10+
11+
echo "Start Home Assistant"
12+
hass -c /config
13+
}
14+
15+
function UpdgradeHomeAssistantDev {
16+
python -m pip install --upgrade git+git://github.com/home-assistant/home-assistant.git@dev
17+
}
18+
19+
function SetHomeAssistantVersion {
20+
read -p 'Version: ' version
21+
python -m pip install --upgrade homeassistant==$version
22+
}
23+
24+
function HomeAssistantConfigCheck {
25+
hass -c /config --script check_config
26+
}

.devcontainer/devcontainer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
2+
{
3+
"context": "..",
4+
"dockerFile": "Dockerfile",
5+
"appPort": "8124:8123",
6+
"runArgs": [
7+
"-e",
8+
"GIT_EDTIOR='code --wait'"
9+
],
10+
"extensions": [
11+
"ms-python.python",
12+
"tabnine.tabnine-vscode"
13+
],
14+
"settings": {
15+
"python.pythonPath": "/usr/local/bin/python",
16+
"python.linting.pylintEnabled": true,
17+
"python.linting.enabled": true,
18+
"python.formatting.provider": "black",
19+
"editor.formatOnPaste": false,
20+
"editor.formatOnSave": true,
21+
"editor.formatOnType": true,
22+
"files.trimTrailingWhitespace": true
23+
}
24+
}

.devcontainer/images/reopen.png

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

.github/ISSUE_TEMPLATE/issue.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Issue
3+
about: Create a report to help us improve
4+
5+
---
6+
7+
<!-- Before you open a new issue, search through the existing issues to see if others have had the same problem.
8+
9+
Issues not containing the minimum requirements will be closed:
10+
11+
- Issues without a description (using the header is not good enough) will be closed.
12+
- Issues without debug logging will be closed.
13+
- Issues without configuration will be closed
14+
15+
-->
16+
17+
## Version of the custom_component
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+
26+
Add your logs here.
27+
28+
```
29+
30+
## Describe the bug
31+
A clear and concise description of what the bug is.
32+
33+
34+
## Debug log
35+
36+
<!-- To enable debug logs check this https://www.home-assistant.io/components/logger/ -->
37+
38+
```text
39+
40+
Add your logs here.
41+
42+
```

.github/settings.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
repository:
2+
private: false
3+
has_issues: true
4+
has_projects: false
5+
has_wiki: false
6+
has_downloads: false
7+
default_branch: master
8+
allow_squash_merge: true
9+
allow_merge_commit: false
10+
allow_rebase_merge: false
11+
labels:
12+
- name: "Feature Request"
13+
color: "fbca04"
14+
- name: "Bug"
15+
color: "b60205"
16+
- name: "Wont Fix"
17+
color: "ffffff"
18+
- name: "Enhancement"
19+
color: a2eeef
20+
- name: "Documentation"
21+
color: "008672"
22+
- name: "Stale"
23+
color: "930191"

.vscode/tasks.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Start Home Assistant on port 8124",
6+
"type": "shell",
7+
"command": "source .devcontainer/custom_component_helper && StartHomeAssistant",
8+
"group": {
9+
"kind": "test",
10+
"isDefault": true,
11+
},
12+
"presentation": {
13+
"reveal": "always",
14+
"panel": "new"
15+
},
16+
"problemMatcher": []
17+
},
18+
{
19+
"label": "Upgrade Home Assistant to latest dev",
20+
"type": "shell",
21+
"command": "source .devcontainer/custom_component_helper && UpdgradeHomeAssistantDev",
22+
"group": {
23+
"kind": "test",
24+
"isDefault": true,
25+
},
26+
"presentation": {
27+
"reveal": "always",
28+
"panel": "new"
29+
},
30+
"problemMatcher": []
31+
},
32+
{
33+
"label": "Set Home Assistant Version",
34+
"type": "shell",
35+
"command": "source .devcontainer/custom_component_helper && SetHomeAssistantVersion",
36+
"group": {
37+
"kind": "test",
38+
"isDefault": true,
39+
},
40+
"presentation": {
41+
"reveal": "always",
42+
"panel": "new"
43+
},
44+
"problemMatcher": []
45+
},
46+
{
47+
"label": "Home Assistant Config Check",
48+
"type": "shell",
49+
"command": "source .devcontainer/custom_component_helper && HomeAssistantConfigCheck",
50+
"group": {
51+
"kind": "test",
52+
"isDefault": true,
53+
},
54+
"presentation": {
55+
"reveal": "always",
56+
"panel": "new"
57+
},
58+
"problemMatcher": []
59+
}
60+
]
61+
}

0 commit comments

Comments
 (0)