1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
# Setting up Home Assistant
[HA docs](https://developers.home-assistant.io/docs/development_index/)
## Tasks
Home assistant has tasks that can be run inside Vscode:
Open command palette with `F1` or `ctrl+shift+p` and search for Tasks: run task
The important ones are:
- Run Home Assistant Core
- Generate requirements
- Code Coverage
## Installing
[Set up Development Environment](https://developers.home-assistant.io/docs/development_environment)
install minimal requirements
- `pip install -r requirements.txt`
- `pip install -r requirements_test.txt`
- `pip install -r requirements_test_pre_commit.txt`
- Run task `Run Home Assistant Core` to install remaining requirements.
- install bluecurrent-api
- check if it works by running the `Code coverage` task for blue_current.
## Running
1. run task `Home Assistant Core`
2. go to [localhost:8123](http://localhost:8123)
## Testing
[Testing your code](https://developers.home-assistant.io/docs/development_testing)
- `pytest tests/components/blue_current/`
- Run task `Code coverage` (integration can be specified)
### Debugging tests
- Go to the Testing tab in VScode.
- configure tests and select pylint
- in .vscode/settings.json set `python.testing.pytestArgs` to `["tests/components/blue_current"]`
## Lint
- pylint homeassistant/components/blue_current tests/components/blue_current
- ruff --fix homeassistant/components/blue_current tests/components/blue_current
- ruff format homeassistant/components/blue_current tests/components/blue_current
- black homeassistant/components/blue_current tests/components/blue_current
- mypy homeassistant/components/blue_current tests/components/blue_current
(Tests do not have to be error free for mypy and pylint)
## Submitting changes
[Submit your work](https://developers.home-assistant.io/docs/development_submitting)
[Development Checklist](https://developers.home-assistant.io/docs/development_checklist/)
- run task `generate all requirements`
- `python3 -m script.hassfest`
- `black --fast homeassistant tests`
## Rebasing
Follow [catching up with reality](https://developers.home-assistant.io/docs/development_catching_up)
## ha-bluecurrent
A new repo called ha-bluecurrent was added because the pr to the official Home Assistant repo is still in the review phase.
With this repo the integration could be added to Home Assistant with [HACS](https://hacs.xyz/).
Right now the [url](https://github.com/bluecurrent/ha-bluecurrent) of the repo can be added as a custom integration to HACS. In the future it could also be added to hacs itself.
This repo will be deprecated when the integration is fully added official Home Assistant repo.
|