Visual Studio Code no connection to language server

  • Platform information:
    • openHAB version: 4.0.1
  • Issue of the topic:
    Can’t connect to the language server.
    Any idea?
    Port scan shows it’s up and running. Also the logs show no error.
    I saw some similiar topics in the community, but no real solution.

Where does the DNS “openhabianpi” come from at all?

I have only workspace settings. No setting under “user”

settings.json for visual studio is existent:

		"openhab.connection.host": "192.168.178.49",
		"openhab.connection.port": 4050,
               "openhab.connection.authToken": XXXX
  • If logs where generated please post these here using code fences:
Error: getaddrinfo ENOTFOUND openhabianpi
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'openhabianpi'
}

after some more searching I found this post:

Does it mean it will not work at all? :slight_smile:

Are you sure about the port? it should be 5007 by default, if you want to use 4050 you’ll have to change it first in openHAB (Main UI → Settings → Services → Language Server (LSP)

In question of the “openhabianpi”: this is the hostname set in the Raspberry Pi, so it would change automatically to this name, I guess.

Ok, thanks for the hint. After some playing with the settings I had an additional config issue.
Language Server is running on port 5007. I did check it in the OH settings.
But even with this setting it isn’t working:

{
    "openhab.connection.basicAuth.username": "",
    "openhab.connection.host": "192.168.178.49",
    "openhab.connection.port": 4050,
    "openhab.connection.authToken": "oh.visualStudioNew.XYZ",
    "openhab.languageserver.remotePort": 5007
}

Well, and the API port is 8080 for http and 8443 for https. Where did you get the 4050 port at all?

Well, yes. Sorry, forgot to mention.
I changed this in the Docker container environment settings:

Did you also set the LSP port in docker (not in the picture…)?

Please also remove the username part completely:

{
    "openhab.connection.host": "192.168.178.49",
    "openhab.connection.port": 4050,
    "openhab.connection.authToken": "oh.visualStudioNew.XYZ",
    "openhab.languageserver.remotePort": 5007
}

The LSP port is reachable at port 5007. I checked it by Port scanner.


Just to be sure I deleted the user name setting.
But still no luck

I’m not much more than a VSC user but recognize that there are two possible setting locations. The “global” one under the “wheel” at the bottom left and the “folder” one contained in the folder. AFAIK the folder one overrides whatever is in the global. My folder (samba shares accessed from windows) settings are simply (and working-maybe from something else I did a long time ago?)

{
    "openhab.useRestApi": true,
    "openhab.connection.host": "http://192.168.0.212",
    "openhab.connection.port":8080,
    "openhab.languageserver.remoteLspEnabled": false
}
1 Like

saved my day. thank you!