VS Code support of extension for openHAB 2.5

Colleagues, for several weeks I have been struggling with the problem at the interface between VSC and OH2.5.12.
Everything has been working beautifully for almost two years, but after one of the last updates, when the access method changed from
“openhab.host”: “192.123.123.123”
to “openhab.connection.host”: “192.123.123.123”
I received a communication problem and lost access to online viewing of variable values, which is the worst possible nightmare for me(after hovering over variable name indicates nothing).
I added “.connection.” In the VSC configuration file. between “openhab” and “host” so I can again edit files but still don’t have online preview :frowning:

From what I have found so far it may be related to basicAuth but I do not know if I have to activate it somehow directly in OH (I remind you that it has worked without problems for two years so far) or some minor edition of the OH extension in VSC is enough?

Maybe an extension downgrade would be a good direction?

Did you also change the port setting to the now annotation?
@christoph_wempe tested the latest extension based on his 2.5.x system and had it fully functional.

Please also copy and paste error messages here, so we can see what the reported problem is.

I had some trouble a while ago after an update. I was able by editing settings.json manually while not running vsc (if i remember well). Some old entries seemed to be resistent (should i say “stubborn”?) when being edited by using vsc. Some new didn’t find their way.

.\AppData\Roaming\Code\User\settings.json:

{
“workbench.colorTheme”: “Default Light+”,
“workbench.startupEditor”: “newUntitledFile”,
“workbench.iconTheme”: “openhab”,
“[openhab]”: {
“editor.defaultFormatter”: “max-beckenbauer.oh-alignment-tool”
},
“openhab.languageserver.remoteEnabled”: true,
“openhab.connection.host”: “openhabianpi”,
“openhab.connection.port”: 8080,
“openhab.connection.authToken”: “”,
“openhab.connection.basicAuth.username”: “openhabian”,
“openhab.connection.basicAuth.password”: “secret”,

}

Did not have connection port before, but now included and nothing changed(picture below).
Is that openhab.languageserver.remoteEnabled”: true, somehow important in my case?

Error: getaddrinfo ENOTFOUND openhabianpi

at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26) {

errno: -3008,

code: ‘ENOTFOUND’,

syscall: ‘getaddrinfo’,

hostname: ‘openhabianpi’

}

It should not affect the things and items explorer and the hovering.
It is a completely parallel running part.

“openhab.connection.basicAuth.username”: “openhabian”,
“openhab.connection.basicAuth.password”: “correct”,

Are you sure that you have a basic authentication set up e.g. with a reverse proxy?

Those settings are optional and you should remove them, if you did not setup a basic authentication on purpose.

Also you should remove the authToken setting, since there is no authToken api available in openHAB 2.5.x.

You do not have to use

“openhab.connection.host”: “openhabianpi”,

if openhabianpi does not resolve to 192.123.123.123 in your local network. Instead you may have to use

“openhab.connection.host”: “192.123.123.123”

as you did before.

The file above is only a working axample of my site. Sorry having left this unclear before.

1 Like

It should not affect the things and items explorer and the hovering.
It is a completely parallel running part.

Correct, tested with and without - doesnt work :frowning:

Are you sure that you have a basic authentication set up e.g. with a reverse proxy?

Those settings are optional and you should remove them, if you did not setup a basic authentication on purpose.

That may be clue. I am not sure. Before, couple weeks ago, VSC communicated with OH only with 1line in settings.json and that was:

“openhab.host”: “192.168.7.111”

now after update, might be some security reason, it works only for edit (and that could be because windows option “map as a drive” and not credentials inside settings.json)

@yab no worries, I tried IP addres, localhost and openhabianpi - only IP address does not return error message

I have tried username and password used for putty ssh connection but no preview achieved.
“openhab.connection.basicAuth.username”: “openhabian”,
“openhab.connection.basicAuth.password”: “correct”,

Last thing I did uninstall VSC cause expected some user config mistake :slight_smile: but after reinstallation all configuration files were restored somehow :frowning:

I’d expect the files for openhabextension not to be deleted when uninstalling vsc. Maybe you want to try again: uninstall vsc, delete apdata\Roaming\Code\User\settings.json and also other files in this directory, install vsc + ohextention again.

At first you could also try to uninstall ohextention only. Possibly the confg files are deleted then (maybe optional): uninstall ohextention, make shure appdata… ist deleted, reinstall ohextention.

That is 100% wrong.
Also Password for Main UI is 100% wrong.

If you have not set up a reverse proxa and added an auth config manually you have to reste the basic auth settings to default. (By deleting them in your config file.)

Having problems here too, new 1.0.0 VSCode extension (VSCode version 1.56.2 on macOS Big Sur 11.3.1), OpenHab 2.5:

settings.json:

    "openhab.connection.basicAuth.username": "",
    "openhab.connection.basicAuth.password": "",
    "openhab.connection.host": "192.168.1.20",
    "openhab.connection.port": 8082,
    "openhab.languageserver.remoteEnabled": true,
    "openhab.languageserver.remotePort": 5007

I can access OpenHab on http://192.168.1.20:8082 in my browser and did not change the servers configuration, only updated the VSCode extension (and VSCode).

Output in VSCode OpenHab Language Server console:

Error: connect ECONNREFUSED 192.168.1.1:8080
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '192.168.1.1',
  port: 8080
}

Neither LSP port nor host are used to connect?
On the other side: the status of items is fetched correctly.

Thanks for any input.

Did you use the address or port at any time in the past in your configuration?
At least this special address has never been used as one of our default, so this is a bit confusing.