[SOLVED] (MQTT)(Tasmota) Connection problem

Hello, i have problem with MQTT, i don’t know how set MQTT.

(Sonoff Basic/RPI)(Tasmota)

i can change sonoff status by using command:

mosquitto_pub -h localhost -t “cmnd/sonoff/kuchnia/POWER” -m OFF

But i dont know how do it with button in OpenHab 2.4

mqtt2

I recommend reviewing the Beginner’s Tutorial and the Concepts section of the docsto learn some basics on OH. Then look at https://www.openhab.org/addons/bindings/mqtt/ and https://www.openhab.org/addons/bindings/mqtt.generic/ and search the forum for MQTT 2.4 for lots of information on getting the MQTT to work with openHAB.

I saw this topics but i dont know what i must write in StateTopic and CommandTopic to turn on/off my sonoff

@kamyrdol32 after rereading your post,:stuck_out_tongue_winking_eye: I can see your using the 2.x mqtt version. Here’s an example I have that maybe you can use to help with your setup.

Things file

Bridge mqtt:broker:pibroker "pibroker" [ host="10.0.1.10", port=1883, secure=false, username="openhabian", password="my_secret" ]
{
    // Sonoffs
    Thing topic sonoff11 "Living Room Light" @ "Living Room" {
    Channels:
        Type switch : power       "Power"         [ stateTopic="stat/sonoff11/POWER", commandTopic="cmnd/sonoff11/POWER" ]
        Type number : temperature "Temperature"   [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Temperature" ]
        Type number : humidity    "Humidity"      [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Humidity" ]
    }
}

Items file

Switch LivingRoom_Light "Living Room Light" <light>  ["Lighting"] { channel="mqtt:topic:pibroker:sonoff11:power" }
Number LivingRoom_Light_Temp "Temperature [%.1f °F]"      <temp>             { channel="mqtt:topic:pibroker:sonoff11:temperature" }
Number LivingRoom_Light_Humidity    "Humidity [%.1f %%]"    <humidity>       { channel="mqtt:topic:pibroker:sonoff11:humidity" }

Sonoff

Hope you find this helpful.

It work! Thanks!