NEWBIE MQTT Config Help Needed

Typo, sorry.
TVLigths1 with s!

Typo, sorry.
TVLigths1 with s!

WowI I actually know something :sweat_smile:

This is the output from MQTTfx after the change, but still no response on the sonoff WebUI.

I am doing all of this via VPN so I’m not sure if the physical device is responding at home, but with no change in the WebUI I’m inclined to think there’s no response at home.

The same thing happens in MQTTfx when I use the Sonoff WebUI to toggle the switch.

The output on MQTTFx is the same when switching via the sonoff WebUI and via PaperUI? Are you sure on that? Check the message times! You migth need to subscribe to all messages ("#").
If the messages from both were the same, we would have a solution. But since the switch doesn’t react…

The MQTT settings on my Sonoff shows for Full Topic just the default entries.
My commandTopic is: commandTopic=“cmnd/sonoff_6/POWER”
so I just use the Topic (sonoff_6) to specify my Sonoff.

The output on MQTTFx is the same when switching via the sonoff WebUI and via PaperUI? Are you sure on that? Check the message times! You migth need to subscribe to all messages ("#").
If the messages from both were the same, we would have a solution. But since the switch doesn’t react…

The messages are the same. This first screenshot is after I used PaperUI and toggled the switch twice (ON and OFF)

This second screenshot is after disconnecting and reconnecting to the MQTT broker and then using the Sonoff WebUI and toggling the switch once (ON)

When I subscribe to all messages (#) and unsubscribe from “Lights/TVLights/POWER” and toggle via the Paper UI I get this response:

And finally, same process again, but via the Sonoff WebUI:

I would assume that the switch would toggle if the messages are the same. I am Lost!

I will verify when I get back home, but I would assume that the webUI would respond if MQTT was working properly. I just made a few changes to the .items file and .things file in an attempt to hopefully clean it up a bit:

.items file

.things file

I’ve essentially changed the name of the item throughout the .items file and .things file to the same topic of the sonoff: TVLights1
Would those changes affect anything negatively or can I leave them as such?

As you wish, in the string channel it isn’t seg correctly!
I would also say if the webUI doesn’t show a reaction, it isn’t working.

Let me think a bit. Sorry

As you wish, in the string channel it isn’t seg correctly!

This is true! Thanks for pointing it out.
I made the change for things to be more consistent, as I expect these files can get quite complexed as I add more to the system.

Let me think a bit. Sorry

I appreciate the time and effort thus far! I’ve gotten a lot further along in understanding these concepts with your help.

We need to find the command send by MQTTfx that toggles the switch.I would have assumed either one of those : cmnd/Lights/TVLights1/POWER or cmnd/TVLights1/POWER both with ON or OFF as data.

We need to find the command send by MQTTfx that toggles the switch.I would have assumed either one of those : cmnd/Lights/TVLights1/POWER or cmnd/TVLights1/POWER both with ON or OFF as data.

Might this be what you’re referring to? I see this Lights/TVLights1/RESULT line before the Lights/TVLights1/POWER line in the MQTTfx interface.

As I think about it…the Sonoff is configured to trigger the relay when the button is pressed, therefore it’s a two step process on the Sonoff itself. I’m wondering if we’re inadvertently skipping that button press step and simply trying to trigger the relay and this is why we are not successful.

Could you check the SonoffWebUI Information page a post the MQTT FullTopic?

Could you check the SonoffWebUI Information page a post the MQTT FullTopic?

In this case use “Lights/TVLights1/cmnd/POWER” as commandTopic.

In this case use “Lights/TVLights1/cmnd/POWER” as commandTopic.

It works! Thanks a lot!
Now to figure out the stateTopic

I can only guess:

“Lights/TVLights1/stst/STATUS2"

Getting this error in the log:
==> /var/log/openhab2/openhab.log <==

2019-02-05 17:10:09.564 [ERROR] [ofiles.JSonPathTransformationProfile] - Parameter ‘function’ and ‘sourceFormat’ have to be Strings. Profile will be inactive.

2019-02-05 17:10:09.569 [WARN ] [ofiles.JSonPathTransformationProfile] - Please specify a function and a source format for this Profile in the ‘function’ and ‘sourceFormat’ parameters. Returning the original state now.

I assumed that you had a typo in your instruction above and it was supposed to be
“Lights/TVLights1/stat/STATUS2”, and I was supposed to make that change on both the
Type : switch and Type : string lines?

I’m guessing the error is because I don’t have any String defined in my items file?

Goood Morning.
Sorry for this additional typo (typing on a smartphone while watching soccer is error prone).
The last posted stateTopic was only for the string, for the switch it should be:

“Lights/TVLights1/stat/STATE"

But that doesn’t solve the error. Could you subscibe to both state topics above on your MQTTFx and post what you are getting (after the Switch got toggeled ).

Could you subscibe to both state topics above on your MQTTFx and post what you are getting (after the Switch got toggeled ).

I get no response. Interestingly enough, I tried the functioning command topic:

"Lights/TVLights1/cmnd/POWER"

and still get no response in MQTTfx.

This is the output including the "Lights/TVLights1/#" as reference:

Toggling the switch 4 (on/off twice) times yields the above.

I also get this output from the sonoff after some time has elapsed:

Subscribing to the commandTopic will give no Response, as Tasmota is reacting on that command but is sending differntly ones.

It Looks like the stateTopic for the Switch should be
Lights/TVLights1/STATE
with the tranformationPattern.
"JSONPATH:$.Power"

Keeping fingers crossed, but I’m busy otherwise today!