MQTT Setup and Configuration

Speaking of the military, When I first got to my agency, one of the guys took me down to T-Comm to meet the guys down there. One of the guys used to be a Photographers Mate in the Navy. I used to be an Electronics Warfare Technician in the Navy. Well we got to talking and started throwing around a lot of the military terms. The guy who took me down there got lost in the language and decided leaving was the best option. I always get a kick out of that… :rofl:

Our configuration suggestion wasn’t ours - it’s the Tasmota default settings for Full Topic which you changed, and which are shown on the configuration page itself, just next to the relevant field.

No, it’s just how Tasmota is setup by default. This is all Tasmota specific. It’s not a global standard. And it’s all described on the Tasmota site: https://tasmota.github.io/docs/MQTT/

For commands: https://tasmota.github.io/docs/MQTT/#commands-over-mqtt

Examples featuring all three prefixes:

Information about Full Topic, warning about removing %prefix% (as you did), and short description about the three prefixes:

But see, that’s my point. Unless you happened to find the Tasmota specs, you wouldn’t know what the standards are. When I read through it, they still didn’t explain it very well. They could have said something like, “The Tasmota standards for Tasmota devices are as follows:…” Most of the other documentation states the topic is a freeform field. Even something like saying that different vendors have different standards in how they want the topic formatted would help.
Now that I know, I know where to look for information. Hopefully others will see this and not go through a similar frustration.

What do you mean with this? You decided to use Tasmota, so surely you looked on their website? No “happened to find” about it! The information which you stated you couldn’t find ANYWHERE is right there on the single MQTT documentation page of the software you used!

Why would the Tasmota documentation on the Tasmota website say that? The documentation is about Tasmota.

We need to be careful about the word ‘documentation’ here. I assume you mean the official documentation for Tasmota, MQTT and openHAB, which are the only authoritative resources. Everything else is just someone’s opinion, just like this post!

Anyway, your next device integration will be a doddle compared to this experience. Ultimately, the main problem here was that your Tasmota connection to the MQTT broker wasn’t properly setup.

Just be sure to give your next device a unique topic in the Tasmota MQTT configuration.

For this first device, you initially had a color channel which you presumably copied from somewhere - was that a guide for the same bulb?

I pulled the color configuration from the OpenHAB documentation. It’s not working. I’m looking at the Tasmota docs to see how to configure it. It’s a bit confusing because they don’t really give any examples. I looked at the console and got some ideas, so it’s a bit of trial and error.

Can you show us this? Ideally copy and paste from the console into code fences here, because reading and testing from a screenshot is a pain…!

Use the Tasmota device’s main page to change the colour, then flip to the console and copy/paste everything!

Oh, and don’t forget to watch MQTT Explorer too - hopefully this will confirm some of the MQTT specific stuff you’re seeing in the Tasmota console.

Here you go:

08:40:06 MQT: stat/FietBulb01/POWER = OFF
08:40:12 MQT: stat/FietBulb01/RESULT = {"POWER":"OFF"}
08:40:12 MQT: stat/FietBulb01/POWER = OFF
08:40:48 MQT: stat/FietBulb01/RESULT = {"POWER":"ON"}
08:40:48 MQT: stat/FietBulb01/POWER = ON
08:40:49 MQT: stat/FietBulb01/RESULT = {"POWER":"ON"}
08:40:49 MQT: stat/FietBulb01/POWER = ON
08:41:02 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":88,"Color":"000000E07C","HSBColor":"0,0,0","White":88,"CT":277,"Channel":[0,0,0,88,49]}
08:41:02 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":100,"Color":"000000FF8D","HSBColor":"0,0,0","White":100,"CT":277,"Channel":[0,0,0,100,55]}
08:41:05 MQT: tele/FietBulb01/STATE = {"Time":"2020-12-10T08:41:05","Uptime":"0T02:40:19","UptimeSec":9619,"Heap":30,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":56,"MqttCount":2,"POWER":"ON","Dimmer":100,"Color":"000000FF8D","HSBColor":"0,0,0","White":100,"CT":277,"Channel":[0,0,0,100,55],"Scheme":0,"Fade":"OFF","Speed":1,"LedTable":"OFF","Wifi":{"AP":1,"SSId":"Ben 2.4","BSSId":"88:EF:16:AF:DD:DF","Channel":11,"RSSI":70,"Signal":-65,"LinkCount":1,"Downtime":"0T00:00:08"}}
08:41:05 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":60,"Color":"0000009955","HSBColor":"0,0,0","White":60,"CT":277,"Channel":[0,0,0,60,33]}
08:41:11 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":60,"Color":"997A7A0000","HSBColor":"0,20,60","White":0,"CT":277,"Channel":[60,48,48,0,0]}
08:41:14 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":60,"Color":"9999990000","HSBColor":"0,0,60","White":0,"CT":277,"Channel":[60,60,60,0,0]}
08:41:18 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":62,"Color":"9E9E9E0000","HSBColor":"0,0,62","White":0,"CT":277,"Channel":[62,62,62,0,0]}
08:41:19 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":42,"Color":"6B6B6B0000","HSBColor":"0,0,42","White":0,"CT":277,"Channel":[42,42,42,0,0]}
08:41:22 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":54,"Color":"8A8A8A0000","HSBColor":"0,0,54","White":0,"CT":277,"Channel":[54,54,54,0,0]}
08:41:22 MQT: stat/FietBulb01/RESULT = {"POWER":"OFF"}
08:41:22 MQT: stat/FietBulb01/POWER = OFF
08:41:23 MQT: stat/FietBulb01/RESULT = {"POWER":"ON"}
08:41:23 MQT: stat/FietBulb01/POWER = ON
08:41:27 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":75,"Color":"BFBFBF0000","HSBColor":"0,0,75","White":0,"CT":277,"Channel":[75,75,75,0,0]}
08:41:29 MQT: stat/FietBulb01/RESULT = {"POWER":"OFF"}
08:41:29 MQT: stat/FietBulb01/POWER = OFF
08:41:29 MQT: stat/FietBulb01/RESULT = {"POWER":"ON"}
08:41:29 MQT: stat/FietBulb01/POWER = ON
08:41:31 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":100,"Color":"FFFFFF0000","HSBColor":"0,0,100","White":0,"CT":277,"Channel":[100,100,100,0,0]}
08:41:36 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":100,"Color":"000000DA25","HSBColor":"0,0,0","White":100,"CT":203,"Channel":[0,0,0,85,15]}
08:41:39 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":100,"Color":"000000C738","HSBColor":"0,0,0","White":100,"CT":229,"Channel":[0,0,0,78,22]}
08:41:42 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":77,"Color":"000000992B","HSBColor":"0,0,0","White":77,"CT":229,"Channel":[0,0,0,60,17]}
08:41:43 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":66,"Color":"0000008325","HSBColor":"0,0,0","White":66,"CT":229,"Channel":[0,0,0,51,15]}
08:41:47 MQT: stat/FietBulb01/RESULT = {"POWER":"ON","Dimmer":57,"Color":"0000007120","HSBColor":"0,0,0","White":57,"CT":229,"Channel":[0,0,0,44,13]}
08:46:05 MQT: tele/FietBulb01/STATE = {"Time":"2020-12-10T08:46:05","Uptime":"0T02:45:19","UptimeSec":9919,"Heap":30,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":99,"MqttCount":2,"POWER":"ON","Dimmer":57,"Color":"0000007120","HSBColor":"0,0,0","White":57,"CT":229,"Channel":[0,0,0,44,13],"Scheme":0,"Fade":"OFF","Speed":1,"LedTable":"OFF","Wifi":{"AP":1,"SSId":"Ben 2.4","BSSId":"88:EF:16:AF:DD:DF","Channel":11,"RSSI":74,"Signal":-63,"LinkCount":1,"Downtime":"0T00:00:08"}}

G that makes it easy to integrate try

Install JSONPATH and REGEX transformation

Thing

    Thing mqtt:topic:FietBulb01 "FietBulb01 Label" (mqtt:broker:mqtt)  {
	Channels:
	  Type switch : masterstandswitch "Master Stand" [ stateTopic="stat/FietBulb01/POWER", commandTopic="cmnd/FietBulb01/POWER", on="ON",	off="OFF"	]
      Type string : Version       [stateTopic="tele/FietBulb01/INFO1", transformationPattern="JSONPATH:$.Version"]
      Type number : RSSI          [stateTopic="tele/FietBulb01/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
      Type string : WifiDowntime  [stateTopic="tele/FietBulb01/STATE", transformationPattern="JSONPATH:$.Wifi.Downtime"]
      Type number : LoadAvg       [stateTopic="tele/FietBulb01/STATE", transformationPattern="JSONPATH:$.LoadAvg"]
      Type number : Uptime        [stateTopic="tele/FietBulb01/STATE", transformationPattern="JSONPATH:$.UptimeSec"]
      Type string : Result        [stateTopic="stat/FietBulb01/RESULT"]
      Type color  : colorHSB      [stateTopic="stat/FietBulb01/RESULT", commandTopic="cmnd/FietBulb01/HSBColor", transformationPattern="REGEX:(.*HSBColor.*)∩JSONPATH:$.HSBColor"]

}

Items example auto generated

Switch   FietBulb01LabelMasterstandswitch   "Master stand"   {channel="mqtt:topic:FietBulb01:masterstandswitch"}
String   FietBulb01LabelVersion                {channel="mqtt:topic:FietBulb01:Version"}
Number   FietBulb01LabelRSSI                   {channel="mqtt:topic:FietBulb01:RSSI"}
String   FietBulb01LabelWifiDowntime           {channel="mqtt:topic:FietBulb01:WifiDowntime"}
Number   FietBulb01LabelLoadAvg                {channel="mqtt:topic:FietBulb01:LoadAvg"}
Number   FietBulb01LabelUptime                 {channel="mqtt:topic:FietBulb01:Uptime"}
String   FietBulb01LabelResult                 {channel="mqtt:topic:FietBulb01:Result"}
Color    FietBulb01Color "Color "              {channel="mqtt:topic:FietBulb01:colorHSB"}

Sitemap

sitemap FietBulb label="FietBulb " {

Default item=FietBulb01LabelMasterstandswitch
Default item=FietBulb01Color

      
}

Hi James,

Sorry for the long delay. I entered in you configuration (some parameters changed to fit my setup) and it is working. Minor details poking at me, but I can control the color of the bulb. I’m assuming that a lot of the parameters such as RSSI, Downtime, etc., are for later troubleshooting/information?

Thanks again for all your help. I think I’m beginning to get a small idea of how MQTT works… :upside_down_face:

Thats excellent news

In my example I left out the dimmer for you to achieve on your own.

These can be used or ignored or used.

Now that you have the hang of it this all changes very soon when openHAB 3 is released you set it all up in the mainUI with yaml. However you can still use things files.

UID: mqtt:topic:RPI4:MYlight
label: My Light
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: Offline
  availabilityTopic: tele/MyLIGHT/LWT
  payloadAvailable: Online
bridgeUID: mqtt:broker:RPI4
channels:
  - id: POWER
    channelTypeUID: mqtt:switch
    label: Power Switch
    description: ""
    configuration:
      commandTopic: cmnd/MyLIGHT/POWER
      stateTopic: stat/MyLIGHT/POWER
      off: OFF
      on: ON
  - id: Uptime
    channelTypeUID: mqtt:string
    label: UP time
    description: ""
    configuration:
      stateTopic: tele/MyLIGHT/STATE
      transformationPattern: JSONPATH:$.Uptime
  - id: LoadAvg
    channelTypeUID: mqtt:string
    label: LoadAvg
    description: null
    configuration:
      stateTopic: tele/MyLIGHT/STATE
      transformationPattern: JSONPATH:$.LoadAvg
  - id: WIFI_Signal
    channelTypeUID: mqtt:string
    label: WIFI Signal
    description: null
    configuration:
      stateTopic: tele/MyLIGHT/STATE
      transformationPattern: JSONPATH:$.Wifi.Signal

I’m supposed to be REDUCING my stress levels… :grinning:

I have been playing with the dimmers, but they’re not quite doing what I want them to do. I’m not 100% sure of what some of the parameters/setting do.

Things:

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" ]
		Type string : 01Version	"Master Stand Version"		[stateTopic="tele/FietBulb01/INFO1", transformationPattern="JSONPATH:$.Version"]
		Type number : 01RSSI            "Master Stand RSSI"		[stateTopic="tele/FietBulb01/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
		Type string : 01WifiDowntime    "Master Stand WiFi Downtime"	[stateTopic="tele/FietBulb01/STATE", transformationPattern="JSONPATH:$.Wifi.Downtime"]
		Type number : 01LoadAvg         "Master Stand Load Avg"	[stateTopic="tele/FietBulb01/STATE", transformationPattern="JSONPATH:$.LoadAvg"]
		Type number : 01Uptime          "Master Stand Uptime"		[stateTopic="tele/FietBulb01/STATE", transformationPattern="JSONPATH:$.UptimeSec"]
		Type string : 01Result          "Master Stand Result"		[stateTopic="stat/FietBulb01/RESULT"]
		Type color  : 01Color		"Master Stand Color"		[stateTopic="stat/FietBulb01/RESULT", commandTopic="cmnd/FietBulb01/HSBColor", transformationPattern="REGEX:(.*HSBColor.*)∩JSONPATH:$.HSBColor"]
		Type dimmer  : 01CWDimmer	"Master Stand Cold White"	[stateTopic="stat/FietBulb01/RESULT", commandTopic="cmnd/FietBulb01/White", transformationPattern="REGEX:(.*White.*)∩JSONPATH:$.White"]
		Type dimmer  : 01WWDimmer	"Master Stand Warm White"	[stateTopic="stat/FietBulb01/RESULT", commandTopic="cmnd/FietBulb01/Color", transformationPattern="REGEX:(.*Color.*)∩JSONPATH:$.Color"]
}

Items:

Switch masterstandswitch "Master Stand" <lightbulb> (US_Master, Lights) ["Lighting"] { channel="mqtt:topic:FietBulb01:masterstandswitch" }
	String   01Version				{channel="mqtt:topic:FietBulb01:01Version"}
	Number   01RSSI				{channel="mqtt:topic:FietBulb01:01RSSI"}
	String   01Downtime				{channel="mqtt:topic:FietBulb01:01WifiDowntime"}
	Number   01LoadAvg				{channel="mqtt:topic:FietBulb01:01LoadAvg"}
	Number   01Uptime				{channel="mqtt:topic:FietBulb01:01Uptime"}
	String   01Result				{channel="mqtt:topic:FietBulb01:01Result"}
	Color    01Color "Master Stand Color"		{channel="mqtt:topic:FietBulb01:01Color"}
	Dimmer	 01CWDimmer "Master Stand Cold White" 	{channel="mqtt:topic:FietBulb01:01CWDimmer"}
	Dimmer	 01WWDimmer "Master Stand Warm White"	{channel="mqtt:topic:FietBulb01:01WWDimmer"}
	Dimmer	 01Dimmer   "Master Stand Dimmer"	{channel="mqtt:topic:FiedBulb01:01Dimmer"}

Sitemap:

				Frame label="Lights" {
					Switch item=Light_US_Master_Closet
					Switch item=masterstandswitch
					Switch item=masterdeskswitch
					Default item=01Color
					Slider item=01CWDimmer
					Slider item=01WWDimmer
					Slider item=01Dimmer
				}

My wife just bought some Fiet LED strips. I’m going to see about flashing them, because out of the box there isn’t much control.

I found out that the Fiet LED strips don’t have a Tasmota firmware, so that’s out. But the Fiet app isn’t too bad and it gives us a lot more control than the little remote that comes with it. It will have to do for now.

So looking at the tasmota color channel what commands is it expecting to control the device?

Color x = 1…6
1 = Set color
2 = Set color adjusted to current Dimmer value
3 = Set clock seconds hand color (Scheme 5 only)
4 = Set clock minutes hand color (Scheme 5 only)
5 = Set clock hour hand color (Scheme 5 only)
6 = Set clock hour marker color

r,g,b = set color by decimal value (0…255)
#CWWW = set hex color value for CT lights
#RRGGBB = set hex color value for RGB lights
#RRGGBBWW = set hex color value for RGBW lights
#RRGGBBCWWW = set hex color value for RGBCCT lights (5 PWM channels)
Note:
Just append an = instead of the remaining color codes, this way they wont get changed. For example a command like Color #00ff= would update the RGB part to disable red and enable geen, but would omit to update blue or any white channel.

so it need to be Color1 in you command topic

I just wanted to update you, I installed a fresh version of OH3 on a new SD card and am fighting with that, so my other projects are on hold for the time being. This new system is VERY different and it’s taking me awhile to figure it out.

Good

This might help you

So I highly recommend spending the time creating all your models with locations of every room first. The use that to create equipment from things.

Try the astro or weather binding to create a thing then rules.
The create all the MQTT stuff. When copy pasting YAML make sure you change it all the correct before hitting save as some thing will break if you try and change the id properties.

I prefer to use the config files. I’ve been rearranging things to better organize it. So far, everything seems to be working, except ZWave. I’m still fighting with it. There are so many things that got broken with the fresh install that I need to fix (just settings and parameters that need to be updated). At this point, I just need it to be functional, THEN I can play with it. I’m also doing a server for my daughter. Her setup is different because her place is so small. I’m trying to organize things by function (lights, security, etc.). Hopefully, this weekend I’ll have more time to concentrate on it.

Happy New Year, All!!! We made it out of 2020! YEA!!!

I don’t use Zwave.

Use the main UI to manage.

I guess I’m going to have to use the Main UI to manage the ZWave. I’ve been fighting with it for a couple of days and It doesn’t seem to like the .cfg files for ZWave. Everything else seems to be working correctly with .cfg files, though.

Update:
I’ve pretty much given up on using cfg files. There does seem to be some advantages to using the Main UI. ZWave seems to be working without issue.
I figured I would try to get the MQTT working next, as it seems to be the next hardest (yes, I am a masochist :-} ). I’ve got the on/off switch working, but I’m having a heck of a time with he dimmer. I’m not even playing with color, yet. I just want to get the basics working. Having the on/off working is good because I have my Master Desk lamp automated with timers in rules. I still have A LOT of figuring out to do.
I just thought I would give y’all an update, in case you were curious.

1 Like