VS Code openHAB Extension!

syntax
ide
vscode
Tags: #<Tag:0x00007f6ce56c5b20> #<Tag:0x00007f6ce56c59b8> #<Tag:0x00007f6ce56c5878>

(Jerome) #21

OK thanks for the explanation.


(Jerome) #22

OK thanks for the explanation.


(Mark) #23

This is an awesome tool. Thanks for creating it.

Running it on a Mac, and only ran into one issue so far (which actually is not a Mac issue). If openHAB is running on a port other than the default 8080, the sitemap display doesn't work because the port number is hardcoded to 8080. Is this something that could be made configurable in the future?

Thanks!


(Kuba Wolanin) #24

Absolutely! @dennisausbremen is making some awesome progress with configurability and macOS support, see: https://github.com/openhab/openhab-vscode/pull/14

Port is indeed hardcoded here. I didn't realize you can serve OH on port other than 8080. :slight_smile:

Thank you guys for an amazing feedback!


(Mark) #25

Thanks! Guess I need to put this repo on my watch list. :slight_smile:

Concerning configuration, it would be really cool to have multiple configs for people with several OH instances. It would be nice to be able to select a config and have it load the hostname and port, as well as the path for the config directory. For example, I have 4 OH instances (dev, test, and 2 prod instances). The dev instance is the Eclipse IDE on a Windows box, the test instance runs on an Ubuntu box with a non-default port (something else is on 8080), and the 2 prod instances run on headless industrial PCs located in racks. All the configs are Samba shares to the Windows box.


(Kuba Wolanin) #26

This would be definitely possible thanks to VS Code Workspace settings.
Once you open folder in vs code and save it as a workspace, you'll be able to store all kinds of settings in /<yourworkspace>/.vscode/settings.json file. Its content would look like this:

{
    "[openhab]": {
        "hostname": "192.168.0.2",
        "port": 9090
    }
}

But that requires @dennisausbremen's implementation first :slight_smile:


(Dennis) #27

@mhilbush: Since my PR is merged now, you just have to wait for @kubawolanin to make a new release and you're good to go.


(Kuba Wolanin) #28

I'm planning to release 0.0.2 later today.

I'm also wondering if you'd like to see a feature of a quick openHAB documentation search within VSCode, just like we do with Basic UI. Interested?

  • Keep Docs search in a separate browser window
  • New "quick Docs search" tab within VSCode

0voters

Votes are public.


(Jakob Jensen) #29

I'm pleased to announce that openHAB has now an official Visual Studio Code28 extension.

Great!!! Thanks for the good work on this :slight_smile:


(Rasmus Balle) #30

Respect... that's totally awesome.... Looking forward to see further progress :slight_smile:

Where to change the Default path to the OpenHab service running? I'm accessing it through a Samba share on another Windows PC :slight_smile:


(Hans-Jörg Merk) #31

When you enter the open directory dialog, just enter

\\yourserverip\sharename\conf\

This worked for me.


(Semperor) #32

OUTSTANDING.

Short question: how to colorize the source code? I only see grey text...


(Kuba Wolanin) #33

Just make sure your file has one of the following extensions:

                "extensions": [
                    ".rules",
                    ".script",
                    ".items",
                    ".sitemap",
                    ".things",
                    ".persist"
                ],

It should work right away after you install the extension.


(Semperor) #34

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.!


(Rasmus Balle) #35

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


(Hans-Jörg Merk) #36

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


(marcel_erkel) #37

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.


(SiHui) #38

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


(Kai Kreuzer) #39

@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?


( ) #40

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.