Home Assistant Config Helper for VS Code
This the Home Assistant Extension for VS Code. By being connected to Home Assistant it provides auto completion for your entity_id's.
Then when you type
entity_id: (or any entity related property) the autocomplete list should be populated with your entities:
Or when you want to use snippets just write snippet name and press tab:
After installation, this extension needs your...
- Home Assistant Root URL and a
- Long Lived Access Token
...to be able to connect to your Home Assistant Server.
There are 3 ways to get this done:
Via the wizard, wait for the popup to show:
This popup will only show if your workspace contains a configuration.yaml file and enables you to set the configuration on user-level
Via the default VS Code Settings UI
Set the values with the default settings editor of VS Code: to open the VS Code settings, go to (cmd+shift+p) 'Preferences: Open Settings (UI)', then go to 'Extensions' and then 'Home Assistant'. Please note the difference between 'User Settings' and 'Workspace Settings', by default the extension sets them on User-level but they can be overridden at workspace level.
Via Environment Variables
HASS_TOKENEnvironment Variables. This is convenient when you're using both this extension and the Home Assistant CLI. The extension will only use these Environment Variables when you have not set any setting in VS Code.
Remember the scope of your environment variables differs per OS. Usually for this to work, you need to start VS Code from the from the prompt where the environment variables are set.
v0.3 - 23-03-2019
- New: Autocompletion for services (#4)
- New: Snippets for automations, sensors, scripts and groups (by @michalchecinski)
- New: Config HASS_SERVER & HASS_TOKEN environment variables (single config with HA CLI)
- Fixed: Multi-line entity id completion at first line (by @mickdekkers)
- Fixed: Keep configuration input boxes open when they lose focus (by @mickdekkers)
- Fixed: Extension not working when workspace is opened via SSH FS
- Initial release with autocompletion for entity_id's
Feedback / Ideas
Things to do / up for grabs
- Extract JSON scheme from HA to enable validation/completion on 'everything' static
- Render Jinja2 template locally (like/via CLI?) in preview pane
- Autocomplete !secrets
- Autocomplete triggers
- Schema for ui-lovelace.yaml
- Check local config with HA Server