Unable to Discover Sonoff-Tasmota Device via MQTT

Hi

I’m unable to find a sonoff tsamota device that I flashed with tuya convert with MQTT discovery.

Running:

  • HassOS: 2.12
  • Home Assistant: 0.93.2

Addons:

  • Duck DNS: 1.6
  • Mosquitto broker: 4.2
  • SAMBA share: 8.1

Mosquito addon page settings using Access Control Lists (addons/mosquitto/README.md at master · home-assistant/addons · GitHub):

{
  "logins": [],
  "anonymous": false,
  "quiet_logs": false,
  "customize": {
    "active": true,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

Where accesscontrollist file (in SAMBA share directory with mosquito folder) contains:

user umqtt
topic readwrite #
user homeassistant
topic readwrite

The MQTT integration is configured with discovery mode on and there is no mqtt configuration in configuration.yaml file.

The Tasmota-Sonoff device is:

  • a generice module (18) configured and working with energy monitoring
  • using release sonoff.bin (not sonoff-basic.bin or sonoff-classic.bin)
  • Program version: 6.5.0
  • Core: 2.3.0
  • SDK: 1.5.3
  • Has ’ SetOption19 on

Sonoff MQTT Parameters using a managed user from home assistant :

The device connects to the broker but I cannot see it discovered in the integrations page.

1558909234: |-- mosquitto_auth_unpwd_check(umqtt)
1558909234: |-- ** checking backend http
1558909234: |-- url=http://127.0.0.1:8080/login
1558909234: |-- data=username=umqtt&password=umqtt&topic=&acc=-1&clientid=
[INFO] found umqtt on Home Assistant
1558909236: New client connected from 192.168.1.116 as DVES_612E68 (c1, k10, u'umqtt').
1558909236: |-- getuser(umqtt) AUTHENTICATED=1 by http

Any help would be appreciated in getting the device connected to HA.

If you just added the integration, you need to restart home assistant.
Also action setoption19 On again.
Do you see in dev tools under <> if you type in switch.sonoff… is it listed? Do you only have one sonoff device?

I restarted home assistant and setoption19 on again. No devices show up in the integrations page nor in the dev <> page.

Yes, I only have one sonoff device for now.

I tried testing MQTT by subscribing to a random topic using mosquitto_sub in debug mode & mosquitto_pub (debug mode) to publish to that topic. Mosquitto_pub publishes the message with no issues but mosquitto_sub never received the message.

Would this be a cause as to why the devices are not being discovered?

Thanks.

if you can’t send a direct mqtt message from ha to topic cmnd/sonoff/power with payload “toggle” and see the power toggle in the tasmota console means not everything is connected to your mqtt broker or the acl settings are not correct

There is something wrong with ACL.

With active set to true, I am not able to send an mqtt message to the device.

“customize”: {
“active”: true,
“folder”: “mosquitto”
},

If I set active to false and restart the addon, I am able to toggle the device on and off and it pops up in the mqtt integrations page.
image

I thought it was recommended to enable ACL?

My ACL file contains the below where the mqtt user has read write access to all topics.

user umqtt
topic readwrite #
user homeassistant
topic readwrite #

So, I changed the accesscontrollist to

user umqtt
topic #
user homeassistant
topic #

and set the active status to true again and restart (addon/homeassistant).

Now I am able to toggle the device on and off via mqtt and the device is discovered? This is very confusing. But it’s now working.

I will try with another device and see if it works.

Thanks for your help!

Yeah it’s a bit crazy and inconsistent for some reason. Once it sees it you’ll find it’s rock solid though fortunately.

I know this is a very old topic but it’s the one that appears high in google. So might be of some use to others that are struggling to get their devices discovered.

I have just spent hours trying to get my tasmota plug to be discovered by home assistant.

Turns out I had the “lite” version of the firmware installed, upgraded to the full version (not lite) and the plug was instantly discovered.

Piling on for anyone who finds this via a google search - if you click Information in the Tasmota main menu you can see the version, and if it says (lite) you should do a firmware update. Thanks to Sleeps’ comment, I was able to get my devices discovered.

1 Like

It’s posted at the top of the page in Tasmota’s documentation for integration with Home Assistant.

Home Assistant support is not built in to tasmota-lite.bin. Use the standard tasmota.bin or other binaries that include Home Assistant support.

There’s important additional information on that page explaining that the preferred way now is to use Tasmota’s method of auto-discovery and not Home Assistant’s method, namely MQTT Discovery (in fact, the Tasmota project will eventually drop support for Home Assistant’s MQTT Discovery).

1 Like

Yes, I am aware of that but OTA upgrade failed and left with the lite version… So it was more of a prod to check what version you have installed.

That’s happened to me as well and it stated it prominently after the failed upgrade, so it was easy to confirm the installed version wasn’t the full one. Of course, none of that matters if one hasn’t read Tasmota’s warning that the Lite version doesn’t include support for Home Assistant. Without that knowledge, one might just try (and fail) to get it working with Home Assistant.

What do you mean by Home Assistant not supported in Tasmota Lite version? I can see that the discovery configuration message is issued by Tasmota Lite and the device appears in Home Assistant with MQTT integration.

Thanks for pointing out this. I always tried to avoid “official” Tasmota integration into HA, for it was too excessive and used auto discovery feature instead. Now it seems to be deprecated and Tasmota integration (not included into Lite) will be the only option. Pity, but that was expected. I already has stripped down all (unstable) Tasmota features to its Lite version adding all needed support as a custom code like this. Fortunately, Tasmota is still very useful and handy solution to many problems.