[SOLVED] VS Code openhab connection

Tags: #<Tag:0x00007f5c9546f548>

Hello I got always the error on Startup ov VS Code

[Error - 11:25:45] Connection to server is erroring. Shutting down server.
[Error - 11:25:46] Connection to server is erroring. Shutting down server.

Here is my user/workspace setting:

{
    "openhab.host": "smarthome.fritz.box",
    "window.zoomLevel": 0
}

my openhab is reachable through

http://smarthome.fritz.box:8080

any ideas??

I would guess that the language server is erroring.

could you deactivate the openhab.lspEnabled setting and test if it stoll occurs?

No error message now occurs

But if I type “rule” and press “ctrl + space” this message popsup

Error while connecting to openHAB REST API. connect EHOSTUNREACH 192.168.178.75:8080

But the IP must be
192.168.178.57:8080

How about using the IP for the host then? That would avoid potential issues with host name resolving.

2 Likes

I am completeley new to OpenHAB and am trying to work through some tutorials. Because I am so new, I don’t know where or how to access the “user/workspace settings”.

As I go through tutorials, things don’t seam to be updating as I expect. I don’t know if the errors i’m getting when I amend files in VS are just my mistakes or are because of the “Shutting down server” error. Sometimes I spot errors but other times I can’t see what I have done.

I would be grateful if someone could explain to a complete incompitant how I change the user/workspace settings so that I can rule this out.

I’m getting more grey hairs by the day.

1 Like

My config is not working :frowning: does anyone know why?

 {
    "openhab.host": "http://192.168.1.232",
    "openhab.port": 8080,
    "openhab.remoteLspEnabled": true
 }

Error Message:
Error while connecting to openHAB REST API. getaddrinfo ENOTFOUND openhabianpi

The extension is trying to connect to openhabianpi instead of the adress you have configured.

Where did you edit your json settings?
There are several possible locations for editing the settings.
See https://code.visualstudio.com/docs/getstarted/settings for reference.

1 Like

in the File you described in your GitHub comment :wink: https://github.com/openhab/openhab-vscode/issues/110#issuecomment-538626369

After restarting it takes the right IP Adress but it is not working at all.

So we have 2 problems now. Rest api and lsp ar indivudial implementations that are living parallel besides they share the same config.
Have you tried using the ip without the http:// in your config?

Secondly i would assume that http://192.168.1.232:8080/rest is reachable from your browser,
but it would be nic if you could confirm that too. :slight_smile:

I think there should be an output window for the extension too.
You can change the view with that dropdown on the right in you screenshot.
Maybe there is some more logging.
I am trying to add more and more logging output, when touching functions in the extension, alltough we are far away from a well coverage.

1 Like

Yes I tried but it doesn´t work

yes i can reach the REST API

The only output I get from there is

[Error - 10:03:05] Connection to server is erroring. Shutting down server.
[Error - 10:03:05] Connection to server is erroring. Shutting down server.

I also tried it at my work openHAB instance.
There is the error message more in detail.

My config:

{
    "openhab.host": "http://172.21.10.239",

    "openhab.port": 8080,

    "openhab.remoteLspEnabled": true,

    "settings": {}

 }

My error messages:

    Missing property "folders".
    Unknown workspace configuration property [2, 5]
    Unknown workspace configuration property [3, 5]
    Unknown workspace configuration property Unknown workspace configuration property [4,2]

@Confectrician do you have a idea to solve it?

What’s this? I think that should be removed. :sunglasses:

1 Like

thx for reply @noppes123

I removed it.

the extension still says that openhabianpi has not been found.
But in my config i tell him to use the IP 172.21.10.239. where does the openhabianpi come from? where do i find the other configs?

There are multiple places where VSCode stores its settings. From lower to higher priority they are:

  1. Default settings - if nothing is specified elsewhere.
  2. User settings - applied to all VSCode instances
  3. Workspace settings - these overrule any User or Default setting. Note that workspace settings can be found in one of two places: the .vscode folder at the root of the project, or in the workspace configuration file.

Did you check both places for conflicting settings and restart VSCode in case of a change?

1 Like

i edited the settings.json file only in the folder “.vscode” at the Workspace.

Did that solve your issue?

1 Like

No :frowning:

And this?

Can you share both settings.json files?

1 Like