openHAB VS Code Extension 0.3.5


(Kuba Wolanin) #1

What’s new

  • Fixed issues with non-root workspaces (#62)
  • Fixed issues with REST connection (#58)
  • Added some Type Conversion snippets (#60)
  • Added ‘Open Karaf console’ feature (#59)
  • Optionally open Classic UI for sitemap preview (#54)

Quick Karaf console access demo

Installation

This extension is available on the Visual Studio Marketplace -> https://marketplace.visualstudio.com/items?itemName=openhab.openhab

You can also install it manually:

  1. Download openhab-0.3.5.vsix on your hard drive
  2. Open command line in the same folder you downloaded the extension
  3. Type the following command:
code --install-extension openhab-0.3.5.vsix

This version will override the previous one.

  1. Open Visual Studio Code
  2. Open openhab configuration (openHAB-conf) folder as your workspace
  3. Open user settings (Ctrl/Cmd + Shift + S) and set "openhab.host" to your openHAB IP address
  4. Enjoy! :wink:

How to Install Eclipse SmartHome Designer?
(Paul Muldoon) #2

I’m becoming a pretty big fan of the OH VS code extension. But can you explain what you did to enable SSH in the terminal? I see the screen shot says ‘1: openHab’ in the corner of the terminal whereas mine shows powershell.

is there an extra step needed to SSH login via VS code?


(Kuba Wolanin) #3

Glad you find it helpful Paul!

I’ve set up Git Bash as my default VSCode terminal.
In order to do that hit Ctrl + , and set this option:

"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",

Of course the following path applies to Windows only.

is there an extra step needed to SSH login via VS code?

Here’s a list of what you need in order to properly run Karaf in VSCode.

Cheers


(Martin Herbst) #4

Another option for ssh on Windows is to install the clien part of OpenSSH for Windows (http://sshwindows.sourceforge.net/).


(Gerrit Visser) #5

It would be very helpful to beginners if you added that line to the information on ‘what you need in order to properly run Karaf’ so that we don’t need to install more sw on our desktops. At least for Windows 10 users we have access to bash, thus ssh.


(Kuba Wolanin) #6

Hey @gerritv,

Feel free to change the README yourself - https://github.com/openhab/openhab-vscode/edit/master/README.md
You can submit a Pull Request.


(Hallo Ween) #7

Hi, i tried the new version, is working very well.

But if i add this line:

"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",

I don´t get a working terminal. I think i have to install this new bash first from git?

Without this it is working with windows powershell.

I´m on win10 prof.

How can i use the included win10 ssh bash instead of powershell? Only change a line in the config or do i have to install an additional app?


(Kuba Wolanin) #8

Hey @halloween,

The line is needed if you want to change your default terminal in VSCode. There’s documentation for it on vscode site, please take a look.
If you use Win10 you should already have ssh accessible globally and there should be no additional configuration steps.


(Hallo Ween) #9

I only have powershell, no other terminal:


(Hallo Ween) #10

But the question is, what can i do inside Terminal if the openhab installation is on another server? Is this usefull in this case?


(Sergey M) #11

I installed it and it works!


(Gerrit Visser) #12

You have to use Ctl+shift+p to get to Command Palette (or View/Command Palette). Scroll through the list until you get to openhab, click on that. This will be near the top of list in future (recently used).

MinGW is easily installed from the Windows Store. A better solution to get SSH than using external programs as you also get bash etc,


(Gerrit Visser) #13

I will submit a PR soon, a few other things to learn first.


(Hans-Jörg Merk) #14

@kubawolanin Ever thought of running VS Code in a browser, e.g. like
https://stackblitz.com/ ?


(Hallo Ween) #15

Very strange thing… Today i updatet my oh 2.2 to latest snapshot, now i can use rule syntax checking.

But i have lost to use tabs. Before the update, i was able to open many tabs with many rule-files, item-files and so on.

Now i only can open 1 *-file and when i click on the next file to open, it opens in the tab of the last opened file. So only one open file in the upper tab-bar.

Any idea what could be the problem?

The enable-tabs on workbench setting is “true” - i didn´t change anything on my configuration, except i made the snapshot update.


(Sergey M) #16

I have been so long. I did not look for solutions, just drag and drop the file into the workspace from the Explorer.


(Hallo Ween) #17

Thanks, this workaround is working.


(Hallo Ween) #18

The syntax checking is not very stable…

I often get error messages in the “Problems”-field and i have to restart VSCode to get rule checking back.


(Kuba Wolanin) #19

Please report any defects here.

But i have lost to use tabs. Before the update, i was able to open many tabs with many rule-files, item-files and so on.

@halloween, could you confirm that the tabs are broken because of the openHAB extension? Please deactivate the extension, reload window and test it again.

Also, please remember to share more details on your environment when you report bugs such as yours.
What’s the OS, what’s the VSCode version etc.


(Kuba Wolanin) #20

It’s an issue on the backend side, see issues here and provide more details, logs or +1s in the existing issues.