MQTT Setup and Configuration

My only problem with MQTTE is that I can’t get it to run. I installed it through Snap, but it doesn’t come up in my software list, and I can’t find the cli command to run it. Sometimes Linux can be a little frustrating that way…

I guess you could unplug one an see if it goes offline after 30 sec

1 Like

I got home and go to work on this. Here’s where I’m at:

I removed the thing and items that I created in PaperUI. I also removed the MQTT Broker (the one with openhab in the definition). It came back.
I’m showing 2 brokers:

Here is my bridges.thing:

Bridge mqtt:broker:mqtt "Mosquitto MQTT Broker" [
	host="10.5.0.10",
	secure=false,
	port=1883,
	clientID="MQTT",
	username="",
	password=""
]

mqtt.things:

Thing topic FietBulb01 {
	Channels:
		Type switch : masterstandswitch "Master Stand" [ 
			stateTopic="stat/FietBulb01/RESULT",
			commandTopic="cmnd/FietBulb01/POWER", 
			on="ON",
			off="OFF"          
		]
}

mqtt.items:

Switch masterstandswitch "Master Stand"  { channel="mqtt:topic:mqtt:FietBulb01:masterstandswitch" }

home.sitemap:

Switch item=masterstandswitch

As you can see, the thing is not showing up in PaperUI. Also, if I go into Control, the thing doesn’t show up there, either. What did I goof up this time.

Progress…

It appears that the broker, thing, and item are finally being driven by the config files. The thing finally shows up in the Control section. Unfortunately, there is still no control of the device. when I select the switch (on or off), it doesn’t turn it on or off. but… I feel we are getting closer…it’s encouraging…
Here are my files:

bridge.things:

Bridge zwave:serial_zstick:e6448360 "ZWave Controller" [ port="/dev/ttyACM0", controller_softreset="false", controller_master="true", heal_enable="true", security_networkkey="D6 55 05 A3 71 2B 90 60 A1 3F 81 D7 4E 67 6D 5A" ]

Bridge mqtt:broker:mqtt "Mosquitto MQTT Broker" [
	host="10.5.0.10",
	secure=false,
	port=1883,
	clientID="MQTT",
	username="",
	password=""
]

mqtt.things:

Thing mqtt:topic:FietBulb01 (mqtt:broker:mqtt){
	Channels:
		Type switch : masterstandswitch "Master Stand" [ 
			stateTopic="stat/FietBulb01/RESULT",
			commandTopic="cmnd/FietBulb01/POWER", 
			on="ON",
			off="OFF"          
		]
}

mqtt.items:

Switch masterstandswitch "Master Stand"  { channel="mqtt:topic:mqtt:FietBulb01:masterstandswitch" }

home.sitemap:

Switch item=masterstandswitch

Please let me know if you need anything else…

Switch Masterstandswitch "Master stand" {channel="mqtt:topic:FietBulb01:masterstandswitch"}

My new item:

Switch masterstandswitch "Master Stand"  { channel="mqtt:topic:FietBulb01:masterstandswitch" }

Result:
Still not activating device.

I finally got MQTTE running, but it doesn’t want to connect to server:

Thanks

If you still have two brokers active on your PC then I’m not surprised - you can only have one active at a time, because they’ll try to use the same port.

Did you install the embedded openHAB broker? If so, get rid of it completely, and only use Mosquitto.

No, I didn’t install the embedded broker as it was recommended against, at least not that I’m aware, and definitely not intentionally… I disabled the one broker and it still didn’t work.
I did get MQTTE running:

Didn’t really get a chance to look at it as I had to go to work.

Thanks

1 Like

OK, So I removed the MQTT binding and deleted the Generic MQTT thing. I rebooted the system and they were gone from the PaperUI. I re-added the MQTT binding through the addon.cfg file and both MQTT Broker things came back. I just can’t figure out how to get rid of the one MQTT Broker thing. If, by chance, I accidentally installed the embedded broker, how do I get rid of it?

Thanks,

Are you looking under “Misc” in the PaperUI Add-ons? That’s where you’ll find the embedded broker. It’s called Moquette.

image

Since you’ve now configured your Mosquitto broker in a .thing file, you should ignore the one that pops into the PaperUI inbox. That’s PaperUI trying to help you out with auto-discovery, but you’ve already set up your broker via a config file. In the end, you want one of these:

image

I said earlier that I don’t use PaperUI, but I wasn’t quite correct. I used the broker thing that was auto-discovered by PaperUI, and then I defined each Tasmota device in my config file. That’s why my example early in this thread didn’t have a broker in the config file.

Hi Russ,

I looked in the Add-ons:

So the embedded broker is not installed. The MQTT binding is installed:

This is what keeps popping up in my Things list:

I tried working with MQTT Explorer, but this is all I get once I designate the server:

I must be missing something, but I just can’t see it.

Thanks

Yay you are 99.9% there

In your mqtt window delete the FietBulb01 topic. (its a retained message from old settings)

Then do this
image

Publish and your light should come on

Can you check this works first.

You can also use tasmota to switch and see the state in MQTTE

I did what you said and this is what I got:

The light didn’t turn on.

1 Like

Can you turn the bulb on and off using the tasmota webpage and then see what happens in MQTT

Here it is… (I have no clue what I’m looking for)…

I need to get some sleep for work tomorrow…

You’re bulb is not connecting to MQTT dose your console show an error like

You may need to change your settings to

then check the console and you should see

Then stuff should show up in MQTTE and you should be able to see fancy things

Once you get this working then look at openHAB

Thing mqtt:topic:FietBulb01 "FietBulb01" (mqtt:broker:mqtt){
	Channels:
		Type switch : masterstandswitch "Master Stand" [ 
			stateTopic="stat/FietBulb01/POWER",
			commandTopic="cmnd/FietBulb01/POWER", 
			on="ON",
			off="OFF"          
		]
		Type string : result "json String" [ stateTopic="stat/FietBulb01/RESULT"]

}

Then create the item, this is how I do it to save spelling mistakes and syntax error

Create Items from channels

I didn’t read the whole post, but in a former screenshot I saw your channel-configuration. I think you should change it.
If you have the standard-tasmota settings in your Switch the channel topics should look like here:

Settings in tasmota:

Hope this can help.

1 Like

I saw the errors mentioned:

I made the following changes to the Tasmota:

And got the following results:

Openhab can now control the bulb.

My config files are as follows:

bridge.things:

Bridge mqtt:broker:mqtt "Mosquitto MQTT Broker" [
	host="10.5.0.10",
	secure=false,
	port=1883,
	clientID="MQTT",
	username="",
	password=""
]

mqtt.things: (I changed both topics to POWER, instead of the state topic being RESULT)

Thing mqtt:topic:FietBulb01 (mqtt:broker:mqtt){
	Channels:
		Type switch : masterstandswitch "Master Stand" [ 
			stateTopic="stat/FietBulb01/POWER",
			commandTopic="cmnd/FietBulb01/POWER", 
			on="ON",
			off="OFF"          
		]
}

mqtt.items:

Switch masterstandswitch "Master Stand" { channel="mqtt:topic:FietBulb01:masterstandswitch" }

I’m still trying to make sense of MQTTE, but more seems to be available on that as well (or at least different).

Now, to see if I can do this a second time with my other bulb. I’ve been holding off until I got the first one working. I will keep you all apprised.

Thank you, again, everybody!!! The level of frustration being removed from my shoulders is an immense relief!

Off to work…

2 Likes

Now I guess I can tell you to read the manual :rofl:

Here are some

James and everybody,

Actually, I did. I read everything I could find. For some reason, it just wasn’t clicking with me. When anyone mentioned using config files, they were usually working with the v1 MQTT binding. I tried using the PaperUI as they suggested (figuring I could switch over to config files later), but still couldn’t get it to work. I think the biggest issue I has was with the topic. As you could tell, my topic was way off. You guys came up with a topic configuration/structure I wouldn’t have gotten in a million years. Believe me, I spent weeks reading documentation, reading forums, and watching videos. All it did was frustrate the snot out of me. At some point, I think I just went brain-dead and tuned it all out. I’ll read through what you gave me. Hopefully it will clear some things up.
Once I flash my other bulb and get it working (I only really care about turning it on and off), I can play with the color settings on my test bulb (this one). I’ll let you all know how it goes.
After that, I need to get my ZWave controller working. It keeps going on/offline. It was all working fine until the OS changed. I’m still trying to research that one. Once I get that stabilized, I can get some more light switches to replace my old X-10 stuff that has been really unreliable lately.
At any rate, I want to thank everyone for all your help. It’s been invaluable to me. It’s difficult for me to relate the gratitude I have. THANK YOU!!!