Skip to content

openHAB monitoring plugin

Article last updated: 2026-12-02.

What it does

The openHAB plugin reads the state of one openHAB item through the openHAB REST API and returns it as a Pandora FMS module. Each execution runs one curl request against http://localhost:8080/rest/items/<item>/state and prints one <module> block on standard output.

The plugin is an agent plugin: the Pandora FMS agent executes it, reads the module XML and updates the module of the agent that runs it. It does not create a separate agent and does not keep state between runs.

Prepare

Compatibility

Scope State Evidence
openHAB 2.x or later with the REST API enabled Required The plugin reads /rest/items/<item>/state
curl on the host that runs the plugin Required The script uses curl to call the REST API
A Pandora FMS agent on the openHAB host Required The agent executes the plugin and ingests its module XML
Pandora FMS NG 784 and later Not validated No release-specific validation record exists
openHAB versions and REST API authentication Not validated The script has no authentication support and was written against an unauthenticated local API

Requirements

  1. openHAB running with the REST API reachable. The script uses http://localhost:8080; if openHAB listens on another host or port, edit the URL in the script.
  2. An item with a numeric state. The script always emits a generic_data module, so an item whose state is a string (ON, OFF, OPEN, CLOSED) produces a module that Pandora FMS cannot store as numeric data.
  3. curl installed on the host that runs the agent.
  4. A Pandora FMS agent installed on the same host, with permission to execute the script.

Install the plugin

Copy get_oh_item.sh to the plugin directory of the Pandora FMS agent (for example /usr/share/pandora_agent/plugins/) and give it execute permission:

chmod +x /usr/share/pandora_agent/plugins/get_oh_item.sh

Configure

Add one module_plugin line to the agent configuration for each openHAB item you want to monitor:

module_plugin get_oh_item.sh <PANDORA_ITEM_NAME> <OPENHAB_ITEM_NAME> "<DESCRIPTION>"
Argument Meaning Example
PANDORA_ITEM_NAME Name of the module created in Pandora FMS OpenHAB_LivingRoom_Temperature
OPENHAB_ITEM_NAME Name of the item in openHAB LivingRoom_Temperature
DESCRIPTION Module description Living room temperature

For example:

module_plugin get_oh_item.sh OpenHAB_LivingRoom_Temperature LivingRoom_Temperature "Living room temperature"
module_plugin get_oh_item.sh OpenHAB_Boiler_Power Boiler_Power "Boiler instantaneous power"

The agent runs each line at its plugin interval. The module name is the first argument, so two lines that use the same name overwrite each other.

Authentication and remote openHAB

The script has no authentication options and no configurable URL. If the openHAB REST API requires a token, or if openHAB does not run on localhost:8080, edit the curl line in the script or wrap it in a small script that adds the required headers and URL.

Verify

Run the plugin manually with the same arguments used in the agent configuration:

/usr/share/pandora_agent/plugins/get_oh_item.sh OpenHAB_LivingRoom_Temperature LivingRoom_Temperature "Living room temperature"

A successful run prints one module block:

<module>
<name><![CDATA[OpenHAB_LivingRoom_Temperature]]></name>
<type><![CDATA[generic_data]]></type>
<data><![CDATA[21.5]]></data>
<description>Living room temperature</description>
</module>

If the item does not exist, curl returns an empty value and the module is printed with empty data. Check the item name in the openHAB REST API:

curl -s http://localhost:8080/rest/items/LivingRoom_Temperature/state

Understand the results

  • One module per execution. The module name is the first argument, the type is always generic_data and the value is the raw response of the item state endpoint.
  • No unit or thresholds are added. Configure the unit, the ranges and the alert thresholds in the module definition in Pandora FMS.
  • Numeric items only. Because the type is generic_data, string states are rejected or stored as invalid data. For switches, contacts or other string items, create a wrapper that maps the state to a number, or change the module type to generic_data_string in a copy of the script.
  • The module belongs to the agent that runs the plugin. It does not create a separate agent for openHAB.

Operate and troubleshoot

  • Empty data — the item name is wrong, the item has no state, or the REST API is not reachable at localhost:8080.
  • curl: command not found — install curl on the host that runs the agent.
  • generic_data rejects the value — the item returns a string. Use a numeric item or adapt the module type.
  • The module does not appear in Pandora FMS — check that the module_plugin line is in the agent configuration, that the script is executable and that the agent can run it.
  • The agent logs an XML parse error — the script prints a warning from curl or from the shell before the module block. Run it manually and remove the source of the extra output.

Reference

Command-line execution

get_oh_item.sh <pandora_item_name> <openhab_item_name> "<description>"

All three arguments are required. The script prints the module XML on standard output and exits 1 when no arguments are supplied.

Addon identity

Field Value
Marketplace identifier pandorafms.openhab
Marketplace name openHAB monitoring
Package openhab_V1.zip
Type Agent plugin, module XML
Executable get_oh_item.sh
License Free download