Visual Studio Code Home Assistant



  1. Install via the VS Code Marketplace

  2. Open your (local copy of the) Home Assistant Configuration with VS Code

  3. Configure the connection to Home Assistant via the HA Section in the VS Code Settings UI

    More details in the How-To in the Wiki

  4. Enjoy the features showcased below 👇

  5. Continue reading in the Wiki:

Completion for Entity IDs, Services, Scenes and Triggers

When connected with your Home Assistant server, entity id' and services will be auto-completed.

Completion & Validation for Configuration & Lovelace Schema

  1. Visual Basic supports.NET Core starting in Visual Studio 2017 Update 3 (15.3). This opens new possibilities for new applications and modernizing existing applications. Preserving domain-specific code when modernizing applications allows step-wise conversions, decreases cost, and avoids disruptions.
  2. Visual Studio Code has also proven to be a popular tool for editing Home Assistant YAML code. While YAML is being phased out more and more there are still many integrations that haven’t been ported to the UI yet. So while we still have to edit YAML we might as well make it as easy and efficient as possible. Home Assistant Config Helper.

Most of the scheme's of Home Assistant will be validated and things like properties, values and enums will be auto-completed. This extension understands the behaviour of Home Assistant '!include..' behaviour and use this to provide scoped validation for all your files.

Deprecation Warnings:

Let me present you a groundbreaking Visual Studio Code extension. Assistant will boost your team code quality and performance. No more looking into documentation. Now you don't need to search through piles of notes to find what you need. Now you can write notes that will pop-up exactly when you or your team member writes a code that they apply to.

Schema Documentation

Go to Definition for Includes

Easy navigate between your files references via the different !include.. tags using 'f12' / 'Go to Definition'.

Snippets

Snippets allow you to create commonly used data structures very quickly.

Commands

Commands allow you to quickly interact with Home Assistant! Find them using Cmd+shift+P and type 'Home Assistant'

Render templates

Evaluate jinja templates via Home Assistant's API and see how they would render.

Read all the recent changes in the GitHub releases section

Create an issue, reach out to me on Twitter or the Home Assistant Discord.

  • [ ] Go to Definition for entities, scripts and automations
  • [ ] Autocomplete !secrets
  • [ ] Check local config with HA Server

This extension collects telemetry data to help us build a better experience forusing VS Code with Home Assistant. We use vscode-extension-telemetry,which reports the following data:

Visual Studio Yaml Editor

  • Extension name
  • Extension version
  • Machine ID and session ID from VS Code
  • Operating system
  • Platform version

Additionally, if the language server fails to activate, we report the diagnosticdata the language server produces. The extension respects the telemetry.enableTelemetrysetting, which you can learn more about at VS Code'stelemetry FAQ.

When launched for the first time, Home Assistant will create a default configuration file enabling the web interface and device discovery. It can take up to a minute after startup for your devices to be discovered and appear in the user interface.

The web interface can be found at http://ip.ad.dre.ss:8123/ - for example if your Home Assistant system has the IP address 192.168.0.40 then you’ll find the web interface as http://192.168.0.40:8123/.

The location of the folder differs for different operating systems:

OSPath
Home Assistant/config
Docker/config
macOS~/.homeassistant
Linux~/.homeassistant

Home Assistant Vs Code

If you want to use a different folder for configuration, use the configuration command line parameter: hass --config path/to/config.

Inside your configuration folder is the file configuration.yaml. This is the main file that contains integrations to be loaded along with their configurations. Throughout the documentation you will find snippets that you can add to your configuration file to enable specific functionality.

If you run into trouble while configuring Home Assistant, refer the configuration troubleshooting page and at the configuration.yaml examples.

Test any changes to your configuration files from the command line with hass --script check_config. Download warcraft for mac. This script allows you to test changes without the need to restart Home Assistant. Remember to run this script as the user you logged in to Home Assistant as. Configuration changes can also be tested using the UI by navigating to Configuration, Server Controls and clicking “Check Configuration”.

Editing configuration.yaml

Home Assistant Configure Wifi

There are many ways you can edit configuration.yaml. Here are three options to get you started:

The simplest way is to use the “File Editor” add-on. This will allow you to edit your configuration from within Home Assistant itself.

The most robust option is to load the Visual Studio Code add-on. VS Code offers live syntax checking and auto-fill of various Home Assistant entities.

You can use Samba file share (you need to install the “Samba” add-on) and your favorite file editor.

Studio

The most basic is to use SSH to connect to the system (you may need to install the SSH add-on) and then use nano (or vim) to edit the file.

Reloading changes

Connect home assistant to wifi

You will have to restart Home Assistant for most changes to configuration.yaml to take effect.You can load changes to the following components without restarting, by using the UI. Navigate to Configuration, Server Controls and scrolling down to the YAML configuration reloading: automations, core (customize), groups, history stats, HomeKit, input_booleans, input_datetimes, input_numbers, input_selects, input_texts, MQTT, persons, scenes, scripts, statistics, template sensors, timers, zones, and more without restarting.

If you have made any changes, remember to check your configuration before trying to reload or restart.

Migrating to a new system

If you want to migrate your configuration to a new system then you can copy the contents of your configuration folder from the current system to the new system. Be aware that some of the files you need start with ., which is hidden by default from both ls (in SSH), in Windows Explorer, and macOS Finder. You’ll need to ensure that you’re viewing all files before you copy them.

Help us to improve our documentation
Suggest an edit to this page, or provide/view feedback for this page.