Modify Configuration.yaml via Home assistant Supervisor CLI

Modify Configuration.yaml via Home assistant Supervisor CLI

December 7, 2022 0 Door Bjorn Meijer

It can happen to you (I succeeded too ;-)), you have changed a setting (for example the port) in the configuration.yaml of Home assistant (Supervisor). Home assistant is no longer via the GUI accessible. You've done a lot of work lately and don't want to reinstall everything. Then you can always adjust the configuration.yaml via the CLI. The CLI stands for Command Line Interface where you can perform adjustments or commands via a non-graphical environment.

If you have installed Home Assistant on a Raspberry Pi, connect it to a monitor and a keyboard.

  1. Type after the ha > prompt enter the following command: login and press enter.
    You are now out of the Hassio CLI and in the bash.
Home Assistant Command line
Home Assistant command line
  1. Type docker ps and press enter.
    You will now get a list of all Docker containers to see.
    The container in which Home Assistant runs has its own ID. The first three characters of my container are 559.
docker ps command
View Docker containers
  1. Type docker exec -it 559 /bin/bash and close with enter.
    You are now in the container and can now make adjustments.
  2. Type the command ls to check if configuration.yaml is present.
bash command line
bash command line
  1. Type vi configuration.yaml to edit the file.
    With the vieditor you can now make changes to your file.
  2. Exit configuration.yaml and save it using the command :wq.
  3. Type exit and press enter to return to the hassio CLI.
  4. Type home assistant check and press enter to check if the configuration is correct now.
  5. Type home assistant restart and press enter to restart Home Assistant.

Still error messages?

After Home Assistant has started and you have corrected all errors, the web interface should be accessible again. If not, check the log in the CLI. Presumably an error message will be displayed there.