Opening OpenHAB in Visual Studio Code - how to do it?

Hello,

My question is basic. Something to obvious, that nobody asked before…

I am on my PC with Linux Mint. I have openHAB2 on Raspberry Pi. Pi is in my local network. I have Visual Studio Code with OpenHAB plugin installed.
I don’t understand what is REST API. I have ssh connection to Pi. I used nano and mcedit to manage my OpenHAB in past. Now I want to use this great tool VSC.

How to start editing items, sitemaps and all other in Visual Studio Code?
Do I have to access files on Pi via ssh?

I added Pi’s IP address to settings in VSC/openHAB, but no window appeared. How to start the OpenHAB plugin? How to navigate to OpenHAB folders (which are on Pi)?

Please give me some hints.
I already have experience with OpenHAB, but never used REST API and Visual Studio Code.

All this time I meant OpenHAB2.

Best wisches,
Darek

First you have to use a samba share (or nfs, but if using openHABian, the samba share is already configured)
Then you can use this share to access Raspberry Pi’s /etc/openhab2/ with "open folder"
openHAB2 has a RESTful API which can be accessed through http://openhab-ip:8080/rest, VSCode openHAB2 extension makes use of this API
Furthermore current openhAB2.3 builds make use of LSP to support autoCompletion and code correction. This is done through port 5007 by default.

2 Likes

Thank you Udo, You made it clear for me now.
Good luck :slight_smile:

You’re welcome :slight_smile:

I used to have a network connection on windows for use with openhab-conf directory (within the last month or so) but it no longer connects/exists?

I can browse the network for openhabian but all I get is three files events.log, openhab.log, README.txt

I checked the shares were setup through openhabian-config - it says that /srv/openhab-conf is mounted yet I can no longer get to them in windows.

Did something change in the openhabian?

openHABian should use
/etc/openhab2/as configuration folder.
Maybe this folder is remounted (with mount -bind) to be in both folders. This mount will fail if the mount folder is not empty.

Hi,

Which extensions should I install in order to debug my openhab configs: rules, sitemaps, items ?
I have pointed to openhab2 - conf folder already. When selecting start debug I being asked to select environment.

Node

Selecting Node.js giving me this error.

cannot

Choosing option “More” asking me to select extension to install.

Installed the following extensions so far

extens

1 Like

You can’t use debug option for openHAB.

The only extension needed is openHAB, though there might be other helpful extensions, for example jsonpath statusbar, which helps to analyze json files and to find the correct path to a value.

You’ll have to configure the openHAB extension to get access to your openHAB server (not only a samba share for configuration files but also ip and port for LSP server and rest api to provide autocompletion and error highlighting.

1 Like