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?
Hi, is it going to be updated anytime soon? I miss sooooo much function “create items from thing channels” (or some similar name).
The deprecated paramters could be removed anyway in the nearer future.
But currently i am not investing any time into the extension, due to time limitation on my side.
I may have time to do some basic little fixes, like removing the old paramters completely, but will currently not do any refactorings or bigger additions and improvements.
But as said many times already in different places.
This is not a one man show. Everyone is welcome to get some skills and help out.
I have proven many times that i am willling to get some spare time for helping others get into gith/github/coding (the last one limited to my self learned knowledge).
But i have not seen anyone willing to seriously jump in here in the last years.
I completely understand you, but I am sorry I am not able to support you with further fixes or development due to missing knowledge in tools development.
If I can help you with providing information or testing something this would be possible.
Had the same issue. Turned out I got improper double quotes when copying it from the web. There are three characters, intro and closing quotes and the one from the keyboard.
Hi all. I have created and set an API key. I have also set the host to the right IP, 192.168.178.100. Yet, I am getting this error message:
connect ECONNREFUSED 192.168.178.100:8081
Is there still anything else I need to enable in openhab besides creating the API key?
Did you set the AuthToken in the VSCode Plugin openHAB section?
Yes that is where I added the key. The config currently looks like this:
"workbench.colorTheme": "Default Dark+",
Mine looks like this:
But I am not sure if you need
Nope, that is not the correct Auth Token. Please create a new one and paste it completely to the connection configuration, like this:
Please keep attention about openhab.connection.host and openhab.connection.port