Mqtt what am I missing?

SetOption19 On reverses the order of prefix and topic so you need to reverse the order in the automations as well. If you don’t use discovery you don’t need them reversed. This is clearly documented in the tasmota HA Wiki.

Every screenshot I posted is straight from my working Tasmota and Home Assistant configuration.

With 6.4 firmware in Tasmota if you enable discovery, the topic and prefix are reversed so if you use discovery, you just reverse the same in your automation. To state it yet again, if you use discovery you do NOT have to configure ANYTHING in Home Assistant at ALL and you just match the topic/prefix order in your automations.

Yes stuff always changes and old videos can lead you astray. That is why you must always follow the docs!! The videos still help in some ways but the DOCS are what works right now.

David you are an extremely patient person, and your instructions are easy to follow, thank you.

at the moment one of my rules is something like “on power1#state do publish cmnd/MiriamSwitch/POWER %value% endon”

If I am understanding you correctly, i can change the rule to “on power1#state do publish MiriamSwitch/cmnd/POWER %value% endon”

The set everything to auto discovery, and take switch info out of my yaml file again, and it should work?

Yes I believe so. It just needs to match.

And one last question. The picture of the sonoffs mqtt parameters that you shared, that one wasn’t set to auto discover then right since the Full Topic is not backwards?

It is backwards. Normal is prefix/topic. Everything I shared is my current working config.

Ok I finally got it all working going the integration route! Thank you so much.

And I took a closer look, and you are right (like you have always been). On my tasmotos next to where it reads “Full Topic” in parenthesis it has prefix topic, but the value is now set to topic prefix… and that is not really important to me to find out why lol…

Again thank you everyone! Seems I will have all of 2nd 3rd and 4th of January to do the actual physical install, hopefully that will go smoother :slight_smile:

1 Like

This conversation helped me.
I found this while searching for why the MWTT “prefix/topic” became “topic/prefix”.
If others find this… the link to the short paragraph it’s described:

It’s not an explanation though… it was compatible but is now incompatible?? Why??

David, clearly written isn’t the same thing as clearly explained.

It’s really significant that discovery screws up the order of topic and prefix. It would make mixing non-discovered mqtt devices and discovered mqtt devices very confusing. Proof of that is the entire discussion. As soon as CancunManny turned off the auto-discovery things worked for him/her.

I have no idea why someone thought the current discovery behaviour of putting topic before the prefxix makes any sense. It goes against all standard best practices for MQTT organization.

On an autodiscovered device you never need to know the mqtt topics.

I am not seeing that from this thread. So far as I know he is using discovery.

Nor do I but they did and that’s the way it is and I assume they have a good reason.

If you use discovery you don’t need to care what the topic is anyway as Nick said.

The only reason you might need to know is if You use automations to set options… but if just using as a switch it’s not important at all.

Won’t those options be exposed as HA entities?

No.

Here’s one of my switches

here’s an automation that queeries the status when home assistant sta=rts (so switches show on or off correctly)

- id: '1532478833428'
  alias: Power State Sonoff on HA Start-Up
  trigger:
  - event: start
    platform: homeassistant
  action:
  - data:
      payload: ''
      topic: sonoffs/cmnd/state
    service: mqtt.publish
  initial_state: 'true'

So yeah for some automations you need to know the topic and prefix. (forget that this automation is to the sonoffs group. I have a setup one that does specific things to different devices as well)

(Note also that status sensor is only available with dev versions of 6.4.1.x that have hass state in them - before that I only saw the second sensor)

Yes, and it works GREAT! if all your devices are set to autodiscovered, but like dedd mentioned if you want to mix it can be a bit confusing, or at the very least if you have devices you can’t set in auto-discover you would have to switch them on the config.yaml file

I am still getting my feet wet, and I tend to agree with the other poster wondering why they decided to switch them around when using auto-discovery when there seems to have been a “standard practice” set already. My guess is they found a reason why it makes more sense to switch, who knows.

Deddc23efb, actually when I turned off auto-discovery that is when my troubles started. Why they switch the topic/subject (or what ever they are) I am not sure, but what makes the problem even worse is that when you turn auto-discovery on, it switches, but when you turn it off it doesn’t switch it back up. That is what ended up sending me in a loop.

Never had to do that.

Do what specifically? My sonoff switches will show off for 5 minutes after Home Assistant starts so I use an automation to update them without waiting for the tele message. Anyway, there is a reason to want to know the topic/state order…

When I restart HA my mqtt devces show up in the correct state. But they are not sonoffs, they are Ailights.

At least I think they do!