MQTT Brokers & Binding , simplest way for ESP8266 ON/OFF

I would like to be certain, that my method of access of the server MQTT is the good one, I lose myself a little in all the services to activate to arrive at my ends.
1 - Install the MQTT broker “MQTT Moquette Broker”
2 - Install the service binding “MQTT Binding”
3 - Configure the “Embedded Broker” with the correct port number 1883
4 - Add a connection with the “MQTT system broker connection” service that I called: “BROKER CONNEXION”
5 - Create a “Generic MQTT Thing” Object using the “BROKER CONNEXION” service which I call “ESP V2”
6 - Create a channel using the “ESP V2” object which will declare the MQTT topics to be use
7 - Create the items or associate the items
8 - Test with MQTTBox or any other utility that the requests reach the MQTT server
9 - Add the item in the sitemap.

Now , directly from item, can i access to MQTT broker without adding channel ?

Best regards

This broker is no longer supported. It may or may not work for your setup but I recommend saving some time and frustration by uninstalling it and using mosquitto broker.

You did not mention what or how you installed OH nor the OH version. If you have installed on something other than Synology (b/c I know nothing about those) you can also install openhabian. With that you get the openhabian-config tool that can install mosquitto quick and easy.

Do you mean i shoul install mosquitto on my debian linux ? (if yes , very easy to do it)

Now, i also have a look , i assume i did not really understood (maybe missing some examples) , there is too much information , and i do not really know where i have to begin.

But will try :wink:

Should i use this method :
mqtt.things file:

Bridge mqtt:broker:myUnsecureBroker [ host="", secure=false ]
    Thing mqtt:topic:mything {
        Type switch : lamp "Kitchen Lamp" [ stateTopic="lamp/enabled", commandTopic="lamp/enabled/set" ]
        Type switch : fancylamp "Fancy Lamp" [ stateTopic="fancy/lamp/state", commandTopic="fancy/lamp/command", on="i-am-on", off="i-am-off" ]
        Type string : alarmpanel "Alarm system" [ stateTopic="alarm/panel/state", commandTopic="alarm/panel/set", allowedStates="ARMED_HOME,ARMED_AWAY,UNARMED" ]
        Type color : lampcolor "Kitchen Lamp color" [ stateTopic="lamp/color", commandTopic="lamp/color/set", rgb=true ]
        Type dimmer : blind "Blind" [ stateTopic="blind/state", commandTopic="blind/set", min=0, max=5, step=1 ]

I’m not surprised you’re a bit confused, MQTT V2 is so convoluted its not funny. It really needs simplification

I just changed over on OpenHABian - see my posts here, hopefully it helps.

Thanks, Will try that later ,give some news as soon as possible.
Best regards.

Here is some news :slightly_smiling_face:

I remove “MQTT Moquette Broker” and installed Mosquitto MQTT Broker.

Here is my example files

Bridge mqtt:broker:embedded-mqtt-broker [ host="", secure=false]
    Thing mqtt:topic:mything {
        Type switch : ESP1b "ESP BLEU" [ commandTopic="WiWire/ESPXXXXXX/Output/1", on="1", off="0" ]
        Type switch : ESP1r "ESP ROUGE" [ commandTopic="WiWire/ESPXXXXXX/Output/2", on="1", off="0" ]
        Type switch : ESP1j "ESP JAUNE" [ commandTopic="WiWire/ESPXXXXXX/Output/3", on="1", off="0" ]

Switch ESP1b "ESP OUT 1" <lightbulb> (SALON) { channel="mqtt:topic:mything:ESP1b",autoupdate="true" }
Switch ESP1r "ESP OUT 2" <lightbulb> (SALON) { channel="mqtt:topic:mything:ESP1r",autoupdate="true" }
Switch ESP1j "ESP OUT 3" <lightbulb> (SALON) { channel="mqtt:topic:mything:ESP1j",autoupdate="true" }

Frame label="ESP" {
    Switch item=ESP1b label="ESP OUT 1"
    Switch item=ESP1r label="ESP OUT 2"
    Switch item=ESP1j label="ESP OUT 3"

Works fine, now.

My conclusions:
a little disappointed with the final OpenHab product, too many manipulations and interventions to operate a few lamps.
The interface is very user-friendly, but remains inoperative for the few basic functions of adding hardware.
My two tests were just focused on wifi and zwave.
I still have to test some home automation solutions to make my final choice in the solution that I will adopt.

1 Like