Created
March 22, 2023 09:47
-
-
Save kchiem/dcff9b0fb4faa3cc0b454e43894f0efc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## | |
## Run this inside your Home Assistant docker container to update the files | |
## needed for https://github.com/Blackymas/NSPanel_HA_Blueprint. Eg. | |
## | |
## $ docker exec -it homeassistant bash | |
## # bash -c "$(wget -qO - <raw gist url>)" | |
## | |
# exit immediately on errors | |
set -e | |
latest=$(curl --silent https://api.github.com/repos/Blackymas/NSPanel_HA_Blueprint/releases/latest | jq -r .tag_name) | |
read -p "Update to version $latest? (y/n) " yn | |
case $yn in | |
[Yy]) ;; | |
*) exit;; | |
esac | |
tmpdir=$(mktemp -d) | |
pushd "$tmpdir" >/dev/null | |
archive="https://github.com/Blackymas/NSPanel_HA_Blueprint/archive/refs/tags/$latest.tar.gz" | |
echo - downloading | |
curl -L# "$archive" | tar xzf - | |
dl="$tmpdir/NSPanel_HA_Blueprint-$latest" | |
echo - archive extracted into "$dl" | |
echo - updating nspanel_blueprint.yaml | |
cp $dl/nspanel_blueprint.yaml /config/blueprints/automation/Blackymas/. | |
for tft in nspanel_{eu,us}.tft; do | |
if [ -f /config/www/"$tft" ]; then | |
echo - updating http://homeassistant.local:8123/local/$tft | |
cp $dl/$tft /config/www/. | |
fi | |
done | |
echo - cleaning up | |
popd >/dev/null | |
rm -r "$tmpdir" | |
echo - you need to restart HA and update your NSPanels in ESPHome now | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The output should look something like this: