[Solved] Noob help needed with first Sonoff (Tasmota 5.12) on HASS.io

Hi All, I am struggling to get my first sonoff basic with Tasmota 5.12 firmware up and running on my HASS.io
this is all new ground for me, I have read as much as I can but I am obviously missing something that I either just can’t see or don’t understand so any help will be much appreciated.

I can see the virtual switch on my homepage.

If I operate the virtual switch a pop up tells me it has been turned on, it stays on for a few seconds and then reverts back to off, however the sonoff switch does not get physically switched on

  port: 1883
  username: BRYN-W
  password: (removed)

   title: Configurator
   icon: mdi:wrench
# Enables configuration UI

     platform: mqtt
     name: "Outside Light"
     state_topic: "stat/sonoff/POWER"
     command_topic: "cmnd/sonoff/POWER"
     qos: 1
     payload_on: "ON"
     payload_off: "OFF"
     retain: true

This is my MQTT parameters set on the sonoff basic switch (IP

Screenshot of the console screen of my Sonoff (basic)

This is my mosquito config:

  "plain": true,
  "ssl": false,
  "anonymous": true,
  "logins": [
      "username": "BRYN-W",
      "password": "(pass removed)"
  "customize": {
    "active": false,
    "folder": "mosquitto"
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"

I can toggle the switch from the switch webpage, so no issues with wifi etc. I think my issue is something to do with my MQTT but I cannot see what the problem might be.

Can anyone help me out here?

Thanks guys.

Please remove your personal data from the post. Also, post you code as text using </> on the text box.

You have a typo in your state topic

namely ‘fsonoff’

Thanks guys, correcting that typo ('fsonoff") has not solved my issue

I assume you copy/pasted the yaml?
Replace the up/down double quotes with normal ones.

  - platform: mqtt
    name: "Sonoff"
    state_topic: "stat/sonoff/POWER"
    command_topic: "cmnd/sonoff/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

Try power in lower case in the command topic

Loads of your spacing is wrong, indents should always be in multiples of two but you’ve got loads of threes in there and even a one. I’m guessing Configurator doesn’t work either?

As you can see from @VDRainer’s post, you’re also missing the hyphen-space from before platform: too.

@VDRainer - thank you! that resolved my issue (I missed the up/down quote thing) I replaced my switch entry with your text and now everything works as it should much appreciated!

@Bobby_Nobble - Thank you! I knew config.yaml was picky with how things are laid out but was not aware indents needed to be in multiples of two and hopefully will not make that mistake again, Configurator appears to be working fine for me but I will make the adjustments to the indents for completeness and to ensure scything is correct.

Help was very much appreciated.

1 Like

original post edited to remove personal info and to correctly insert code into the post