MQTT autodiscovery not working (Tasmota)

Hi all,

Apologies for the noob question but I just can’t seem to find an exact answer to this problem (although there are threads related to this)

I’ve got 2 Sonoff Mini R2’s flashed with Tasmota and connected to my mqtt broker but neither the MQTT integration nor the Tasmota integration is picking up any entities.

Using MQTT explorer I can 100% see topics being published from the devices, but the one item I don’t see is any discovery topic being posted. Could this possibly be why neither integrations pick up the devices and if so, what could be preventing the device to send publish discovery.

  • I have done SetOption19 0 and 1 multiple times with no effect.

Is there a way to then manually add entities?

Can I suggest a walk-though of all MQTT settings as a check?:

Most issues where autodiscovery isn’t working come from not instatlling the additional HASS Tasmota integration to get the replacement Tasmota discovery SetOption19 0 working.

The result should be immediate - publish topics, HASS creates entities (something which is useful when creating your own custom MQTT devices).

Some folk found really old verions of Tasmota don’t work as Tasmota Discovery was added in about v9.3. That’s less likely as you did install the latest version, didn’t you? :wink:

If things still don’t work, use the GitHub protocol desctiption link above to check topics in MQTT Explorer, and post the result (in code braces!) here.

There are two options with Tasmota on HASS, and neither involve manual YAML:

  • Use an old Tasmota version with HASS Discovery (which has been removed from Tasmota), and accept poor support in HASS for sensor units and long term statistics.

    • Connect to your Tasmota device via the web interface, select Console
    • Enter setoption19 1
    • You should see MQT: stat/<device-name>/RESULT = {"SetOption19":"ON"}
    • HASS should discover via the MQTT Integration (not as good as the Tasmota Integration).
  • Use a recent Tasmota > v9.3, and check setoption19 0 is set for Tasmota Discovery (which adds better support and useful features like sensor units for long-term HASS statistics).

    • After check setoption19 0 is set.
    • Using https://mqtt-explorer.com/ you should see tasmota\discovery\HEXDEVICEID\config\{ json kvp of the device parameters }

The only reason to use YAML with Tasmota is for advanced additional sensors or device support where the in-built discuvery might not pick up all the entities, and even then, the main device should still appear immediately.

If this helps, :heart: this post!

2 Likes

So it must’ve been an old version. I actually followed a video that used a script and it worked hence why I didn’t go looking further into it.

Stumbled upon another video about 10min ago of someone needing to upgrade the firmware. On version 12.5.0 now and Tasmota integration has picked it up.

For interest sake this is the video I found: sonoff r2 mini with tasmota and home assistant overcoming some gotchas. - YouTube

Thanks for your response anyways. You were definitely spot on with querying the version :slight_smile:

1 Like

Nice work, @FloatingBoater

Somewhat related question.

I have old Tasmotas, most of them running 8.3.1. They are discovered by MQTT intregration (with SetOption19 set), and are not visible in Tasmota Integration, which I have added later (They can be seen in the Tasmota integration webUI, though, which is another thing). In Tasmota integration there is only one device so far, and it was nicely discovered by the integration.

Is there a good way to switch these old MQTT -disovered Tasmotas to the new Tasmota integration? Firstly, if v9.3 is required, they need to be upgraded first, but what after that?

As we all know, there is this change from 8/2023:

("MQTT entity name starts with the device name in your config... this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'status'"),

…which I need to get rid of. This has, as far as I understand, been solved in later firmware versions, which is the reason I probably need to upgrade anyway. Even though it could a bit onerous, since the upgrade path from current version to the latest is somewhat complicated. Would like to move on to this Tasmota inegration in the same process.

OK, I managed to sort it out.

  • Upgraded old Tasmotas to the latest version respecting the presented Upgrade Flow as described in Upgrading - Tasmota
  • The upgraded devices were detected by Tasmota integration
  • Checked and altered, if needed the entity names to keep my namespaces consistent and cards, automations etc. working
  • Deleted the devices from under MQTT integration

I did not alter the SetOption19 -settings, whatever they might have been after the upgrade. There are now upgraded units where I have set that when initially joining to my system, and one that I have not touched in that sense. All of them seem to be working OK. The device name prefix -problem was also corrected.

Hi,
I can tell you why that worked without setting setoption19 0 - the older support for HASS discovery was removed in the jump:

Release notes for v9.4.0 include:

  • Tasmota discovery as alternative to Home Assistant discovery using define USE_TASMOTA_DISCOVERY

Release notes for v12.0.2 include:

  • Prepare to remove dedicated Home Assistant discovery in favour of Tasmota Discovery and hatasmota

So upgrading from pre v9.4 to post v12 jumped from HASS MQTT Discovery only to Tasmota Discovery only Tasmota releases.

Tasmota discovery works a whole lot better with HASS with HASS discovery, not least as units are supported for long-term statistics. Just set Device Name (hardware device or blank) differently than Friendly Name (thing controlled). The reasons why are documented here.

If this helps, :heart: this post!

1 Like

Hi,

Yes, I noticed that only the last jump from 9.1 to current 13.3.0 did the trick :slightly_smiling_face: