I am trying to add the GPIO items (Contact status; Light status) to the MQTT broker so it can then publish back to the GPIO to provide commands. I’m assuming this is possible down the line…
First of all I would like to overcome the aformentioned hurdle.
MQTT requires a bit of configuration before it can do automatic discovery. And even then, it can only do automatic discovery on certain standards.
You need to click “Manually Create Thing” and choose MQTT from the list and create an MQTT Broker Thing. Fill out the information necessary to connect to your MQTT Broker in this Thing.
Then, since it doesn’t appear you are using anything using the Homie or Home Assistant MQTT standards, you will need to manually create a Generic MQTT Thing (same procedure as above). Once create you then need to manually create the Channels on the Thing where you enter the MQTT topics, transformations, etc.
I did try clicking “Manually Create Thing”, but nothing appeared.
I was expecting at least the following:
-Generic MQTT Thing
-HomeAssistant MQTT Component
-Homie MQTT Device
-System MQTT Broker
As I have seen on a number of helpful youtube tutorials…
Maybe I didn’t word that sentance too well. What I’m trying to say is have the status of the buttons connected to GPIO be subscribed to the broker. Also be able to publish so that relays can be driver by the MQTT broker.
If my understanding of how MQTT system works is correct.
MQTT broker does not drive anything. It is a passive message router. Generally something like an ON command intended for e.g. a Sonoff relay would be published by openHAB to a particular topic on the broker.
That’s the end of that, unless some device has also subscribed to this broker to listen for that same topic - hopefully our Sonoff relay, perhaps. The broker then passes the message along.
The broker has no idea what the messages are about, it is just a postman.
The relay has no idea what prompted the action, it just gets a command from OH.
If you are looking to link an openHAB Item whose state is set by a GPIO pin to another openHAB Item that controls a relay via MQTT, you would generally use rules.
It is also possible but less flexible to use channel profiles.
None of which addresses your immediate problem I’m afraid, how to create a broker Thing. PaperUI > Configurations > Things > + > Choose Binding
Have you actually installed a broker anywhere yet?
Thank you for your explanation. As you can probably tell, I’m a Newbie, looking to implement a system in my house. I’ve looked into how to handle the automation characteristics, and see MQTT to be the answer, but maybe I’m barking up the wrong tree.
I’m looking to install the broker soon, as the problem I was having has evaporated overnight.
It all depends what you mean by “automation”.
MQTT is just communication. “Something” at one end sends messages to something(s) else at the other…
Any other behaviour - automation? - depends on the somethings at the end.
Something X might be openHAB making decisions. Is it dark, did that door open? I’ll instruct that light to turn on.
Something Y might be a light switch. Did I get a message to turn on? I’ll do that, and reply with a message to say what state I’m in now.
You can replace MQTT with Modbus or a wet string, so long as both ends understand the communication.
Note that in openHAB, the “door open” state might come from zwave, the “dark” might be calculated, or might obtained from a web service, the light switch might get messages over MQTT or HTTP or Modbus or zwave or DMX or a wire from a GPIO or …