You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
container-overlay/scripts/homeassistant/step/4-config.sh

36 lines
793 B

#!/bin/bash
set -ueo pipefail
export PATH="/lib/rc/bin:$PATH"
SCRIPT=$(readlink -f $0)
[[ $UID == 0 ]] && exec su - homeassistant -c "$SCRIPT"
source .venv-live/bin/activate
. /var/db/repos/container/scripts/functions.sh
. /var/db/repos/calculate/scripts/ini.sh
hass --config /etc/homeassistant >/dev/null &
id_hass=$!
echo; einfon "Check for the first start Home Assistant "
while ! curl http://127.0.0.1:8123 2>/dev/null; do
echo -n .
sleep 1
done
kill $id_hass
cat >> /etc/homeassistant/configuration.yaml <<EOF
http:
server_host: 127.0.0.1
use_x_forwarded_for: true
trusted_proxies: 127.0.0.1
recorder:
db_url: postgresql://${ini[postgresql.homeassistant_user]}:${ini[postgresql.homeassistant_password]}@127.0.0.1/${ini[postgresql.homeassistant_database]}
EOF
echo
eend