Installing and configuring the Studio Code Server add-on for Home Assistant

Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.

The code server logo overlaid on the Home Assistant logo.

Installing and configuring the Studio Code Server add-on for Home Assistant is a pivotal step in simplifying your smart home system's configuration. This guide walks you through adding this indispensable tool, designed to assist with setting up integrations not directly configurable from the Dashboard and streamline configuration edits. Leveraging the prowess of Microsoft's popular Visual Studio Code, this add-on taps into the code editor's popularity and versatility, offering a browser-accessible version, code-server, tailored for Home Assistant use.

Contents

Prerequisites

This guide is a continuation of the Home Assistant Beginner's Guide. Previously, we showed you how to install the Home Assistant Operating System, on top of which Home Assistant Core runs, on a Raspberry Pi. Before you get started with configuring anything, we highly recommend setting up regular, automated backups, as these will allow you to restore your system, should you make any mistakes.

Installing the Studio Code Server Add-on for Home Assistant

To start, the installation process is conveniently straightforward, thanks to the Home Assistant Add-on Store. Unlike some add-ons that require adding external repositories, the Studio Code Server is readily available under the 'Home Assistant Community Add-ons' section. Here's how to do it:

  1. Navigate to the Add-on Store in your Home Assistant interface.
  2. Scroll or search for the Studio Code Server under the 'Home Assistant Community Add-ons'.
  3. Click on it and press the installation button in the ensuing window.

We recommend enabling all the options available for the add-on to fully leverage its capabilities, especially as your familiarity with Home Assistant grows.

Interface for the Studio Code Server add-on in Home Assistant displaying version 5.1.1 with a 'Changelog' link. It has a user rating of 7 and features badges for 'Core', 'Manager', 'Ingress', and 'Signed'. A description states it's a fully-featured Visual Studio Code experience integrated into the Home Assistant frontend, with a prompt to visit the Studio Code Server page for more details. An 'INSTALL' button is at the bottom against a dark background.
Button graphic for the Studio Code Server, showing an icon of a monitor with brackets, indicative of a coding environment. The button reads 'Studio Code Server' and describes it as a 'Fully featured Visual Studio Code (VSCode) experience integrated in the' with the text cut off at the end.
Screenshot of the Studio Code Server add-on interface within Home Assistant. The current version 5.1.1 is displayed with a changelog link. Features include a rating of 7, and badges indicating core, manager, ingress, and signed status. Options toggled on include 'Start on boot', 'Watchdog', 'Auto update', and 'Show in sidebar'. Hostname 'a0d7b954-vscode' is shown with add-on CPU usage at 8.5% and RAM usage at 3.1%. Buttons for 'STOP', 'RESTART', 'OPEN WEB UI', and 'UNINSTALL' are at the bottom.

Configuring the Studio Code Server Add-on for Home Assistant

Before you dive into the wealth of features offered by the Studio Code Server, securing its access to your Home Assistant files with a long-lived access token is critical. This step ensures that your interactions with the server remain private and secure. Here's what to do:

  1. Go to your profile by clicking your profile picture or initials in the bottom-left corner of the Home Assistant dashboard.
  2. Scroll down to the bottom to find the option to create a new long-lived access token.
  3. Name your token for easy identification later on and copy the generated token. Keep this token secure and never share it; if compromised, delete it and create a new one.
Home Assistant Code Server 05
Home Assistant Code Server 10
Notification window titled 'Studio Code Server' with a message instructing to 'Copy your access token. It will not be shown again.' The access token is represented by a blurred gray rectangle to protect its confidentiality. Below the message is a button labelled 'GENERATE QR CODE'.

With your token ready, you can now proceed to access the Studio Code Server from the Home Assistant sidebar. Upon first access, you'll be prompted to trust the folder you're accessing. Given this access is restricted to your Raspberry Pi's storage, it's safe to trust the folder and, for convenience, the parent folder too.

Security prompt asking, 'Do you trust the authors of the files in this folder?' with an explanation that code — OSS can execute files in the folder and to proceed with caution if the files are untrusted. There is a checkbox selected to 'Trust the authors of all files in the parent folder' and two options: a blue button saying 'Yes, I trust the authors' to trust the folder and enable all features, and a gray button saying 'No, I don't trust the authors' to browse the folder in restricted mode. A link to 'docs' is provided for more information.

Enhancing Your YAML Configuration Experience

The Studio Code Server add-on comes with the Home Assistant extension preinstalled, yet it requires a bit of setup to fully harness its power. This extension significantly enhances your configuration experience by offering features like:

To configure the Home Assistant Config Helper extension:

  1. Open the Studio Code Server and press CTRL + , to access the settings.
  2. Navigate to the extensions menu and locate the Home Assistant Config Helper.
  3. Enter your Home Assistant's URL and the long-lived access token you created earlier.

This configuration step integrates the extension's functionality directly into your workflow, making editing and validating your YAML configurations as seamless as possible.

Home Assistant Code Server 07

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.

Screenshot of YAML configuration in Home Assistant Studio Code Server add-on showing a media player setup. Autocomplete suggestions are visible for different media player entities such as bedroom_speaker, living_room_tv, office_speaker, and upstairs_tv, with 'media_player.bedroom_speaker' highlighted as the current selection.

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 are listed.

Header with text 'Home Assistant' and 'Layout: Swiss German' on a blue background, indicating a setting or option selection within the Home Assistant interface for a Swiss German keyboard layout.
A portrait photo oif Liam Alexander Colman, the author, creator, and owner of Home Assistant Guide wearing a suit.

About Liam Alexander Colman

is an experienced Home Assistant user who has been utilizing the platform for a variety of projects over an extended period. His journey began with a Raspberry Pi, which quickly grew to three Raspberry Pis and eventually a full-fledged server. Liam's current operating system of choice is Unraid, with Home Assistant comfortably running in a Docker container.
With a deep understanding of the intricacies of Home Assistant, Liam has an impressive setup, consisting of various Zigbee devices, and seamless integrations with existing products such as his Android TV box. For those interested in learning more about Liam's experience with Home Assistant, he shares his insights on how he first started using the platform and his subsequent journey.

Leave a comment

Share to...