VS Code openHAB Extension!

Not for me, i have the same behaviour if openhab.host is configured in the .vscode/settings.json “user” preferences (“Settings defined on this scope override the user scope.”).

So still no luck for me.

Started using the plugin, works perfectly - however i can’t find the “auto complete” function - shouldn’t by itself suggest items when i start writing them?

Hi there all,
I like so much the VS but I take an error when I want to save the files.

If I make a new folder in windows explorer I can make it… so I can write to the openhab folder.
But if I want to write from the VS… give me "operation not permited"
Anybody can help me please ?

Thanks in advance
Denis

You need to provide more details. How are you accessing your config files? Via samba share? Then you have a permission issue probably.
What operating system are you using? Do you access your config files locally or remote?

Thanks Sihui,
I use openhabian os for the raspberry
and windows 10 on my PC
I just make a network drive folder Y:\ with the conf folder of my openhab and I conected with thw openhabian user

From windows explorer I can write… but from VS i cannot :frowning:

Thanks again
Denis

That means you can just install samba and do the config via openHABian config menu.

Basically correct, make sure you are mapping the share from your samba service provided through openHABian to that drive letter.

VSC connects by default to the hostname openhabianpi, so make sure you did not change that.

I understand the problem :slight_smile:
The files was makeed using root… I just chgown-ed to openhabian user and now it’s work

Thanks a lot.
Denis

1 Like

Hallo and great work . I am not a programmer but I use openHAB as hobby .
I install openHAB extension on visual studio code vie extension tab . Everything run perfect but I have one question .
What exactly settings must set to have some syntax help in writing code in rules, sitemaps and items . Because when I use eclipse , it pointe me error like duplicate item names , if “}” missing and others …
( sorry for my english )

See https://github.com/openhab/openhab-vscode/issues/3 or the answer @kubawolanin has given 10th of July.
Language Server Protokoll will bring this syntax help, but is not finished yet.

3 Likes

I installed the extension in Visual Studio Code (from the marketplace), but I I’m missing some of the shown features (quick suggestion, auto complete etc., e.g. for sendCommand, like shown in your GIFs). Code validation seems not to work either.
I’m running openHAB 2.2.0 Build #1069, Language Server Support is installed. The Rest API gets a connection.
Is there some more configuration to be done in Visual Studio Code?
Thanks for your help!

  • Have you got the openHAB Misc / Language Server Support add-on installed?
    (Do this in paper UI).
  • You also need to ensure that the VS settings for openHAB (In VS Code - File/Preferences/Settings and scroll down to the openHAB ones) are configured for your openHAB Host IP address and port.
    (Either the IP address or host name will do)

That should be it.

I did both. And configuration seems to be ok, because I can connect to the REST API.

Is this VS Code setting set to ‘true’?

"openhab.useRestApi": true,

I guess it is as it’s the default.

Are you opening your openHAB config files folder to view your files?

\\OPENHABIANPI\openHAB-share\openhab2-conf

Sorry, I can’t help more.

Yes.

Yes. I open my files from a samba share.

As I’m not using openhabian, I override the settings as follows:

{
    "openhab.host": "192.168.188.55",
    "openhab.port": "8080"
}

Thanks for your help! Perhaps @kubawolanin can help out.

Hey @Syn

Could you check if there’s anything relevant in your openhab logs?

Please verify if extension’s version is 0.2.0 and you’re running the latest VSCode on your machine.
Is there “openHAB Items” side panel visible on the bottom left hand side?

Also please check if there are any errors in the Output panel in VSCode. (Alt + F12 > Output)
Somtimes reloading VSCode window should help too (Ctrl + Shift + P > type Reload window)

EDIT: Just submitted a ticket on ESH repository - I’ve encountered some issues on the latest distro as well.

Cheers

1 Like

Thx. I was already wondering why I get some errors (#1070) when trying to open a sitemap:

error

The openhab log doesn’t show any relevant informations.
There is a “openHab Items” side panel.
VSCode Version is Version 1.17.2 (1.17.2); extension is 0.2.0

Right after the start from Visual Studio Code there are two errors (openHAB Server):

[Error - 18:48:44] Connection to server is erroring. Shutting down server.
[Error - 18:48:44] Connection to server is erroring. Shutting down server.

After reloading VSCode window, there is the same errors as after the start:

[Error - 18:55:21] Connection to server is erroring. Shutting down server.
[Error - 18:55:21] Connection to server is erroring. Shutting down server.

Opening a sitemap actually works for me…

Strange … without installing the Language Server Support everything worked fine, now it is completely broken (since upgrading from #1061 to #1070)

Do we need to change the settings? (Don’t think so …):

{
    "openhab.host": "192.168.2.237",
    "openhab.port": "8080",
}

VSCode Output shows an error with your settings (because of the , at the last line):
Property expected (4,1)
But I don’t know if that is an issue.