Now that you have Home Assistant Core installed atop the Home Assistant Operating System and regular, automated backups set up, it is time to add the next add-on. This one will help you set up integrations that aren’t yet available to configure from the Dashboard, and it comes with some extras that will make life easier when editing the configuration.
Microsoft’s Visual Studio Code has quickly become one of the most popular code editors, and it’s perfect for use with Home Assistant. Though a desktop application, there is a port called code-server that allows you to access the editor in any browser. It is this version that is used for the Home Assistant add-on.
Table of Contents
- Installing the Studio Code Server add-on for Home Assistant
- Configuring the Studio Code Server add-on for Home Assistant
- Setting up the Home Assistant Studio Code Server extension
- How the Home Assistant Config Helper makes editing YAML easier
Installing the Studio Code Server add-on for Home Assistant
You install this add-on using the built-in Home Assistant Add-on Store. Different to the Google Drive Backup add-on we installed in a previous step, this one doesn’t require you to add any repositories. You will find the Studio Code Server under the heading ‘Home Assistant Community Add-ons‘. You simply click on it and hit the installation button in the following window.
Here, I have once again opted to enable every option offered by the add-on. As your tinkering starts to slow down, this could be one of the add-ons you start manually whenever you need.
Configuring the Studio Code Server add-on for Home Assistant
Before using the Studio Code Server add-on for Home Assistant, you will want to create a new long-lived access token. These are found in your profile: click on your profile picture or initials in the bottom-left corner, and scroll all the way to the bottom. You will need to give the token a name – I recommend something that future you will recognize – and are then presented with the access token itself. Do never share this token with anyone. If you have, or suspect to have done, simply delete it and create a new one.
With the code copied, you can continue on to the next step and open the Studio Code Server by clicking the icon in the sidebar. You will first be presented with a prompt to trust the folder or not. As you are accessing the Raspberry Pi’s storage and nothing else, there are no issues in trusting the folder, and while you are at it, you might as well trust the parent folder, by checking the appropriate box.
Setting up the Home Assistant Studio Code Server extension
As part of the add-on, the Home Assistant extension for the Studio Code Server comes preinstalled, but not preconfigured. By hitting
CTRL + , on your keyboard, you can open the settings. Under extensions, you should find the Home Assistant Config Helper. Here you can add Home Assistant’s URL, and paste the token you created in the previous step. This extension can come in very handy, as it does the following:
- It offers completion for entity IDs, services, scenes, and Triggers.
- Your configuration and Home Assistant Dashboard schema will be validated.
- It can evaluate templates without forcing you to open the Home Assistant developer tools.
Once you have inserted the long-lived access token, there is no need to save the configuration, as this is done as soon as you enter the information.
How the Home Assistant Config Helper makes editing YAML easier
The main reason to be using the Home Assistant Config Helper, is that it can save you time. Take the example shown in the screenshot. The extension will autocomplete any entities you enter, meaning you don’t need to look up the correct name, and there is no way of entering the wrong information. You can select the entity you want using the arrow keys on your keyboard, and confirm it by hitting
⏎ RETURN. Your fingers never even have to leave the keyboard.
If, for some reason, the extension shouldn’t work, make sure you have selected the correct language mode. At the bottom of the editor, you will see a blue bar, in which the language and keyboard layout is listed.