Since questions are being asked repeatedly i wanted to share a quick Thread.
It can be used as a short FAQ when questions come up.
I will add important changes and culprits here when needed.
My Rest API doesn’t work any longer
This should mostly be related to our api security update in openHAB 3.
openHAB 3 introduces an authentication layer to the api.
Basic Auth configuration
You have to configure your openHAB instance proper and add some configuration to the openHAB extension.
Make sure to activate
Allow Basic Authentication in the
API Security settings.
on VS Code Extension config
Add your user credentials (from your openHAB Admin User) to the extension settings.
The needed settings are:
openhab.port settings didn’t change since you installed/upgraded, everything should work again on the api connection.
What about token based authentication? Can i use that?
Yes you can use it with a generated token.
Generate a custom api in the user window of Main UI and copy it in the Username setting for the vscode extension.
Make sure to leave the password setting empty!
I am using openHAB with
https enabled and it still doesn’t work
The code we are using for accessing the api has problems with
https. That’s a known problem.
So you would currently have to allow http requests to the api to get it running.
Basic UI Rendering in VS Code not longer possible when having configured REST API Access?
Thank you very much for providing some guidelines to activate OpenHAB 3 REST API Access to VS Code. I followed your guide and could gain access to Things and Items via REST API in VS Code.
However, when provisioning openhab.username with the API token, I realized that another functionality broke in VS Code: When I want to render the Basic UI in VS Code, the Basic UI is accessed with the API token as username and empty password - as shown in the output window of VS Code. When I copy this URL, I can successully open the Basic UI in the browser, but VS Code cannot. Is there a way to keep this functionality?
I am facing the same problem. please give some suggestion to us. Thanks in advance.
I didn’t check this so far to be honest.
I will try to evaluate what’s happening.
Anyway i am working on a bigger update to replace the “username workaround” with a proper token based authentication with it’s own configuration parameter.
This should probably solve the problem aside.
Is there any chance to work with rules created in OpenHAB WebUI (stored in jsondb)? UI based editor has some ‘IntelliSense’ which is mostly working only for buildin variables. That would be a very nice feature!
Currently there is some work in progress as a “proof of concept” for something similar.
The goal is to access some api parts (so in fact the jsondb in an indirect manner) and transform it to virtual yaml files for editing.
This is of course a limited part for now but may be extended in the future, when we get it running properly.
This is really amazing. Eagerly waiting to be able to test this. Thank you.
Hello to all,
I had several issues with Visual Studio but now “Code Completion, Items View, Things View and Sitemap Preview” works on my machine.
My issue was the “settings.json” for the user.
I saw this message and changed to the new one.
Usage of deprecated config => openhab.host <= detected.
Usage of deprecated config => openhab.port <= detected.
But then my code completion does not work.
I have reverted my change and with this “settings.json” it worked for me.
// latest one but they did not work
// deprecated setting but they work
"openhab.karafCommand": "ssh email@example.com.XX -p 8101 -t 'log:tail'",
@Confectrician: Could this be possible or maybe my Visuals Studio setup is mixed up?