MQTT JSON items not visible in OH2 UI

I am unable to get my items to appear in the UI within OpenHAB.

I believe I have configured MQTT in OH2 correctly - the items I have configured appear in the “Configuration>Items” page - however they are not visible in the “Control” page, nor the Basic UI.

I am running this on a RasPi 3B running Raspbian Lite. Both Mosquitto and OH2 appear to be operating correctly.

The /etc/openhab2/services/mqtt.cfg file has this line:

mqtt:broker.url=tcp://localhost:1883

The /etc/openhab2/items/weather.items has these lines:

Number temperature "Temperature [%.1f]" {mqtt="<[broker:weatherstation/reading:state:JSONPATH($.temperature)]"}
Number humidity "Humidity [%.1f%%]" {mqtt="<[broker:weatherstation/reading:state:JSONPATH($.humidity)]"}

A sample message from that topic is here:

{"Sensor_ID":"A4E","humidity":75,"temperature":15.5,"wind_speed":4.3,"wind_speed_max":5.4,"wind_dir":135,"rain_sum":24.6,"validity":1,"full_message":"A4 E2 2B 4B 4 5 0 52 6 F2 ","packet_count":949,"bad_count":242,"spacing":95974,"average_interval":95102,"rain_mm":0}
1 Like

(unfortunately), they won’t appear in the PaperUI->Control tab. There, you will be able to see items that are linked to channels of Things. The Thing/Channel/Link/Item concept is valid only for openHAB 2.x Bindings.

The MQTT binding is a version 1.x binding and works only with items (no things or channels or links)

To make them appear on the BasicUI, you need to create a sitemap file in /etc/openhab2/sitemaps

A very basic example (file= Home.sitemap) would look like:

sitemap Home label="Home"
{
	Frame {
		Text item=temperature
		Text item=humidity
	}
}

then, you can set (to “Home”) the default sitemap for the BasicUI in PaperUI->Configuration->Services->UI->BasicUI->Configure->Default Sitemap and navigate to http://<OH2_IP>/basicui/app to see you stuff

1 Like

Thanks for pointing me in the right direction, it’s working! Will be adding the rest of my weather parameters now.
Cheers

1 Like