Skip to content

Commit

Permalink
Moved "Run Task" hass directory to shared config directory location a…
Browse files Browse the repository at this point in the history
…nd updated develop script and documentatation
  • Loading branch information
KThaulow committed Apr 28, 2024
1 parent 6285c48 commit 1cc3c68
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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 component code. You can configure this instance by updating the `./devcontainer/configuration.yaml` file.
In the container you will have a dedicated Home Assistant core instance running with your custom component code. You can configure this instance by updating the `config/configuration.yaml` file.

**Prerequisites**

Expand Down Expand Up @@ -37,14 +37,14 @@ The available tasks are:

Task | Description
-- | --
Run Home Assistant on port 8123 | Launch Home Assistant with your custom component code and the configuration defined in `.devcontainer/configuration.yaml`.
Run Home Assistant on port 8123 | Launch Home Assistant with your custom component code and the configuration defined in `config/configuration.yaml`.

### 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
You need to modify the `configuration.yaml` file in `config` folder
by uncommenting the line:

```yaml
Expand Down
2 changes: 0 additions & 2 deletions .devcontainer/hass/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/workspaces/home-assistant-heru/.devcontainer/hass"
"remoteRoot": "."
}
]
},
Expand Down
19 changes: 14 additions & 5 deletions scripts/develop
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/usr/bin/env bash

set -e
cd "$(dirname "$0")/../.devcontainer"

# Copy config and custom_components
cp ../config/configuration.yaml hass
cp -r ../custom_components/ hass
cd "$(dirname "$0")/.."

# Create config dir if not present
if [[ ! -d "${PWD}/config" ]]; then
mkdir -p "${PWD}/config"
hass --config "${PWD}/config" --script ensure_config
fi

# Set the path to custom_components
## This let's us have the structure we want <root>/custom_components/heru
## while at the same time have Home Assistant configuration inside <root>/config
## without resulting to symlinks.
export PYTHONPATH="${PYTHONPATH}:${PWD}/custom_components"

# Start Home Assistant
hass -c hass --debug
hass --config "${PWD}/config" --debug

0 comments on commit 1cc3c68

Please sign in to comment.