Visual Studio openhab plugin on new server

I’m setting up a new oh3 raspberry pi while still running oh2.5 on another pi. I have visual studio configured with the openhab extension.

I can’t see how to configure the extension for both platforms. It seems to have a global setting for the openhab path?

You can setup a VScode Server on each machine and connect to it using SSH

Thanks I’ll give that a try

You can also add multiple workspaces with it’s own settings. This is a feature built in in vscode directly.

You just need to add an .vscode folder to your openHAB conf folder on each installation and place a settings.json file in there with the corresponding extension settings.

Sorry i was too lazy to write that much on my mobile phone. :smiley:

Here is a bit more detailed explanation:

Vscode provides 3 levels of settings for most parts including extensions and also the openHAB extension. (I’ll exclude default settings here, that some extension bring on installation)

  • User Settings
    Those are comparable to “global” settings.
  • Workspace Settings
    You can open some folders and save them with tehir own config as a workspace → Workspaces in Visual Studio Code
  • Folder settings
    You can add a .vscode folder with a settings.json in your openhab-conf folder on each installation like written above.

Vscode will then use the settings based on a hierarchy.

Folder settings overwrite workspace settings and user settings.
Workspace settings overwrite user settings too.

So basically you can cofigure everything except the connection details in your user settings and it should be useable the same way for both installations.

Then you can configure the connection details in a workspace or folder setting and the extension should connect correctly.


	"": "",
	"openhab.connection.port": 443,
	"openhab.connection.authToken": "oh.vscode.XXXXXXXXXXXXXXXXXXX"

Thanks for that detailed description. We should add that to the documentation for the plug in because I am sure others have 2 or more environments.

1 Like