VSC - openHAB5 - REST API

Hi there!

I had the connection running for years now. Since I changed from OH4 to OH5 now I got an error when the VSC oh-extension tries to read the items from my openHAB instance. The ‘things’ are working and shown properly.

I renewed the API-Token. I switched of “implicit user authentication"

I get this error:

openHAB vscode extension has been activated
Could not reload items for HoverProvider
Could not reload items for Items Explorer
---
    Error:
        Error while connecting to openHAB REST API.

    Message:
        Error: Request failed with status code 500
---

Thanks

Best, Dirk

No problem here, but I made a complete new install with debian trixie and openJDK21 (plain apt package, no openHABian scripts)

Maybe double check that all parts of configuration are correct:

"openhab.connection.host": "http://ip.of.your.openhab-server",
"openhab.connection.port": 8080,
"openhab.languageserver.remoteEnabled": true,
"openhab.languageserver.remotePort": 5007,
"openhab.useRestApi": true,
"openhab.connection.authToken": "<complete Token, starting with oh.tokenname.>"

and of course lms port has to be set to the same port in openHAB :slight_smile:

1 Like

Hi Udo! Thanks for your response. I had a very strange behavior. The things were listed - but no items.
Same problems within openHAB. Items were not listed and GUI was not responding within the items list. So I became skeptical, that VSC has nothing to do with my problem…

I commented some new items out. I checked all the work done as a difference from my git repository. With all changes commented out the item list was filled in OH and now also in VSC.

So obviously no problem with openHAB extension within VSC. But a strange behavior. I do not remember such a behaviour in OH4 or OH3. there was no error shown nor in the logs when saving the .items files. I will try to understand it…

Thanks, Dirk

Hi,

I’ve been having the same problem for a few weeks now…
Connecting with a token from vscode to openahab no longer works.

The OH log always says “Token not recognized,” even though I’ve tried regenerating it several times.

I’ve reinstalled the OH extension in vscode, but I can’t…

but the esxtension also disapper form activity bas on VSC !!

Maybe I have some incorrect settings in runtine.cfg…
Does anyone have a list of all the correct settings to check on both sides, i.e., on vscode and in OH?
I use everything configured with files in OH.
Thanks

Hi, I found the problem….

it was the file setting.json inside the folder .vscode at the top of explorer…

the setting inside this file was not correct and they are different from the setting on viscose, then I delete all of its…

now it’s working!

regards