HA-Addon make evcc.yaml optional and enhance config and database migration handling (#24936)

This commit is contained in:
thecem 2025-11-01 12:49:55 +01:00 • committed by GitHub
parent 9fceda7346
commit 2f48158655
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,10 +31,9 @@ if [ -f ${HASSIO_OPTIONSFILE} ]; then
fi
echo "Using config file: ${CONFIG}"
if [ ! -f "${CONFIG}" ]; then
echo "Config not found. Please create a config under ${CONFIG}."
echo "For details see evcc documentation at https://github.com/evcc-io/evcc#readme."
else
echo "Using database file: ${SQLITE_FILE}"
if [ -f "${CONFIG}" ]; then
if [ "${SQLITE_FILE}" ]; then
echo "starting evcc: 'EVCC_DATABASE_DSN=${SQLITE_FILE} evcc --config ${CONFIG}'"
exec env EVCC_DATABASE_DSN="${SQLITE_FILE}" evcc --config "${CONFIG}"
@ -42,6 +41,15 @@ if [ -f ${HASSIO_OPTIONSFILE} ]; then
echo "starting evcc: 'evcc --config ${CONFIG}'"
exec evcc --config "${CONFIG}"
fi
else
if [ -f "${SQLITE_FILE}" ]; then
echo "No config file (evcc.yaml) configured. Starting with configuration from database: ${SQLITE_FILE}"
exec env EVCC_DATABASE_DSN="${SQLITE_FILE}" evcc
else
echo "No config file (evcc.yaml) and no database (evcc.db) file configured. Please copy your database to ${SQLITE_FILE} or migrate your settings to the database or create a config under ${CONFIG}."
echo "For details see evcc Home Assistant documentation at https://docs.evcc.io/docs/installation/home-assistant"
exit 1
fi
fi
else
if [ "$1" = 'evcc' ]; then