🧪 Beta Release: Standalone language server extracted from vscode-home-assistant. Currently in testing phase (v0.0.2-beta).
Language Server Protocol (LSP) implementation for Home Assistant configuration files. Provides completions, validation, hover information, and formatting for YAML configuration files.
- Smart completions for entity IDs, service calls, areas, devices, and configuration keys
- Real-time validation of configuration structure and entity references
- Hover information with entity states and service documentation
- YAML formatting and schema validation
- Auto-sync with upstream vscode-home-assistant for latest features
npm install -g home-assistant-lsSet up your Home Assistant connection:
export HASS_SERVER="http://homeassistant.local:8123"
export HASS_TOKEN="your_long_lived_access_token"- In Home Assistant, go to your profile (click your username)
- Scroll down to "Long-Lived Access Tokens"
- Click "Create Token" and give it a name
- Copy the token for use with the language server
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
home_assistant_ls = {},
},
},
config = function(_, opts)
local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
if not configs.home_assistant_ls then
configs.home_assistant_ls = {
default_config = {
cmd = { "home-assistant-language-server", "--stdio" },
filetypes = { "yaml" },
root_dir = lspconfig.util.root_pattern("configuration.yaml"),
single_file_support = false,
settings = {},
},
docs = {
description = "Language Server for Home Assistant configuration files",
},
}
end
lspconfig.home_assistant_ls.setup(opts.servers.home_assistant_ls or {})
end,
},
}The language server automatically activates when you open YAML files in directories containing configuration.yaml.
Supported files:
*.yamland*.ymlfiles in Home Assistant configuration directories- All Home Assistant configuration sections (automation, script, sensor, etc.)
- Lovelace dashboard configurations
git clone https://github.com/rtuszik/home-assistant-ls
cd home-assistant-ls
npm install && npm run buildAuto-synced with upstream vscode-home-assistant:
- Automated sync: GitHub Actions runs weekly to detect upstream changes
- Preserved customizations: Standalone server features remain intact
Language features: Report to vscode-home-assistant
Standalone server: Report here
MIT License - see LICENSE.md