openHAB VS Code Extension
openHAB is a vendor and techology agnostic open source automation software for your home. This Visual Studio Code extension allows you to work with openHAB configuration files (like
The extension is designed with openHAB 2.x in mind - most snippets and design patterns will work in openHAB 2.x
You are able to configure the hostname and port for the Sitemap preview.
openhab.host will also work with the IP address of your openHAB instance, instead of the hostname.
These settings should work fine on Windows machines and openHAB installations using the recommended openHABian setup. They should be edited if you use macOS or *NIX systems or manual openHAB installations.
To edit these settings, simply add overrides to either your user settings or your workspace settings in your Visual Studio Codes preferences.
For further informations on how to change your settings, visit the official Visual Studio Code docs.
Configuration example (local)
Configuration example (macOS)
Integration with openHAB REST API
This VSCode extension connects to the openHAB REST API by default. The connection is used to display list of Items in the left side tree view. It's also utilized for code completions.
If you're using this extension just for the syntax highlighting
and don't want to involve the REST API, you can disable it by providing
the following parameter in your User Settings (
You may need to reload the VSCode window to take effect.
Validating the Rules
This extension comes with Language Server Protocol support.
Language servers allow you to add your own validation logic to files open in VS Code.
openHAB from version
In the unlikely case that your language server is running on a port other than the default one this is how it can be changed in the configuration:
If you don't want to have your openHAB files validated by Language Server, simply disable it in the extension:
Accessing remote openHAB
Accessing remote openHAB from service like myopenhab is not possible, given that you need an access to the file system in order to read and write to the configuration files. Although, you can access the Items and Things through the REST API. Note that LSP (content assist for rules and syntax validation) won't be exposed, so you'll need to disable it too.
The following configuration will allow you to access REST API remotely:
Sitemap preview with Basic UI
If you have a sitemap file active in your editor and open Basic UI (
You can optionally set
You need to have openHAB server running in order to preview changes. The extension assumes that you access your openHAB config files from either:
Samba share (e.g.
Quick Karaf console access
This extension allows you to run openHAB Karaf console directly from the editor. Note that you need to have:
This feature allows you to modify the new param and e.g. show the openHAB logs immediately:
Things Explorer demo
Sitemap Insert demo
Check out existing issues in the repository.
See CHANGELOG.md file for the details.
For More Information