Closed alwashe closed 3 years ago
+1
@alwashe According to your screenshot the value of "openhab.host" ist set to "openhabianpi". If this name is not known in your network the address can't be resolved. You could try a "ping openhabianpi" on the command line to see whether the name could be resolved.
If the name resolution does not work, use the IP address like you already wrote in your original post and restart VSCode.
Please don't close this, clearly the settings are not read as extension tries to connect to openhabian:80. Are we defining the settings wrongly or in a wrong place? Tried to set them both in User and Workspace settings.
Seems you are defining settings in your OH config folder. You have to define them through the vscode settings menu, at least thats the convinient way.
I don't know if a setting through a settigns file in the folder is read by the extension.
Open settings menu:
Better put on JSON Mode if not already done:
Search for openhab:
You should get the existing settings on the left and maybe already some settings you have edited already on the right:
Here you can edit the settings you need to adapt to your environment.
Please give some feedback here if that worked. :)
Hey @jpalo did you make any progress meanwhile?
Hi @Confectrician , I also tried configuring the host(ip!)/port (workspace, user config) but none of these settings seem to get through (always the default error with openhabian
).
I ended up changing the defaults in package.json
within the plugin, which works (thereby proven validity of my server(ip)/port).
Really strange.
I did several tests last week and changed host config too, which then immediately got used.
I was having the same issue. I updated my "C:\Windows\System32\drivers\etc\hosts" file to include a mapping for 192.168.1.XXX openhabianpi
Where 192.168.1.XXX is the IP of my openHAB2 machine. The plugin instantly started working...
Could you do me a favor and try to ping openhabianpi from the command line?
Would be really interesting to know if it's a network problem or concentrated in Vscode.
Hey Jerome, I am thinking it's the extension. I used the apt-get option for the openhab install and used a custom host name during the setup. I was opting to use the IP address in the VS settings since the documentation led me to believe it could use a host name or IP address. I tried updating the VS settings in the Workspace and the User level (posted below). I tried in both locations with and without the http prefix, and no combination worked. What I noticed is, no matter what I entered in the openhab.host prop, the error message always returned "openhabianpi :8080" in the message instead of the IP:Port, so I thought that it may have been a setting that was hard coded by mistake. I make that mistake from time to time... To test the theory I mapped the host name in the message to my IP using etc\host. As soon as that mapping was made the VS extension started working.
USER: "openhab.host": "http://192.168.1.132", "openhab.port": "8080", "openhab.useRestApi": true
Workspace: "openhab.useRestApi": true, "openhab.host": "192.168.1.132", "openhab.port": 8080
If you need any additional details feel free to reach out! Regards, Matt
On Sat, Nov 2, 2019, 19:20 Jerome Luckenbach notifications@github.com wrote:
Could you do me a favor and try to ping openhabianpi from the command line?
Would be really interesting to know if it's a network problem or concentrated in Vscode.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openhab/openhab-vscode/issues/110?email_source=notifications&email_token=ADUQC6RL2D4LJWDRXUAQLMDQRYDLNA5CNFSM4FRS7ESKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC5HEJA#issuecomment-549089828, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUQC6VIMDY7ZVGILS5XKILQRYDLNANCNFSM4FRS7ESA .
I think openhabianpi
is the default setting, that is given on installtion by the extension,
but we do not include it anywhere hardcoded.
But from what i read it could be possible that the user and/or workspace settings are not choosen by the extension. I have tested the extension with different condiguration scenarios and my settings where choosen as far as i remember.
I will add some more logging to one of the next versions, since i started some work on a well logging base for another problem those days. Maybe we can then follow the extensions workflow better.
To confirm that user/workspace are not chosen, while the default settings are used;
After trying the user/workspace, ended up changing the default of the plugin (~/.vscode/extensions/openhab.openhab-0.5.1/package.json
, line 180, 188), and that worked for me.
Hey @code-id10t and @githeuvel could you pleas epoost some information about your environment whre vscode is running?
Also could you maybe test the current beta extension for reoccurence of this problem? See: https://community.openhab.org/t/vscode-extension-0-6-0-beta-for-testing-available/84832?u=confectrician
Workspace settings are used immediately when i test the beta in my live environment.
Reference:
@Confectrician, I am running Win10 and the 10-15-2019 build of VS Code on both machines I tried. I commented out my fix in the hosts file then installed the beta you suggested. It required a full restart of VS Code, but on restart it connected without any issues. Seems like it is fixed in v0.6.0. I will report back if anything changes. I appreciate the time and effort! Regards, Matt
@Confectrician not sure what information you want on the environment. I'm running osx, and update regularly, currently 10.14.6.
I tried the 0.6.0-beta release, and short story is that it works (mostly, read on). Only, I also removed 0.6.0 and re-installed 0.5.1, and that works now as well 😕.
As I rarely restart my mac, also not sure now if I restarted code at any time in the first place, but especially after configuring the plugin;
The behaviour you demonstrate by toggling the useRestApi
which enables/disables also works for me, but... not for the actual setting(s);
Starting code without specific openhab config results in error; clicking the openhab plugin in the side bar results in error: Error while connecting to openHAB REST API. getaddrinfo ENOTFOUND openhabianpi openhabianpi:8080
, as expected.
Writing/saving the useRestApi
, host
and port
settings to .vscode/settings.json
doesn't change things. While changing now useRestApi
, this is immediately reflected in the plugin availability, a refresh of things or items still results in the same (default) error.
Restart code and it works!
Changing host
and port
to incorrect values doesn't break, untill code is restarted...
Even more so, for me, is if I start code with "openhab.useRestApi": false
, then change it to true
, the plugin does appear on the sidebar, but doing a refresh of items/things, results in an error command 'openhab.command.refreshEntry' not found
. So while it immediately reflects the plugin availability, it doesn't actually uses the setting.
Anyway, short story; it (only) works when restarting code after configuration is enabled/complete.
Hope this helps, and thanks for your plugin/efforts!
I am, to be honest, not sure how ressource clenaup is working on systems that do not restart that often like you describe it.
At least code
should be restarted sometimes, especially in case of extension or configuration updates to ensure a clean init process.
That's a pretty safe way to make sure that old data is cleaned up.
The feedback looks promising in general. I will go on with some more logging for the future (and the whole extension). Maybe this way we can take a deeper dive into the source of this problem.
You should get the existing settings on the left and maybe already some settings you have edited already on the right:
Please tell me how did You turned this left window helper ?
This is the json view, which is explained some pictures above in the same post..
https://user-images.githubusercontent.com/7161177/66251719-7acbf700-e753-11e9-8147-0f047c8548a1.png
But when I turn to jason view I don`t have split view with left side helper. My question is how to turn this left side helper on :)Please, take a look how it looks like in my workspace :
The title of that tab state that those are workspace settings.
In the settings tab (the left one from your screenshot) is the ability to switch betwwwn user and workspace settings.
Maybe you could try to check if it is set to workspace in your case currently.
If yes you could try to activate user settings mode and then switch over to the json view.
Same issue here - extension tries to connect to openhabianpi
despite configuration parameters set. I tried both - workspace and user.
-- edit
This is very weird. I modified the package.json of the extension and reloaded VS. Extension connected fine. But what is weird it is reading the settings now, at least for the port...
Thanks for your feedback 👍
I have watched different issue reportings where the solution were settings that didn't take any effect and falled back to default until some point they did take effect in some mysterious way.
I have already checked our implementation of getting the config, but that looks good so far and is like explained in the vscode extension docs. This is a really tricky thing to troubleshoot.
Same problem here - whatever I put in user and workspace settings is totally ignored. I noticed though that it initially proposed to set "openhab.host" in an invalid location (not in settings) for my workspace area. Maybe that is causing some issues for the extension settings... The other strange thing is that I can set an invalid host name in the extension package.json, it suddenly starts to correctly reads all the settings. It seems that simply forcing a reload of package.json is sufficient to solve the problem as putting back the default openhabianpi is now also working. That is of course after reloading windows twice (after the first reload it notices extensions have changed on disk and asks to reload the windows a second time) Versions:
VSCode 1.45.0 (1.45.1 crashes continuously)
Openhab ext. 0.7.0
OpenHab server: 2.5
Hope this helps
I've got the same problem as described above. But i got it running. All i needed to do was restarting vs code after changing my settings (workspace or user settings, it works for both) to this: { "workbench.iconTheme": "openhab", "openhab.host": "openhab", "openhab.port": 8080, "openhab.useRestApi": true }
Without restart it didn't work. So i assume that the settings are only loaded on startup.
After a complete new installation of my openhabian it is unable to connect. Tried the settings User/Workspace and the default values of the extension. My settings worked for the former openhabian with the same ip, username and password. The old OH installation was the same version as I have now.
I'm pretty sure that the settings are used because altering the openhab.useRestApi does hide the extention from the left side. I even tried uninstalling/installing the extention. No luck so far.
The username and password are working when for login in on the webinterface. Im at the point where I'm doubting which credentials to use. ;-)
VSCode 1.53.2 Openhab ext. 0.8.0 Openhabian 3.0.1
What I used as settings { "workbench.iconTheme": "openhab", "openhab.host": "192.168.1.7", "openhab.port": 8080, "openhab.username": "admin", "openhab.password" : "imnottellingyoumypassword", "openhab.useRestApi": true }
UPDATE: I was successful with using an api token: https://www.openhab.org/docs/configuration/apitokens.html { "workbench.iconTheme": "openhab", "openhab.host": "192.168.1.7", "openhab.port": 8080, "openhab.username": "[The token that I created above]", "openhab.password" : "", "openhab.useRestApi": true }
We recently had an update that watches for settings changes and loads the updated settings immediately (#221). As most of the problems disappeared at some point this will hopefully be solved long term with the reference solution.
Therefore closing this issue.
I use openhabian and i get this while connecting:
Error while connecting to openHAB REST API. getaddrinfo ENOTFOUND openhabian openhabian:80
my settings: { "openhab.host": "192.168.178.65", "openhab.port": 8080, }