VS Code - openHAB-Extension: No code completion active

My setup is:

openHAB 2.3.0-1 (Release Build) - openhabian on raspberry pi 3

Seems like my network share with folder openHAB-conf is ok.


All my openHAB files appear in VS Code (Latest Version) installed on Win10.


From my point of view, everything that is necessary for code completion should be there.
But there is no code completion active. I expected something like shown in openhab-demo.gif.

As @rlkoshak mentions in his post, there should be a code completion with <ctrl><space>.
When I type in rule + <ctrl><space> like shown in openhab-demo.gif, I get a message ‘loading’, but then nothing happens.

Looks like openHAB-Extension isn’t active.

I read the documentaiton and searched the forum, but couldn’t find a solution. Or maybe I did not understand it?

What can be wrong within my installation? Thanks for any hint!

Did you set the openhab.host property?

Didn’t change any setting by myself. Should I?
All settings are default from openhabian-installation.

See the instructions https://github.com/openhab/openhab-vscode/blob/master/README.md#configuration

I’ve read this page before and compared the settings.

Instruction say:

openhab.host (mandatory), default: openhabianpi
openhab.port (optional), default: 8080

Instruction also say: These settings should work fine on Windows machines and openHAB installations using the recommended openHABian setup.

That’s why I think my settings are correct. Am I wrong?

can you open http://openhabianpi:8080 ? If so then those settings are sufficient. If not then the host needs to be set to the IP address of your openhab instance.

That’s strange. I tried and could not open http://openhabianpi:8080.
That surprised me because I know it worked so far.

That’s why I stopped openhab.service and started it again.

While openhab was starting, I could open http://openhabianpi:8080 and openHAB-Extension was active for a few minutes!

After openhab was fully started (which took at least >30 minutes) I couldn’t open http://openhabianpi:8080 anymore and openHAB-Extension wasn’t active anymore.

I tried that again and realized, that when openhab.service is stopped and I type in rule + <ctrl><space> a error appears.

But when I close that error (click on x) the code completion appears.

And when I start openhab.service again, http://openhabianpi:8080 and openHAB-Extension are not working anymore. Once while starting I got this error:

BTW: Always when VS Code is running, my openhab rules are executed very, very slow. This is a known issue/bug. To me, it looks like my problem could be related to this.

Edit: At the moment, openhab.service is running and I can open http://openhabianpi:8080. But openHAB-Extension is still not working. Strange!

While trying different user settings I switched openhab.useRestApi from default true to false and now code completion and Items treeview are functional !!!


I do not understand that, because of the comment in settings.json file.
It says with setting false Items tree view and code completions are not possible.

Is that a bug? Are the values reversed?

But no matter. Hopefully it stays that way.
@rlkoshak Thank you very much for your help!

I’m not sure what is going on but am glad you got it working. I’ll keep my eye open for other reports of this odd behavior and open an issue if I see it reported elsewhere.

1 Like

Same behaviour on my Win7 system: neither code completion nor Items/Things treeview have been active with standard installation of VS Code/openHAB Extension/openhabian (raspi 3).
After setting openhab.useRestApi to false code completion works. Items/Things treeview now shows now “There is no data provider registered that can provide view data.” instead of being empty.

De-/activating and re-installing openHAB Extension has no effect.

Windows 7 Home Premium SP1, openHAB 2.4.0 Release Build, VS Code 1.30.1 (user setup), Extension openHAB 0.4.1.

Anyone any idea how to show entries in Items/Things treeview?

Turn on openhab.useRestApi again.
Items and Things are grabbed through restApi so they cannot be shown, when you turn it off in the config.

if you are facing performance problems with code completion, when Rest API is enabled you can try to set openhab.restCompletions to false instead.

Thanks, now everything works fine.
The main mistake was to define "openhab.host": "" Omitting the port leads to a perfect world :wink:

That’s true, since the port is available to a separate setting. :slight_smile:

THANK YOU - THANK YOU - THANK YOU!!! I’ve had the vscode installed for months and always ignored the error about unable to connect to the server… and all this time I’ve been wondering why the vscode extension is so useless… lol. I didn’t get code completion until I’ve fixed this.