VS Code openHAB Extension!

Would love to help you @psych but that didn’t happen to me neither.
The only thing I know that certainly happens is that I need to expose openHAB Console to the outside world each time I upgrade openHAB on openHABian.

If you’re on openHABian, maybe try “Fix permissions” option? (sudo openhabian-config then Apply Improvements > Fix Permissions)

Cheers

Looks the same to me, although I only compared a few blocks by scrolling up and down.

Me:  4F61A0FD056BC0FD8231899EC4D9F9CA06AF0DEC895B2A3B0773F6FBC1C99776
You: 4F61A0FD056BC0FD8231899EC4D9F9CA06AF0DEC895B2A3B0773F6FBC1C99776

I meant this part:

mine:

{CRYPT},_g_:admingroup_g_\:admingroup =

yours:

{CRYPT},_g_\:admingroup =

Well, well, well. I copied your whole line exactly and replaced mine and BOOM, I am in!!

How strange is that?

I will update my other post to reflect what worked.

Thanks.

1 Like

After all that excitement, it would seen the new karaf console is flawed, at least for me, I can’t log:tail anymore, the console just hangs until I press CTRL-C.

Might have to just do a clean reinstall, OS, OH, MQTT, everything. It’s really annoying since I have shared folder set-ups, etc.

Take a look at the folder /var/lib/openhab2/etc/

There should be at least 2 files named org.ops4.pax.logging.*, one with ending cfg, another with dpkg in it. just rename the .cfg to .cfg.old and the .dpkg* to .cfg (i.e. replace the old file with the new one)

Hi! I found this when i was searching for syntax highlighting and autotextcompletion. First of all i want to say thanks for that great work! It is already showing my files in the correct color. Unfortunately i have to connect to the folder manually every time. i read the post, where the autoconnect is explained but i can’t get it working. I’m editing from my mac and connecting to my raspberry via smb. in my workspace setting i wrote:

{
“folders”: [
{
“path”: “/Volumes/openHAB2-conf”
}
],
“settings”: { “settings”: {
“openhab.host”: “openhabianpi.local”,
“openhab.port”: 8080
"openhab.useRestApi": false
}}
}

one thing i noticed there is that it can only connect when i activated the volume prior. when i change the path to:
smb://raspberrypi/openHAB2-conf
it’s not working at all.
what am i doing wrong?
Sitemap previews are not working either.

I never used visual studio before so please excuse my noobish questions. :slight_smile:

Please try

smb://openhabianpi.local/openHAB2-conf

instead.
VS Code is NOT Visual Studio! :slight_smile:

1 Like

I think we need a meme for that. :smile:

3 Likes

yeah i know. that was not clearly written from me. i downoaded vs at first but then i recognized and got the right program (after following the OH extension to the store) … i’ll try later, thank you!

Hi there!

It worked - partly :wink:
I am connected now (after i recognized that the quotes can’t be copy/pasted correctly) even after i restart the program.
but i can’t get the rest api working.

my code:

{
	"folders": [
	{
	"path": "smb://openhabianpi.local/openHAB2-conf"
	}
	],
	"settings":{
	"openhab.host": "192.168.178.90",
	"openhab.port": 8080,
	"openhab.useRestApi": true,
    "openhab.username": "openhabian",
    "openhab.password": "openhabian"
	}
}

i tried the ip adress as host as well as openhabianpi.local

regards

jonas

1 Like

What does "can’t get rest API working’ mean in detail?

If you just don’t see items and things explorer, the extension simply might be initiated yet.
It does not initiate with the start of VSCode.
You have to open at least one openHAB config file (items/rules/things, doesn’t matter which special type) or make it to the “active tab” by clicking into the editor.
At this time the openHAB extension will init itself and connect to rest API.

If you have another problem occuring some details would be good to give a more precise answer. :slight_smile:

You are right, that was not a good issue description :slight_smile:
I try to see the Sitemap preview and when i click there VSC gives me the following:
Error while connecting to openHAB REST API.
And i don’t see the preview but only white color when i click the openHAB icon.
I can access the sitemap as well as the rest api directly with my browser.

Ok that’s something to work with. :slight_smile:

Are you using “basic auth” for your installation or ar this the credentials for e.g. connecting to openhabain reomtely like you would do with a raspberry pi?

If you aren’t using basic auth or don’t know what i am talking about now
try setting it up this way:

"openhab.username": "",
"openhab.password": ""
1 Like

which password is this? when i connect via terminal to my raspberry i connect to:
ssh pi@raspberrypi.local
then when i want to access the OH console i type:
ssh -p 8101 openhab@localhost
or do you mean another password?

I don’t know which userdata is needed here …

Thank you!

Try it exactly as I posted above with no user and password data.

Those settings are only needed if you have enabled an additional security layer.

not working :frowning:

i am editing the Workspace-Settings, right?
I recognized another settings file in the OH-Config Folder:
.vscode and there settings.json.
but that one is empty.

Same error message?

yep

@Jonas88 please try the extension from this post:

The fix from there is not released yet.
Read the VSCode docs on how to install an extension manually.