VS Code Extension With openHAB 3

Hi all,

Since questions are being asked repeatedly i wanted to share a quick Thread.
It can be used as a short FAQ when questions come up.
I will add important changes and culprits here when needed.

My Rest API doesn’t work any longer

This should mostly be related to our api security update in openHAB 3.
openHAB 3 introduces an authentication layer to the api.

Basic Auth configuration

You have to configure your openHAB instance proper and add some configuration to the openHAB extension.

on openHAB-Side

Make sure to activate Allow Basic Authentication in the API Security settings.

on VS Code Extension config

Add your user credentials (from your openHAB Admin User) to the extension settings.
The needed settings are:


When your openhab.host and openhab.port settings didn’t change since you installed/upgraded, everything should work again on the api connection.

What about token based authentication? Can i use that?

Yes you can use it with a generated token.
Generate a custom api in the user window of Main UI and copy it in the Username setting for the vscode extension.
Make sure to leave the password setting empty!

"openhab.username": "MY_GENERATED_TOKEN",
"openhab.password": "",

I am using openHAB with https enabled and it still doesn’t work

The code we are using for accessing the api has problems with https. That’s a known problem.
So you would currently have to allow http requests to the api to get it running.



Thank! A! Lot! :blush:

1 Like

Basic UI Rendering in VS Code not longer possible when having configured REST API Access?

Thank you very much for providing some guidelines to activate OpenHAB 3 REST API Access to VS Code. I followed your guide and could gain access to Things and Items via REST API in VS Code.

However, when provisioning openhab.username with the API token, I realized that another functionality broke in VS Code: When I want to render the Basic UI in VS Code, the Basic UI is accessed with the API token as username and empty password - as shown in the output window of VS Code. When I copy this URL, I can successully open the Basic UI in the browser, but VS Code cannot. Is there a way to keep this functionality?

Best regards,

I am facing the same problem. please give some suggestion to us. Thanks in advance.


I didn’t check this so far to be honest.
I will try to evaluate what’s happening.

Anyway i am working on a bigger update to replace the “username workaround” with a proper token based authentication with it’s own configuration parameter.
This should probably solve the problem aside.

1 Like


Is there any chance to work with rules created in OpenHAB WebUI (stored in jsondb)? UI based editor has some ‘IntelliSense’ which is mostly working only for buildin variables. That would be a very nice feature!


Hey @cinadr

Currently there is some work in progress as a “proof of concept” for something similar.

The goal is to access some api parts (so in fact the jsondb in an indirect manner) and transform it to virtual yaml files for editing.
This is of course a limited part for now but may be extended in the future, when we get it running properly.

1 Like

This is really amazing. Eagerly waiting to be able to test this. Thank you.

1 Like