MQTT for a single Tasmota Sonoff Mini

Hi. My 1st post here.
Using Raspberry 2b+, Openhabian, Sonoff Mini with Tasmota

Struggling to make MQTT connection.
When I send a command (even trough MQTT.FX) the blue led on the device blinks once, the app say it’s ON but the lamp doesn’t turn on.

My stuff:

                      MQTT.THINGS

Bridge mqtt:broker:mosquitto “Mosquitto” [ host=“192.168.2.112”, port=1883, secure=false, username=“openhabian”, password=“xxxx”, clientID=“Paulo” ]
Thing topic Sonoff_Mini “Luz_Sala” {
Channels:
Type switch : PowerSwitch “Luz Sala” [ stateTopic=“casa/Sonoff_Mini/stat”, transformationPattern=“JSONPATH:$.POWER” ,commandTopic=“casa/Sonoff_Mini/cmnd”,
POWER1=“ON”, POWER0=“OFF” ]
Type string : Version [stateTopic=“casa/Sonoff_Mini/stat/STATUS2”, transformationPattern=“JSONPATH:$.StatusFWR.Version”]
}

                               CASA.ITEMS

Switch luzsala_item “Luz Sala” { channel=“mqtt:topic:mosquitto:PowerSwitch:Sonoff_Mini” }

                              CASA.SITEMAP

sitemap casa label=“Menu Principal”
{
Switch item=luzsala_item label=“Luz Sala”

}

                           MQTT.CFG

mosquitto.url=tcp://192.168.2.112:1883
mosquitto.client=Paulo
mosquitto.user=openhabian
mosquitto.pwd=xxxx
mosquitto.qos=1
mosquitto.retain=true
mosquitto.async=true

                      MQTT-PERSISTENCE.CFG (nothing here)

Name of the broker as defined in mqtt.cfg

#broker=

The MQTT topic to which the persistence messages should be sent.

#topic=

A string representing the persistence message content.

#message=

Thanks for all the help. I hope I’m not posting in a wrong place here.

That’s nothing to do with any openHAB settings. Check what topics and commands your device is expecting. When you’ve got it working with mqtt.fx, look at openHAB.

Thanks.
MQTT.FX accepts casa/Sonoff_Mini/tele/LWT in subscribe.
anything I put after casa/Sonoff_Mini/cmnd/ in publish just make the led blink one time.

Yes. You need to look at your Sonoff to see what topics and commands your device is expecting.

MQTT Host 192.168.2.112
MQTT Port 1883
MQTT User Paulo
MQTT Client openhabian
MQTT Topic Sonoff_Mini
MQTT Group Topic 1 casa/tasmotas/cmnd/
MQTT Full Topic casa/Sonoff_Mini/cmnd/
MQTT Fallback Topic cmnd/openhabian_fb/

I can’t see where I’m wrong

Look at the console in tasmota when using the button to turn on the switch. What is the output?

15:30:08 MQT: casa/Sonoff_Mini/stat/RESULT = {“POWER”:“ON”}
15:30:08 MQT: casa/Sonoff_Mini/stat/POWER = ON

For the thing try using:

Type switch : power "Power" [ stateTopic="stat/sonoff55/POWER", commandTopic="cmnd/sonoff55/POWER" ]
Replaced with your info.

2020-07-02 11:39:08.975 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model ‘mqtt.things’, using it anyway:

Provide a thing UID in this format: bindingId : thingTypeId : thingId (with <> between the words)

2020-07-02 11:39:08.988 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘mqtt.things’

2020-07-02 11:39:09.024 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like :topic:Sonoff_Mini

2020-07-02 11:39:09.032 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like :topic:Sonoff_Mini

2020-07-02 11:39:09.042 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like :topic:Sonoff_Mini

Drop the Sonoff_Mini part of the item like below.

Switch luzsala_item "Luz Sala" { channel="mqtt:topic:mosquitto:PowerSwitch" }

Also note you are using funny quotes. Not sure if this is just b/c you typed in without using ``` before and after item, things, rules, etc… it’s called code fences.

No problems in the log now.

2020-07-02 11:48:56.950 [.ItemChannelLinkAddedEvent] - Link ‘luzsala_item-mqtt:topic:mosquitto:PowerSwitch’ has been added.

but still just a led blink when sending command

I typed the " because doesn’t show the regular <

that was from the log

Do you see anything in the tasmota console when you send the command? Does the status work in OH when turning the switch on/off?

from the console:

11:55:14 MQT: casa/Sonoff_Mini/stat/RESULT = {“Command”:“Unknown”}

Yes the status act as expected as the switch is on or off.

Also,if a send a command via HABpanel from the cell app the switch moves on the paper UI control and the led blinks

Still can’t make lamp turn on in MQTT.FX. Trying a lot of commands

Ok, remove casa from the full topic in tasmota configuration and see what happens.

EDIT:
Looking at the Client in tasmota config, change that from openhabian to Sonoff_Mini_C1978C. BTW, I’m just comparing my sonoff config to yours.

erased the casa from things and items

2020-07-02 12:01:13.406 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model ‘mqtt.things’, using it anyway:

Provide a thing UID in this format:

::

2020-07-02 12:01:13.417 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘mqtt.things’

2020-07-02 12:01:13.436 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like :topic:Sonoff_Mini

2020-07-02 12:01:13.443 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like :topic:Sonoff_Mini

2020-07-02 12:01:13.452 [WARN ] [.thing.internal.GenericThingProvider] - Thing topic does not have a bridge so it needs to be defined in full notation like :topic:Sonoff_Mini

See my edit above and I would also try removing the _ in Sonoff_Mini and use Sonoff1 or anything without the _ for testing.

Most recommend to use PaperUI for your Things and files for items to help prevent syntax errors. But need to get tasmota config working first.

Ok. Thank you very much.
I’ll do that.
I’ll be out for lunch now.
thank you again.

see u

Not sure if you have read this link but it may help with configuration of OH side.

Here is another link to tasmota docs that have tips to include not changing the Client part in the mqtt config. I would read thru and start with a simple/basic setup then after you have that working move to more advanced configuration if needed.
https://tasmota.github.io/docs/MQTT/#configure-mqtt-using-webui

Also not sure what you used to flash the sonoff with but here’s a tool you may be interested in.


I haven’t tried the tasmotizer myself but it looks to be a simple way to get up and running.

And a youtube video for tasmotizer.

Goodness, make that work first.
There is no point in messing up your openHAB settings at random until you know what it is you are trying to achieve. What command payloads are you sending, exactly? It is case sensitive.

That is pretty clear. It got your message. That means you got the topic correct, hurrah! But it didn’t understand the payload. ON, On, on ?

Finally I fix the issue.

Before flash the device one more time I just unchecked the MQTT enable on “Configure other” , restarted the device (it was sending the message “MqttCount”:99), and then I checked the MQTT enable again and restarted the device (the message on the console turned to “MqttCount”:1) and IT IS WORKING.

Thank you very much for your good will