I’m running OpenHAB 2.5.10-1 on a RPi 3b+, MQTT binding 2.5.10.
I am trying to configure MQTT for a Fiet lightbulb. With the help of rpwong and others I have been able to reflash the bulb with Tasmota. I configured the bulb, installeed Mosquitto, and created broker and generic things. Everything appears to be online and working, but somehow the connection between the broker and the device gets lost. I have been reading forums and watching videos for the last several weeks and cannot get it working. I have included snapshots of my configuration. I’m hoping some can look at it and tell me where I’ve egone astray.
I’m not entirely sure what you mean by this. Can you be more specific? It’s hard to tell if the problem is with MQTT or with the Tasmota-flashed bulb. Does “online and working” mean that you can initially control the bulb in openHAB, but then that stops? If so, that suggests that your configuration is correct and it’s not an openHAB issue.
I can’t be of any help with PaperUI, because I do all of my Tasmota configuration in a things file. If you want to try that, here’s what it looks like with one of my devices:
In this definition, stateTopic is the topic that reports the bulb’s status, and commandTopic is the topic that you use to send commands from openHAB to the bulb. So you send a command, and it reports back the state.
After you do this, the thing should pop up in PaperUI and you’ll be able to see the channels that you’ve defined for it.
your topics and payload are wrong.
Have a look into Tasmota documentation.
E.g. Command should be something like “FietBulb01/cmnd/POWER” and payload should be “ON/OFF”. No need to enter these, as these are the default.
rpwong & James:
Everything went well with the Tasmota reflash and I can control the bulb in Tasmota.
As you can see from the screenshots, the broker and thing are online, but they don’t communicate with the bulb. I’m curious about the POWER parameter. I realize that rpwong is using an outlet as an example. Would POWER also be used for a light bulb? This is where all the documentation I have read and watched eludes me. there just doesn’t seem to be a solid step-by-step example of how some of these parameters inter-relate.
Just so you know, I’m not a technology neophite. I started out as a main frame programmer in 1984. I got my electronics training in the Navy. The last new language I learned was while programming a system in dBase III/IV. The last program I wrote was in BASIC over 20 years ago. I prefer being a Network Engineer.
I try your suggestions and let you know what happens.
In addition to the excellent suggestions by @denominator and @rpwong, just double check: do you have another device which is trying to connect to your MQTT broker with the same Client name? This won’t work, as Mosquitto (usually) kicks off the older connection in favour of the newer device.
@Joerg_Schreiner has a point here. You changed your Tasmota Topic to FietBulb01. But the default command topic to turn it on or off is normally:
However, that will only work for you if you put your FullTopic back to the default as shown above the field in the Tasmota MQTT Parameters page (%prefix%/%topic%). I would suggest you put that back to default so that most of the online guides you read make sense!
I tried to write a guide for setting up a simple Tasmota device. It’s based around a Sonoff Basic, but your bulb should work in exactly the same way. Like @rpwong I use configuration files instead of the UI:
But as @denominator says: forget about openHAB for now and use MQTT Explorer to make sure all the MQTT stuff is working. Once that’s done, come back to configure it in openHAB.
“do you have another device which is trying to connect to your MQTT broker with the same Client name?”
This is the first and only device that I’m using with MQTT. That’s why I’m having so much trouble with it.
“However, that will only work for you if you put your FullTopic back to the default as shown above the field in the Tasmota MQTT Parameters page (%prefix%/%topic%). I would suggest you put that back to default so that most of the online guides you read make sense!”
This is where my understanding falls apart. Would the (%prefix%/%topic%) be cmnd/FietBulb01/POWER? I know the topic is supposed to connect everything, but I’m not seeing the consistency.
“forget about openHAB for now and use MQTT Explorer to make sure all the MQTT stuff is working”
I run Fedora Linux as my desktop. I have MQTT-Explorer installed, but I haven’t figured out how to run it. this whole process has been rather frustrating. I’ll take a look at your web page.
“Use the Tasmota console to try out commands (just type POWER ON and POWER OFF into the Tasmota console and watch what happens)”
OK, there’s a few syntax and spelling errors in there.
I’m going to assume you’ve changed your FullTopic back to %prefix%/%topic%. Then the following Thing definition should work (POWER switch only - I’m not sure how the color stuff should be formatted, but let’s get the switch working first. I’ve also re-named the bridge to MosquittoMQTTBroker for readability):
You may hate me for this… trying to set things up like you suggested ion your web help page, I reconfigured my config files and swparated the bridge, thing and item files. I’ll make the corrections you suggested and re-post them for you as soon as I get home from work.
Silly idea, but I would assume I should delete what I did in PaperUI so as not to confuse the system? After all, it doesn’t work, anyway. I get a thing under “Control” that APPEARS to operate, but nothing happens when I move the controls. Currently, because of all the errors in my config files, I’m not showing anything in PaperUI.
I ran a test in the console of Tasmota as previously suggested. I entered POWER ON and POWER OFF and it worked perfectly, same as if I clicked on the toggle button. I also updated the full topic as hafniumzinc suggested. I’m hoping as I clean up my spelling and syntax errors things will start working.