Since there currently is no nice way to edit the yaml-files Home Assistant is using through the frontend, here is a small webapp that hopefully makes the configuration easier. It is a customized and embedded Ace editor, which has syntax highlighting for yaml, the format used for Home Assistants configuration files. There is an integrated file browser to select whatever file you want to edit. When you’re done with editing the file, click the save-button and it will replace the original.
Essentially this is a browser-based alternative to modifying your configuration through SSH, Windows + SMB, Github etc..
- Web-Based editor to modify your files
- Upload and download files
- Git integration
- Lists of available triggers, events, entities, conditions and services. Selected element gets inserted into the editor at the last cursor position.
- Check valid configuration and restart Home Assistant directly with the click of a button
- SSL support
- Optional authentication and IP filtering for additional security
- Direct links to Home Assistant documentation and icons
- Execute shell commands
- Runs on pretty much any machine Home Assistant can run on
This tool allows you to browse your filesystem and modify files. So be careful which files you edit, or you might break critical parts of your system.
Consider running the configurator as a user with limited privileges to limit possible damage.
- Copy configurator.py to your Home Assistant configuration directory (e.g /home/homeassistant/.homeassistant)
- Make it executable:
sudo chmod 755 configurator.py
- (Optional) Set the
GITvariable in configurator.py to
Trueif GitPython is installed on your system. This is required if you want to make use of the Git integration.
- Execute it:
- To terminate the process do the usual
CTRL+C, maybe once or twice
Near the top of the configurator.py-file you will find some global variables you can change to customize the configurator. If you are unfamiliar with Python: when setting variables of the type string, you have to write that within quotation marks. The default settings are fine for just checking out the configurator quickly. With more customized setups you should change some settings though.
To keep your settings across updates it is also possible to save settings in an external file. In that case copy settings.conf wherever you like and append the full path to the file to the command when starting the configurator. E.g.
sudo .configurator.py /home/homeassistant/.homeassistant/mysettings.conf. This file is in JSON format. So make sure it has a valid syntax (you can set the editor to JSON to get syntax highlighting for the settings). The major difference to the settings in the py-file is, that
The IP the service is listening on. By default it is binding to
0.0.0.0, which is every interface on the system.
The port the service is listening on. By default it is using
3218, but you can change this if you need to.
It is possible to place configurator.py somewhere else. Set the
BASEPATH to something like
"/home/homeassistant/.homeassistant", and no matter where you are running the configurator from, it will start serving files from there. This is needed if you plan on running the configurator with systemd or some other way of daemonizing the configurator.
SSL_CERTIFICATE / SSL_KEY (string)
If you are using SSL, set the paths to your SSL files here. This is similar to the SSL setup you can do in Home Assistant.
The configurator fetches some data from your running Home Assistant instance. If the API is not available through the default URL, modify this variable to fix this.
If you plan on using the restart button, you have to set your API password. Calling the restart service of Home Assistant is prohibited without authentication.
Set credentials in the form of
"username:password" if authentication should be required for access to the configurator.
Limit access to the configurator by adding allowed IP addresses / networks to the list, e.g
ALLOWED_NETWORKS = ["192.168.0.0/24", "172.16.47.23"]
List of statically banned IP addresses, e.g.
BANNED_IPS = ["22.214.171.124", "126.96.36.199"]
Ban IPs after
n failed login attempts. Restart the service to reset banning. The default of
0 disables this feature.
CREDENTIALS has to be set for this to work.
Set this variable to
True to enable Git integration. This feature requires GitPython
to be installed on the system that is running the configurator. For technical reasons this feature can not be enabled with the static settings file.
The way this is implemented works in the following order:
- (Only if
CREDENTIALSis set) Check credentials
- Failure: Retry
BANLIMITtimes, after that return error 420 (unless you try again without any authentication headers set, e.g. private tab of your browser)
- Success: Continue
- Failure: Retry
- Check if client IP address is in
- Yes: Return error 420
- No: Continue
- Check if client IP address is in
- No: Return error 420
- Yes: Continue and display UI of configurator
Home Assistant has the panel_iframe component. With this it is possible to embed the configurator directly into Home Assistant, allowing you to modify your configuration through the Home Assistant frontend.
An example configuration would look like this:
panel_iframe: configurator: title: Configurator icon: mdi:wrench url: http://188.8.131.52:3218
Be careful when setting up port forwarding to the configurator while embedding it into Home Assistant. If you don’t restrict access by requiring authentication and / or blocking based on client IP addresses, your configuration will be exposed to the internet!
Since the configurator script on its own is no service, you will have to take some extra steps to keep it running. Here are five options (for Linux), but there are more, depending on your usecase.
- Fork the process into the background with the command:
nohup sudo ./configurator.py &
- If your system is using systemd (that’s usually what you’ll find on a Raspberry PI), there’s a template file you can use and then apply the same process to integrate it as mentioned in the Home Assistant documentation. If you use this method you have to set the
BASEPATHvariable according to your environment.
- If you have supervisor running on your system, hass-poc-configurator.supervisor would be an example configuration you could use to control the configurator.
- A tool called tmux, which should be pre-installed with HASSbian.
- A tool called screen (alternative to tmux). If it’s not already installed on your system, you can do
sudo apt-get install screenor
sudo yum install screento get it. When it’s installed, start a screen session by executing
screen. Then navigate to your Home Assistant directory and start the configurator like described above. Put the screen session into the background by pressing
CTRL+D. It is now safe to disconnect from your SSH session. To resume the screen session, log in to your machine and execute
If you encounter difficulties setting up the configurator or stumble upon a possible bug, head over to the Issues section of the configurator repository. Additionally there is a thread at the Home Assistant Community where common problems may have been discussed already. And if not, there are always friendly people around to help finding solutions.