OH3, MQTT, Arduino Help

I am working on a school project that uses openHAB to switch three lights on/off remotely. I have openHAB downloaded on my computer and have developed a very basic UI that will get the job done.
I have downloaded the mqtt binding add-on and have also downloaded the mosquito broker and running it on my computer. I have managed to get the broker online,


but I am confused as to how to link the light switches from my UI to the mqtt server. From research I think I have to make a .things and .items file. Any help on the topic would be greatly appreciated as I am very new to openHAB!

Does this help? It’s for a relay, but that’s still a switch…

Check steps 4 and 5.

In short:

  • Create a Thing to represent your device
  • In that Thing create a Channel of type Switch, and configure it with the name of the Bridge Thing to your MQTT broker, the MQTT topics and on/off values as required.
  • Create a Switch Item, and link it to your Thing Channel

That article is useful thank you! It seems like openHAB 3 has a lot more you can do through the UI instead of having to write code like I see in older post on here. To give a little more description of my project I will be connecting to a Arduino UNO which will have an ethernet shield, the Arduino will then send signals to relays to turn the lights on/off.

Welcome to the fun

Can you control you Arduino using a mqtt client eg http://mqtt-explorer.com/

Create a generic mqtt thing but make sure you can control your device through mqtt first.

If you share how you control the mqtt we can help you further