Adding an MQTT channel in OH 3

Hi all

I’m trying out OH3, having run OH2 for some time now.

Starting from scratch on RPi4 with OpenHABian, no importing of any existing things, configuring everything from the new UI. Added a couple of Hue bulbs for starters, all good.

I’ve got Mosquitto running on a different host where loads of different topics are being updated from assorted devices around my network and displayed / acted upon by my existing OH2 setup. No security in place.

I’ve added the remote broker as a bridge, added a generic MQTT thing using that bridge and I’m trying to add a channel to subscribe to a topic I know is being updated every 10 seconds. I can confirm the topic is receiving new values via MQTT Explorer and also the OH2 installation, but nothing seems to be arriving in OH3. I have the MQTT State Topic configured with the same syntax I’ve used in OH2.

Does anyone have a simple set of steps for how to configure a Thing > Channel for an existing MQTT topic from a remote broker please? I’m sure I’ve missed something simple but I’m not sure what it is!

cheers

Edit:

I can see a value now, but it’s static; it doesn’t refresh live nor change if I refresh the homepage.

Edit again:

Working now. Looking at the logging, I noticed OpenHAB was trying to reconnect to an MQTT broker at an invalid IP address (Raspbian keeps getting a second IP address on the same interface which I haven’t fixed yet). Rebooted the server, all good.

1 Like

Glad you got it all working. You now can use the code tab to input channels faster,

Thanks, that’s a really helpful example!

Actually I’d be interested in knowing how others group their MQTT things. I have a mix of MQTT topics on my broker; Roomba messages via Dorito, RPis doing various tasks now chuck out a status via MQTT just for monitoring, Plex status messages and assorted Wemos D1s running environmental monitors.

I ended up creating a single MQTT generic thing and adding all the channels there, just because I started with a small number which grew.

With this OH3 instance starting from scratch I might create generic things in line with the Model; so perhaps a thing per floor or room. Or perhaps in line with type, so all environmental topics in one thing, etc.

Any opinions very welcome!

cheers

You’re asking for it now!

I think the idea is that a Thing is a single physical device. So your Roomba is one Thing, Plex is another Thing, a single rPi is another Thing, and a single D1 is another Thing.

The Thing is tied to the physical device only, and the Channels are then - exclusively - properties of that device - a temperature sensor, a power switch etc.

Things are not locations - that’s what Locations are, which are just Group Items.

2 Likes

Creating a Generic MQTT Thing for each single physical device is better aligned with adding Things that are not using MQTT so I agree, that does seem a better way.

When there are multiple ways to configure OH, it’s often best to see what the community is doing - appreciate your time!

Thanks