Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for step by step debugging #96

Merged
merged 2 commits into from
Dec 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Features
- Ready to use Home Assistant custom component
- UI configuration with config Flow
- Translations
- Development and testing in Visual Studio Code development container
- Development, testing and step by step debugging in Visual Studio Code development container
- HACS_ ready
- Continuous integration with `GitHub Actions`_
- Settings for pre-commit
Expand Down Expand Up @@ -181,6 +181,23 @@ The template have already the tools do do that: ``hacs.json`` and ``info.md`` fi
The `Publish documentation`_ explains how to set those files
and the different options you have to integrate your custom component in the HACS network.

Step by step debugging
^^^^^^^^^^^^^^^^^^^^^^

If you choose to use Visual Studio Code 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:

.. code :: 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`_.

Known limitations
-----------------
Expand Down Expand Up @@ -218,6 +235,7 @@ Known limitations
.. _PTVSD: https://www.home-assistant.io/integrations/ptvsd/
.. _Publish documentation: https://hacs.xyz/docs/publish/start
.. _pyenv: https://github.com/pyenv/pyenv
.. _the Remote Python Debugger integration documentation: https://www.home-assistant.io/integrations/debugpy/
.. _Visual Studio Code: https://code.visualstudio.com/
.. _Visual Studio Code Remote - Containers: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
.. references-end
17 changes: 17 additions & 0 deletions {{cookiecutter.project_name}}/.devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,20 @@ The available tasks are:
| 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/).