Skip to content

Commit

Permalink
Add documentation for step by step debugging (#96)
Browse files Browse the repository at this point in the history
* Add debugging doc to cookiecutter

Explain how to use the step by step debuggin with VSC and developement
container.

* Add debug doc to template

Explain tin the project generated how to do step by step debugging.
  • Loading branch information
oncleben31 authored Dec 12, 2020
1 parent a87ee05 commit 6fdd9d2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
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/).

0 comments on commit 6fdd9d2

Please sign in to comment.