diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 01793e1..00a6505 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,31 +1,42 @@ // See https://aka.ms/vscode-remote/devcontainer.json for format details. { - "image": "ghcr.io/ludeeus/devcontainer/integration:stable", + "image": "mcr.microsoft.com/devcontainers/python:3.12", "name": "Nordpool integration development", - "context": "..", "appPort": [ "9123:8123" ], - "postCreateCommand": "container install", - "extensions": [ - "ms-python.python", - "github.vscode-pull-request-github", - "ryanluker.vscode-coverage-gutters", - "ms-python.vscode-pylance" + // Mount the path to custom_components + // This let's us have the structure we want /custom_components/integration_blueprint + // while at the same time have Home Assistant configuration inside /config + // without resulting to symlinks. + "mounts": [ + "source=${localWorkspaceFolder}/custom_components,target=${containerWorkspaceFolder}/config/custom_components,type=bind,consistency=cached" ], - "settings": { - "files.eol": "\n", - "editor.tabSize": 4, - "terminal.integrated.shell.linux": "/bin/bash", - "python.pythonPath": "/usr/bin/python3", - "python.analysis.autoSearchPaths": false, - "python.linting.pylintEnabled": true, - "python.linting.enabled": true, - "python.formatting.provider": "black", - "editor.formatOnPaste": false, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "files.trimTrailingWhitespace": true - } - + "postCreateCommand": "scripts/setup", + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "github.vscode-pull-request-github", + "ryanluker.vscode-coverage-gutters", + "ms-python.vscode-pylance" + ], + "settings": { + "files.eol": "\n", + "editor.tabSize": 4, + "terminal.integrated.shell.linux": "/bin/bash", + "python.pythonPath": "/usr/bin/python3", + "python.analysis.autoSearchPaths": false, + "python.linting.pylintEnabled": true, + "python.linting.enabled": true, + "python.formatting.provider": "black", + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true + } + } + }, + "remoteUser": "vscode", + "features": {} } \ No newline at end of file diff --git a/.gitignore b/.gitignore index af6d502..32c93c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# Home Assistant configuration +config/* +!config/configuration.yaml + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7ab4ba8..e8062f2 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,26 +4,8 @@ { "label": "Run Home Assistant on port 9123", "type": "shell", - "command": "container start", + "command": "scripts/dev", "problemMatcher": [] }, - { - "label": "Run Home Assistant configuration against /config", - "type": "shell", - "command": "container check", - "problemMatcher": [] - }, - { - "label": "Upgrade Home Assistant to latest dev", - "type": "shell", - "command": "container install", - "problemMatcher": [] - }, - { - "label": "Install a specific version of Home Assistant", - "type": "shell", - "command": "container set-version", - "problemMatcher": [] - } ] } \ No newline at end of file diff --git a/.devcontainer/configuration.yaml b/config/configuration.yaml similarity index 100% rename from .devcontainer/configuration.yaml rename to config/configuration.yaml diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..75e6d3f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +colorlog==6.8.2 +homeassistant==2024.6.4 +pip>=21.3.1 +numpy diff --git a/scripts/dev b/scripts/dev old mode 100644 new mode 100755 index 8174444..67f86c9 --- a/scripts/dev +++ b/scripts/dev @@ -10,12 +10,6 @@ if [[ ! -d "${PWD}/config" ]]; then hass --config "${PWD}/config" --script ensure_config fi -# Set the path to custom_components -## This let's us have the structure we want /custom_components/integration_blueprint -## while at the same time have Home Assistant configuration inside /config -## without resulting to symlinks. -export PYTHONPATH="${PYTHONPATH}:${PWD}/custom_components" - echo $PWD # Start Home Assistant diff --git a/scripts/setup b/scripts/setup old mode 100644 new mode 100755