VS Code openHAB Extension!

Tags: #<Tag:0x00007f6ce69ef6d8> #<Tag:0x00007f6ce69ef598> #<Tag:0x00007f6ce69ef368>

(Kuba Wolanin) #1

I’m pleased to announce that openHAB has now an official Visual Studio Code extension. :trumpet: :trumpet: :trumpet:



  • Code snippets for openHAB including Design Patterns by @rlkoshak
  • Syntax highlighting for openHAB DSL (rules, items, scripts and sitemaps).
  • Integrated quick search of openHAB docs page (Alt + Shift + O)
  • Integrated Basic UI preview window (Ctrl + Alt + O or editor title icon)


openHAB2 code snippets:

Integrated search engine:

Intelligent sitemap preview:


This extension is available on the Visual Studio Marketplace -> https://marketplace.visualstudio.com/items?itemName=openhab.openhab

You can also install it manually:

  1. Download openhab-0.1.0.vsix from this release page on your hard drive
  2. Open command line in the same folder you downloaded the extension
  3. Type the following command:
code --install-extension openhab-0.1.0.vsix
  1. Open Visual Studio Code
  2. Open openhab configuration (openHAB-conf) folder
  3. Enjoy! :wink:

Further development

There are a number of ideas that we’d like to implement in the extension (like incorporating LSP for better Xtend syntax validation).
I truly believe this will become a solid alternative for Eclipse SmartHome Designer.
In the meantime we’ll be working with @Kai to publish the extension in the VS Marketplace, so you won’t need to install it manually.

[Solved] Openhab 2.1 does not know my sitemap
Xiaomi mihome rules not working
Alexa controlled wol and exec shutdown
OH2: Which interface allows me to do what I could in OH1
Editing rules... best option for editor
Autowarm (CLOSED)
(SOLVED) ESP8266 with Json by wifi
Beginner Question: items isnt correct
(Martin Herbst) #2

This is really great. I like especially the idea of using the LSP. Would be great to have a language server implementation of the sitemap and rule syntax. This could then be uses for VS.Code, brower-based editors and Java-based tooling.

(Michael Fuerst) #3

Wow, so much better then ESHD! I love it!!!

(sheppard) #4

Cool, I will try that one out as soon as possible. Looks really promising.

(Dennis) #5

Thanks, Kuba! Totally awesomesauce! <3

(sheppard) #6

the first questions arise. :slight_smile:
How does the preview work? Do I need to have some services running or is it just parsing the sitemap and has the default styles applied internally? Currently it shows nothing for my sitemaps (or a newly created one).

(Kuba Wolanin) #7

See this section in README although I admit it's not written in most clear way possible :slight_smile:

You need to have openHAB running in order to preview changes. The sitemap is the actual http://YOUROPENHABHOST:8080/basic/... running from your server.

Generally, it assumes that you access your openHAB config files from either:

  • Samba share (e.g. \\OPENHABIANPI\openHAB-conf\)
  • Local folder (e.g. c:\openhab\configuration) - didn't test it on Unix based machines, though. Windows only :open_mouth:

There might be a bug in a place that checks the hostname based on file path. I'll take a look at it later today. EDIT: Already resolved

Glad you guys like it :slight_smile: More stuff is about to come.

(sheppard) #8

I thought so, but was hoping that maybe the sitemap is just parsed with the help of static/internal openHAB stylesheets or scripts (just UI and non-functional). So basically it is just a browser window within vsCode. :slight_smile:

(Craig) #9


(Angelos) #10

ditto !

(Greg) #11

Fantastic work!!!

(Dennis) #12

I've already made a PR to make it work under macOS.
Should be no problem to make it work under *NIX, albeit the mounting scheme is not the same on every distro.

(The Squid) #13

Friggin Awesome!!!! :clap:

(Jerome) #14

Beste News today. :smiley:
This looks awesome.

Great Work.

(The Squid) #15

Will this eventually support quick suggestions in code?

(Ken Short) #16

Have to say I like it more than Eclipse already. Great work.

(Jerome) #17

Technically this should be possible.

(The Squid) #18

Thank you - the branding "IntelliSense" was escaping me. Having code completion would be great.

(Kuba Wolanin) #19

@KidSquid @Confectrician It's certainly possible! There's an issue in the pipeline to utilize LSP for Xtend language. This way we would get all the goodness that's seen in ESHD - code formatting, quick suggesting, validation and so on.
Prerequisite of that feature is to upgrade Xtend to a newer version.

@dennisausbremen Thank you for the PR! I'll take a look at it today. :slight_smile:

(Jerome) #20

So its more a question of "when" it is possible and not "if" it is possible. .)