How to config sonoff to work on hassio

hello guys
I have sonoff touch US that have tasmota on it
I try to connect the sonoff to my mqtt switch that I have on my HA
the code is

  • platform: mqtt
    name: “bedroom3b”
    state_topic: “tamirhome/masterbadrom3b/SET”
    command_topic: “tamirhome/masterbadrom3b/SET”
    payload_on: “ON”
    payload_off: “OFF”
    optimistic: false
    qos: 1
    retain: true

what I need to enter on the tasmota page what is the topic and how I know that MQTT is working?
I enter my pi3 ip
I know that my mqtt is working because I run it on terminal and I see that topic and sub is working

you can see that my local mqtt is working

Sonoff is publishing on cmnd/sonoff/SET (did you change that? my Tasmota by default publishes on cmnd/sonoff/POWER), HA is sending commands on tamirhome/masterbadrom3b/SET. You must use the same topic.

I modified my code and sonoff

  • platform: mqtt
    name: “serviceroom3a”
    state_topic: “cmnd/sonoff/SET”
    command_topic: “cmnd/sonoff/SET”
    payload_on: “ON”
    payload_off: “OFF”
    optimistic: false
    qos: 1
    retain: true

it still don’t work

Try this way:

on Sonoff set Full Topic to %prefix%/%topic%/

on HA set

  - platform: mqtt
    name: "serviceroom3a"
    state_topic: "stat/sonoff/POWER"
    command_topic: "cmnd/sonoff/POWER"
    availability_topic: "tele/sonoff/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

If it still doesn’t work check on Mosquitto what’s the topic where Sonoff publishes the status when you push the physical switch and the topic where HA publishes the commands when you press the virtual switch.

1 Like

I will try that and update you

@namadori thanks my friend it work I remove the extra line you give me and it work

I remove this 3 line of code you give me and it working

availability_topic: "tele/sonoff/LWT"
payload_available: "Online"
payload_not_available: "Offline"

the full code is

  • platform: mqtt
    name: “serviceroom3a”
    state_topic: “stat/sonoff/POWER”
    command_topic: “cmnd/sonoff/POWER”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

thanks for your help