The Sonoffs are connecting with the broker:
In the folder /etc/openhab2/services, it was created the file mqtt.cfg with this content:
It was created an item to send MQTT message to Sonoff to turn on or off the light.
So, I tried to see if OpenHab is sending MQTT messages, the broker receives the answer to the Ping, but OpenHabian don’t send the MQTT message.
The light don’t turn On or Off, can anyone support me in this problem?
You’re probably using some old tutorial about MQTT binding version 1
MQTT version 2 binding uses quite different configuration, with Things and channels.
You need to be consistent about which you use.
I have already an Openhabian working with that configuration.
So, I’m preparing a new one with the OpenHabian new version.
Are you saying this don’t work anymore?
I’m saying if you want to configure MQTT binding using mqtt.cfg file, then you must install legacy MQTT binding version 1.
If you want instead to install and use the current MQTT binding version 2, then you will have to configure it a different way, using Things.
It’s up to you; I have no idea how your other system is set up or what is installed there.
In biddings only appear the version 2.5.3 to install.
I replicate what I had in the first Openhabian that is working. So, what I need to do?
If you want to be offered version 1 bindings in the list, I think you need to configure “enable 1.x legacy bindings” in
PaperUI > Configuration > System
Or else you need to learn how to configure MQTT binding version 2.
I configure the “enable 1.x legacy bindings” and it works.
Thank you for your quick support
You may want to consider moving to the mqtt version 2 binding. You can use both versions and move devices one at a time. IMHO the V2 binding seems to work much better. If you like I can post some examples, although the forum has many, to help you get started.
I did some tests with the second version, and if I understood correctly is needed to create an new thing for each MQTT device.
This is correct?
Yes a new Thing for each device and then you can copy the channel link from PaperUI to use in the items file.
You can also migrate the Thing from text files using REST API. Here is a good guide, with pictures, on how to.
The first place to start is to install the REST API Docs. It’s under the Misc tab in PaperUI.
They are docs so using it should be pretty self explanatory. If not please ask and we can try to answer.
You will scroll down to the Things section, click it and it will open up with all the Things API calls.
The two circled end points are the ones you care about. Look at the text to the right, it tells you what the endpoint does.
First get the Thing. Click on that row and a form will open…