if this is wrong place to put it please move it to proper place
openhab-cli
openhab-cli is a command-line client for the openHAB REST API. It provides the oh command for inspecting and managing an openHAB installation from a terminal, a script, or an AI coding agent.
The command tree follows the openHAB API. It covers items, things, rules, add-ons, persistence, services, sitemaps, voice, and the other endpoints exposed by the bundled OpenAPI specification.
Installation
Download the latest build from GitHub Releases. Each release contains:
- a Linux x86-64 executable;
- a Windows x86-64 executable; and
- a runnable JAR for other platforms. The JAR requires Java 21 or newer.
Rename the native executable to oh (oh.exe on Windows) and place it in a directory on your PATH. On Linux, make it executable first:
chmod +x oh-<version>-linux-x86_64
sudo mv oh-<version>-linux-x86_64 /usr/local/bin/oh
Run the JAR directly with:
java -jar oh-<version>.jar
Initial setup
Save the URL of your openHAB server:
oh _config server set https://openhab.example.com
Next, save an OAuth token. Omitting its value opens an interactive prompt, which keeps the token out of your shell history:
oh _config account login --oauth-token
Username and password authentication is also supported:
oh _config account login --username --password
Token authentication is recommended. To use a username and password, enable Basic Authentication in Main UI → Settings → API Security on the openHAB server.
The default configuration file is ~/.oh/oh-cli.properties. Pass --properties-file to a configuration command to use another file.
Usage
Run oh to list the available command groups:
oh
Append --help at any level of the command tree to inspect its commands and options:
oh items --help
oh items itemByName --help
For example, list every item:
oh items items
Retrieve one item by name:
oh items itemByName KitchenLight
Enum values are case-insensitive. JSON output is pretty-printed by default; use --no-pretty-print when compact output is more convenient for a script.