[SOLVED] Openhab 2.4.0-1 Mosquitto binding

Hi Friends,
I am newbie and started using openHAB since last week.
i have installed openHAB 2.4.0-1 (Release Build)
i installed Mosquitto broker using openhabian-config.
I have checked mqtt broker working by different method using laptop , Android mobile app(Mqtt Dash) & Esp8266.
Everything is working fine.
now i want to bind Mosquoitto broker with Openhab.
i gone through Documentation of Openhab but not move ahead.

if anyone have done this binding then kindly help me.

Use PaperUI to add the mqtt 2.4 binding in Add-ons. Since your using Esp devices maybe this topic will help with your configuration.

2 Likes

Thanks for replying,
I have copy & paste .things & .items file as you suggested in above response. & It works fine.
I had checked working status using mqtt client on my laptop.
What I understand is
" . thing file provide connectivity to mosquito Mqtt broker, & creates two things having multiple channels.

. items file identified items from . things file which are defined as channel will their hirarkey."

Am I thinking in right way???

However I now started to modify .things & . items file as per my esp8266 pubsub topics code.

This link will help explain things better than I can,:smile:

The link also has some examples for setting up the esp.

1 Like

Hi,
I have gone through all documents u suggested
& getting some concepts clear but not able to connect my esp 8266 with openhab.

I have esp8266 connected to Mosquitto broker which is installed on openhab.

I have controlled esp8266 using nodered which is again on same raspberry pi3. On which openhab is running.

For controlling 6 relays I have used espPubsub client library & Define topics for each switch as mentioned below.
Topic :-
Ashish/Bedroom/SwitchBord1/front_lights
Ashish/Bedroom/SwitchBord1/rear_lights
Ashish/Bedroom/SwitchBord1/fan
Ashish/Bedroom/SwitchBord1/night lamp
Ashish/Bedroom/SwitchBord1/socket01
Ashish/Bedroom/SwitchBord1/socket02

Using nodered I publish “0” or “100” to each topic from dashboard nodes.
All devices are controlled as expected.
Now I want to use openhab to control all switches.
But not getting success.

Sounds like you have a permissions issue. How did you install openhab on your RPI? You can install node red using the openhab-config tool, the tool will also handle the permissions for you.

I installed nodered & mosquitto using openhab-config.

Have you added the items to a sitemap file and tried to control with BasicUI?

I didn’t followed this two steps
I will add sitemap & revert.
Thanks.

Hi there,
Finally get success.
I have uninstall mqtt binding 2.4
& Install legacy mqtt binding 1.1

Then I followed procedure as mentioned in below URL .

Thanks for providing help.

My next target is to intigrate Alexa echo dot.
Alexa skill is already linked but it’s matter of new thread.

Hello H102, nice idea

In my case from Openhab to Nodered works without problem
I intent to check the status and send back to Openhab. Ex. If I push to (ON or OFF) in my sonoff, this command update the status of my switch on openhab.
You performed it ? You can share your flow ?
For me, the new MQTT 2.4 design foes not make sense

I used this because my customers access from outside (Openhab cloud) and like know if the thing are ON or OFF. And if someone in the house change the status manually (sonoff touch / basic); from outside (Openhab) is possible see the status

Hi,
I have flesh ESP8266 using my custom code.
I have used PubSub Library & also used Digital Inputs for switching output relays.
you can check detail of my project as below.
you can get idea of ESP8266 code by below video. still i am editing code to match with my openhab items files as mentioned above