Sonoff Tasmota will not connect MQTT

Dear community New to HA tried for several days to configue my Sonoff to work without luck, read the webpages and Drzzs stuff, tried to reinstall from scratch no joy! Can you please help point me in the right direction?

IP HA: 192.168.1.207
IP Sonoff: 192.168.1.20

Sonoff running Tasmota FW 6.5

Here is the configuration.yaml with broker is setup.

mqtt:
broker: 192.168.1.207
port: 1883
username: SAAS
password: A7SAD
discovery: true

switch:
platform: mqtt
name: “Sonoff Switch 01”
command_topic: “cmnd/sonoff/POWER”
state_topic: “stat/sonoff/POWER”
qos: 1
payload_on: “ON”
payload_off: “OFF”
retain: true

oad 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v60000608
~ld

Sonoff console from termite;
00:00:00 Project sonoff Sonoff Version 6.5.0(release-sonoff)-2_3_0
00:00:00 WIF: Connecting to AP1 BTHub5-5G78 in mode 11N as sonoff-6050…
00:00:03 WIF: Connected
00:00:03 HTP: Web server active on sonoff-6050 with IP address 192.168.1.20
00:00:04 MQT: Attempting connection…
00:00:11 MQT: Connect failed to 192.168.1.207:1883, rc -2. Retry in 10 sec
00:00:22 MQT: Attempting connection…
00:00:28 MQT: Connect failed to 192.168.1.207:1883, rc -2. Retry in 10 sec
00:00:39 MQT: Attempting connection…

Mosquito Log;
1554329853: New client connected from 172.30.32.1 as f7d2c955-7f91-4354-97fb-46453ffc7758 (c1, k60, u’homeassistant’). 1554329856: |-- mosquitto_auth_acl_check(…, client id not available, homeassistant, stat/sonoff/POWER, MOSQ_ACL_WRITE) 1554329856: |-- Expired [596385BB0F90F7983F2FE24FC4C77BA2AF76F935] for (client id not available,homeassistant,4) 1554329856: |-- url=http://127.0.0.1:8080/superuser 1554329856: |-- data=username=homeassistant&password=&topic=&acc=-1&clientid= 1554329856: |-- aclcheck(homeassistant, stat/sonoff/POWER, 4) SUPERUSER=Y by http 1554329856: |-- Cached [596385BB0F90F7983F2FE24FC4C77BA2AF76F935] for (client id not available,homeassistant,4) 1554330357: Saving in-memory database to /data/mosquitto.db.

Any advise greatly appreciated…thanks

how did you install the mqtt broker? Hassio or some other way?

I think you should correct “Client”. It looks like an invalid value for client ID. Just try to use DVES_F6D7A2 instead.

It might be really stupid, and someone mentioned before that I was like one of those few people that actually have luck with it.

I run Tasmota 6.5 with core 2.4.2 instead of the 2.3.0 libraries that are included in the standard install. Funny enough 2.3.0 would connect to my mqtt broker and disconnect (as well as wifi dropouts like crazy) but nothing would actually happen, or with a massive delay. I flashed them again with the same firmware but then with the 2.4.2 libraries and they have never been as stable for me since.

It might be something completely different though. I see you use a username/pass for your mqtt broker. I use mosquitto on windows and have no password so I can’t tell you something about it. However what kiempv said doesn’t seem likely to me, as the DVES_%06X clientID is what is standard when you just flash your sonoffs. (And I have never changed them before).

1 Like

@jimz011 at Mosquito logs, “client id not available” is printed out. So it seems that Client ID is not valid.

As mentioned in some of the other comments, don’t change the Client ID in the TASMOTA settings.

Make sure you have an additional user configured in HA and use that username and password in the TASMOTA MQTT configuration.

Enter the command setoption19 1 into the TASMOTA console for the device and this will activate auto discovery then it should show up in your integrations tab in HA.

My logs always show “client ID not available” but everything still seems to work fine.

1 Like

Thank you for the prompt suggestions I will reply to all in one place.

Installed Mosquito via HA, did not have the additional user with mqtt username/pwd configured now added.

At the sonoff setoption19 On still can see MQTT but no device shown under integration.

MQTT Config

{
  "logins": [
    {
      "username": "SAAS",
      "password": "A7SAD"
    }
  ],
  "anonymous": true,
  "customize": {
    "active": true,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

MQTT log

1554363388: New client connected from 172.30.32.1 as a0b2ab90-107c-40f8-ad7a-b9d2eabc6206 (c1, k60, u'homeassistant'). 1554363392: |-- mosquitto_auth_acl_check(..., client id not available, homeassistant, stat/sonoff/POWER, MOSQ_ACL_WRITE) 1554363392: |-- Expired [596385BB0F90F7983F2FE24FC4C77BA2AF76F935] for (client id not available,homeassistant,4) 1554363392: |-- url=http://127.0.0.1:8080/superuser 1554363392: |-- data=username=homeassistant&password=&topic=&acc=-1&clientid= 1554363392: |-- aclcheck(homeassistant, stat/sonoff/POWER, 4) SUPERUSER=Y by http 1554363392: |-- Cached [596385BB0F90F7983F2FE24FC4C77BA2AF76F935] for (client id not available,homeassistant,4)

I cannot find a ACL file?

Notice something strange with my switch in overview;

Hopefully we can get to a solution.

It’s not invalid… it’s just a wildcard… it’s replaced when it gets to HA. All mine are like that.

1 Like

Did you setup the ACL as per the instructions?

Yes using the same default as yourself.

Didn’t you say you can’t find an acl file? I am using an acl file.

active: true means you have an acl file too

No I did not setup an ACL file, I must of missed that one, did not see instructions in any of the videos, blogs?

How about ignoring all that shit and reading the docs? Just a thought.

Should I change to false?

Well some people have false - I did but even though it worked the logs were noisy. It is supposed to be mandatory in 4.1 broker.

I suggest you follow the docs and set up the acl as instructed

I can not find the file indicated in the docs under hassio:
The `/share` folder can be accessed via SMB, or on the host file system under `/usr/share/hassio/share .Hassio path ends in /usr/share .
I create the path : /usr/share/hassio/share and then create the two files (accesscontrolist and acl.conf) in but stil doesn´t work , where is my mistake ?

In the samba /share folder create a folder mosquitto The two needed files (accesscontrolist and acl.conf) live in that folder.

Hope it helps.

hi, I have the same issue, so you have updated (with 2.4.2) and yr issue solved ? am I right?

It just seems some routers don’t play well with 2.3.0 (but usually it is the other way around). Usually the 2.4.2 is deemed unstable and on some routers it won’t work at all. Similar to the newer 2.5.0 version. However 2.3.0 did not work for me at all. It just kept disconnecting from wifi, it wouldn’t send messages to the broker when connected, or it would have a minute delay and crazy stuff like that.
I never had this problem as when I started with tasmota the default core was 2.4.2, it was just until recently that I found out that it had gone back to 2.3.0 and I updated the devices ota with the default link (so making everything 2.3.0). I flashed them all back to 2.4.2 (and I was damn lucky that the devices stayed connected to wifi long enough to upload the right firmware). Now all is running solid, they basically never become unavailable anymore for me now and they are damn fast.

But having this said, according to the docs of tasmota, 2.4.2 is deemed very unstable and not recommended to use. But I would suggest trying one (preferably one lying around or one that is easy to remove/install). You could also try the 2.5.0 version.

2.5.2 is current version but I find that is still unstable and 2.3.0 works best for me. You’re the only person I have found who uses 2.4.2 successfully and has issues with 2.3.0 lol.

1 Like