Irrigation with OpenHab2 and MQTT: Problems getting started

Hi,

I’m using the latest OpenHAB2 on a raspberry pi 3 with the latest Mosquitto. In OpenHAB’s PaperUi view I installed MQTT Binding 2.4.0.

Under “Things” I was able to configure the MQTT Broker setting “Location” to “OpenHAB-Raspberry” and the “Broker Hostname/IP” to “localhost”. The “Things” view tells me, the “Status” is Online.

I’m also able to publish information via Mosquitto from the shell,so this is also working.

What I don’t know exactly is, how my further steps have to look like. I don’t have specific hardware running, but another Raspberry Pi that is responsible for opening and closing the valves of my irrigation system. The python script on my irrigation Raspberry Pi subscribes to /garden/irrigation and listens to the valve and its state. So I want to be able to switch on each of my 5 valves via OpenHAB.

I don’t know, how to add each valve to the OpenHAB 2 in Paper Ui, now. I already tried to add a Channel with “MQTT Topic” “/garden/irriigation”. All other settings are default.

In the “Configuration” menu, I don’t see “Items” as I saw it in several YouTube videos and tutorials. When I select “Sevices” in the menu, I always get a pop-up message “MQTT system broker conection org.eclipse.smarthome.mqttbroker”. When I click on “Manage” I’m not so sure, what to enter or if I need this at all.

Would be very kind if you could help me.

Thanks and kind regards,

Dirk

You need to create another MQTT thing - in your case i would use a Generic MQTT Thing.
And within that thing you then create different channels.
Finally you need to create items to the channels - either via PaperUI or using an .items file.
Maybe that also helps you getting started:
https://community.openhab.org/t/migrating-mqtt1-items-to-mqtt2-4-items/60502/14

1 Like

Good Morning and merry Chirstmas!

Thank you Sascha. First of all: I now could solve it.
What you describe is, what I made before creating the topic but that didn’t work: I first generated a Broker thing and then a Generic thing using the earlier created Broker (I forgot to mention it, since I deleted it while not working). To this Generic thing I added channels listening to the topic

What I did after your post: I deleted everything I created including the add-on. Then I started form stratch and it worked. What I now found out (I had to recreate everything several times). When I already created Generic things and then change the Brokers “Location” value, it doesn’t work anymore. Even when I change back the Location to what it initially was, it doesn’t work.

Is this normal? I wouldn’t expect such a behaviour.

Thanks and kind regards,

Dirk