Press "Enter" to skip to content

How to setup Visual Code with Openhab 3

bist 0

It’s really cool to have Visual Code know about your Openhab server. Things like automatic items configuration by looking at things in openhab are a time saver. However, since openhab 3 an additional step is needed.

Generating a API token is now needed. See below if you want to skip ahead.

Configuration

  • openhab.host (mandatory), default: openhabianpi
  • openhab.port (optional), default: 8080

openhab.host will also work with the IP address of your openHAB instance, instead of the hostname.

These settings should work fine on Windows machines and openHAB installations using the recommended openHABian setup. They should be edited if you use macOS or *NIX systems or manual openHAB installations.

To edit these settings, simply add overrides to either your user settings or your workspace settings in your Visual Studio Codes preferences.

For further informations on how to change your settings, visit the official Visual Studio Code docs.

{
 "openhab.host": "openhabianpi.local",
 "openhab.port": 8080
}

openHAB 3 Rest API

Since openHAB 3 (with its on default activated api authentication) has been released you have to fulllfil some additional steps to get a working connection.

  1. Generate an api token for your user
  2. Add the generated token as openhab.username configuration
  3. Leave openhab.password empty
  4. Reload vscode window

Reference https://github.com/openhab/openhab-vscode/blob/main/docs/USAGE.md

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.