VS Code openHAB Extension!

Hm… I realized that code --install-extension openhab-0.0.2.vsix didn’t worked for me. I had to install the vsix file via the extension menu within vscode.

Now it works with colors. That’s great.

T.H.A.N.K. Y.O.U.!

1 Like

Yes - but was thinking for the simulation of the sitemap, Visual Studio must know the IP where OH is running :slight_smile:

It takes it out of the information given by opening the folder.

Example:
On my Windows machine, I tell Visual Studio to open a folder and enter

192.168.0.xxx\openHAB\conf\   (with leading double backslash)

It then finds the subfolders and files to modify.
When I open one of my sitemaps and start simulation, it knows that my openHAB server has IP 192.168.0.xxx

1 Like

Open File->Preferences->Settings and add the openhab specific parameters:

{
“openhab.host”: “<your openHAB host>”
“openhab.port”: “8080”
}

I have added them to user settings.

I can confirm that the Sitemap preview also works on Ubuntu.

3 Likes

Ahhh, I was already wondering why it worked with version 0.0.1, but not with 0.0.2 anymore.
Thx!

@kubawolanin This is really excellent! I just installed it myself for the first time on my Mac to see what the fuzz is all about :slight_smile:

Even though we do not yet publish it in the official extension store, I would actually like to mention it as a great new feature (and possible alternative to the Designer) with the 2.1 announcement - any veto against this? Another question would be, if we should have a dedicated category here in the forum to discuss it - maybe a new entry in the Apps&Services category? Wdyt?

I feel the same way, great addition @kubawolanin! I can say that even without having tested the extension yet :smile:

@Kai I’d agree on both points.

Thank you Gentlemen! :blush:

I’ll be honored! :slight_smile:

Great idea!
There’s more things to come with this extension, so I’m sure there will be something to discuss.

I spent my weekend polishing separate Items view in the sidebar. You’ll be able to see a tree view of your grouped items, find references to them in the code, copy name and more :smiley:
Oh, and it utilizes REST API!

I hope I’ll be able to deliver working 0.1.0 next week.

7 Likes

Oh, and it utilizes REST API!

Sounds excellent :slight_smile:

Here we go: VS Code - openHAB Community
Keep up the good work!

I’ve noticed a small bug.

I have a few items which use an icon called switch. This highlights pink, even though its within < >. All other icons are highlighted white.

Eg

Otherwise the whole experience of using VS has been extremely good. Very nice work!

Hey Paul, thanks for reporting!
Could you raise an issue on projects GitHub?
Cheers

Done.

I added it there to keep the repo issues up to date. :slight_smile:

Thanks very much.

Head’s up! There’s a new version of the extension - 0.1.0:

Feel free to continue discussion on the new thread :slight_smile:

5 Likes

This is just great. Even though it’s a pre-release, it’s way more suitable to be the official editor than openHAB Designer. It just has the ultimate feature that designer doesn’t have: Creating new files :joy:

CTRL-N would have solved that problem :grin:

OK, in this case I go for customizability, Git support and an acceptable startup time :grinning: The only thing I miss is autocompletion for the rules API.

2 Likes

Hi @kubawolanin,

When trying to access suggestions via ‘Ctrl+Space’, I get the following error:
Error while connecting: Error: getaddrinfo ENOTFOUND openhabianpi openhabianpi:8080
Is this a bug?

Thanks,

George

The completions service is tightly coupled with the REST API of the openHAB, so in order to get them, you need to edit your user settings in VS Code ( Ctrl + ,) and add the following parameters - openhab.host and openhab.port (optionally).

Your settings.json might look like this:

{
    "files.associations": {
        "*.log": "properties"
    },
    "window.zoomLevel": 0,
    "powermode.enabled": false,
    "workbench.iconTheme": "openhab",
    "openhab.host": "home",
    "openhab.port": "8080"
}
1 Like

Do you think that error checking for sitemaps and things/items files would be a possibility in the future? I think this is the only feature that the smarthome designer has over the VS code extension.