hassio-addon
hassio-addon copied to clipboard
Implement Public Addon Config
There is a new preferred way to store configs. We should implement that and somehow provide a migration for legacy installations
https://developers.home-assistant.io/blog/2023/11/06/public-addon-config/
https://developers.home-assistant.io/docs/add-ons/configuration/#add-on-advanced-options
Some add-ons need access to all these add-on-specific config folders. For example:
-
Samba
-
SSH
-
Studio Code Server
When those updated I will update the addon and release notes.
implemented
Don't you think we should consider a non-breaking migration?
whats your proposal?
So I could migrate my evcc.yaml
file to the new /addon_configs/
folder - but I have lost my complete history from the evcc.db
. Any clues how to restore that?
You have your db in /data/evcc.db
?
Find your old DB and copy it to /addon_configs/<addon_id>_evcc
https://github.com/evcc-io/hassio-addon/issues/72
whats your proposal?
My proposal is to first of all roll back to /config, because of all the confusion this generates - see https://github.com/evcc-io/evcc/discussions/10744
The HA Supervisor Team got that too and will push out an update which makes /config and /addon_config side-by-side and this will allow us to do config migration in the background. See https://github.com/home-assistant/supervisor/pull/4697 and https://github.com/home-assistant/developers.home-assistant/pull/1975/files#diff-9ae15e79c349af300614e97def45c1260fcde69f1f194c7a169f5ac2843cb898R62 for details
old status, next try will be when HA has fixed there problems. I will leave this open.
Currently frenck is doing a hacky migration, see https://github.com/hassio-addons/addon-appdaemon/pull/285/files#diff-a3cb8f1cd3251bfb32a8e374ec6ce13a10be81b009300b9f570d5b6fd70f0352R8
https://github.com/hassio-addons/addon-appdaemon/pull/289/files#diff-a3cb8f1cd3251bfb32a8e374ec6ce13a10be81b009300b9f570d5b6fd70f0352R18
So what they do:
- map
homeassistant_config:rw
into the addon - change mapping from
config:rw
toaddon_config:rw
- migrate the config file(s) from
/homeassistant/
to/config/
- ... some weeks/months/years later, you should be safe to remove
homeassistant_config:rw
I'll try this inside my own fork and will monitor the official HA addons what they're doing.
Hello everybody and first of all: thank you for providing evcc as this wonderful Home Assistant add-on! 👍
A few days ago I tried to install the add-on by following the installation instructions in the README and unfortunatelly I have to say, that I got very confused 🙈 The instructions still tell the user to copy evcc.yaml to the /addon_configs/<your addon's slug>
directory. After I figured out, how to access this directory, I realized (from the discussion over at the main repository) that you reverted the change in the add-on and I had to use /config after all.
Finally, after some rather frustrating tinkering, I got the add-on to work properly 🎉 To spare future users this ordeal, please fix the README 🙏
Since almost two months have past since your last comments, I got curious what the state of affairs was. The revert mentioned above (https://github.com/home-assistant/supervisor/pull/4697) was reverted yet again (https://github.com/home-assistant/supervisor/pull/4702). So it seems that was Frenck is doing in his add-ons (mapping addon_config
plus homeassistant_config
and moving existing configurations from /homeassistant
to /config
) is the way to go.
If you find the time to implement that, you could just leave the README as is 😄
Is there any idea out there? It looks like that evcc.db in /data is not persistent in docker host (Home Assistant) instead its only locally store in docker container, or where to find it on the host ?
@goebelmeier, we should give it another try…?
where to find it on the host
Just run a docker inspect on the container id. Should be /mnt/data/supervisor/addons/data/<id>_evcc
(but how does this information help you? When using an ssh add-on, you're just inside another container and not on the host.
I've used docker cp
to copy my evcc.db from the Terminal Add-On to the evcc Add-On.
@klein0r an easy way:
https://github.com/evcc-io/hassio-addon/blob/main/README.md#how-to-find-and-copy-dataevccdb
documentation is adapted.
@thecem Thanks, that was exactly my solution: https://www.youtube.com/watch?v=ibrmbByk0MU
@goebelmeier, we should give it another try…?
From my point of view it's worth trying. But first of all we need to extend https://github.com/evcc-io/evcc/blob/master/packaging/docker/bin/entrypoint.sh to contain the migration logic. So:
- check if
${CONFIG}
(should be/config/evcc.yaml
) exists, if yes, skip next parts - if not, check if
/homeassistant/evcc.yaml
exists and copy it to${CONFIG}
(which again should be/config/evcc.yaml
)
If that logic exists, we could
- map
homeassistant_config:rw
into the addon - change mapping from
config:rw
toaddon_config:rw
- on first start, the
entrypoint.sh
should copy the config from/homeassistant/evcc.yaml
to/config/evcc.yaml
and on subsequent restarts it should not change anything any more - some weeks/months/years later, you should be safe to remove
homeassistant_config:rw
following mapping is possible:
map:
- type: homeassistant_config
read_only: False
- type: addon_config
read_only: False
"homeassistant_config":
/homeassistant
in container maps to /config
directory in home assistant
Addon Configuration
-> Options
-> config_file: /homeassistant/evcc.yaml
maps to /config/evcc.yaml
"addon_config":
/config
in container maps to /addon_configs/<slug>_evcc
directory in home assistant
Addon Configuration
-> Options
-> config_file: /config/evcc.yaml
maps to /addon_configs/<slug>_evcc/evcc.yaml
With this we could trigger following:
If a file /homeassistant/backup_evcc_db_from_data.txt
(or something similar) exist:
- copy
/data/evcc.db
to/config/evcc.db
(which maps to/addon_configs/<slug>_evcc/evcc.db
) - if copy is sucsessfull delete
/homeassistant/backup_evcc_db.txt
Advantages:
- User could decide when they migrate the
evcc.db
- User are easy able to get there evcc.db out of the /data directory