From 1780ebdec948a9dfe7e94028dada7db37a2d0250 Mon Sep 17 00:00:00 2001 From: KartoffelToby Date: Tue, 19 Sep 2023 17:14:55 +0200 Subject: [PATCH] [TASK] change dev env to fix serveral problems --- scripts/setup | 7 +++++++ scripts/start | 20 ++++++++++++++++++++ scripts/sync | 11 +++++++++++ scripts/upgrade-dev | 9 +++++++++ scripts/upgrade-version | 13 +++++++++++++ 5 files changed, 60 insertions(+) create mode 100755 scripts/setup create mode 100755 scripts/start create mode 100755 scripts/sync create mode 100755 scripts/upgrade-dev create mode 100755 scripts/upgrade-version diff --git a/scripts/setup b/scripts/setup new file mode 100755 index 00000000..955f1430 --- /dev/null +++ b/scripts/setup @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +python3 -m pip install --requirement requirements.dev.txt \ No newline at end of file diff --git a/scripts/start b/scripts/start new file mode 100755 index 00000000..17b2b1b9 --- /dev/null +++ b/scripts/start @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +# Create config dir if not present +if [[ ! -d "${PWD}/.haconfig" ]]; then + mkdir -p "${PWD}/.haconfig" + hass --config "${PWD}/.haconfig" --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" + +# Start Home Assistant +hass --config "${PWD}/.haconfig" --debug \ No newline at end of file diff --git a/scripts/sync b/scripts/sync new file mode 100755 index 00000000..2303a243 --- /dev/null +++ b/scripts/sync @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +echo "Syncing configuration.yaml" + +cp -f .devcontainer/configuration.yaml ${PWD}/.haconfig/configuration.yaml + +echo "Done. Restart Home Assistant to see changes." \ No newline at end of file diff --git a/scripts/upgrade-dev b/scripts/upgrade-dev new file mode 100755 index 00000000..6612e967 --- /dev/null +++ b/scripts/upgrade-dev @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +python3 -m pip install homeassistant + +echo "Done." \ No newline at end of file diff --git a/scripts/upgrade-version b/scripts/upgrade-version new file mode 100755 index 00000000..5a24b5e3 --- /dev/null +++ b/scripts/upgrade-version @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e + +read -p "What HA Version? " VERSION +echo "Installing ${my_var}!" + + +cd "$(dirname "$0")/.." + +python3 -m pip install homeassistant==$VERSION + +echo "Done." \ No newline at end of file