I started 2 years ago with HomeAssistant and now some configuration is in the configuration.yaml and some in the home assistant database. I would like to put all of the configuration into the yaml and store it in a git repo. Is it possible to export the whole config into yaml files?
If not, what is best practice to move the config from db to yaml?
I think that long-term goal of HA devs is to have as much as possible in UI and not vice-versa, that’s why things are gradually “dissapearing” from config.yaml to integrations page, so i don’t think that putting all back to config is possible. I mean - you can write it there, but HA will warn you about deprecated stuff and will urge you to remove it.
I also have a private repo that I push another HA instance to.
Look at Bearded Tinkerer’s You Tube, he is one of the official content creators volunteering with Home Assistant and he has 2 videos I used to do this.
Yes, you can mostly achieve this. All my automations, templates, alerts, notifications, zones, persons,… are defined in YAML. Rather than having 1 gigantic configuration.yaml I break them up into functional packages.
The only items that can’t be defined in YAML are the integration configurations that are setup in the UI. For that you can put .storage/core.config_entries in GitHub. Or create a json generator to populate (I do this for the ping integration to make it easy to add one more IP to a list to monitor)
Because much configuration in HA is similar (light on/off, thermostat control, etc.). I use shell scripts to generate the actual HA configuration from a smaller set of “master” definitions. The output goes into a directory on my laptop and then I can compare, deploy, check and restart HA from the command line.