Sonoff Tasmota S26 Constantly Disconnecting

It will stay on for a while, or not, and then disconnect from Home Assistant. And the really aggravating part is that it then turns off the switch! I really don’t understand why if it loses connection to the MQTT server, that is MUST turn off the switch!

But aside from that, why is this happening? Seems totally random.
I set the ‘Retain’ to ‘false’ but can’t for the life of me figure out out to remove the ‘retains’ from the database. I Google and see code, but have no idea how to execute it. Lots of examples with blanks to fill in, but nothing on how or where to run it, or what to put in the blanks.

The dam thing is only 10 feet from the wireless router!

1552200653: New connection from 172.27.3.13 on port 1883.
[INFO] found MQTT_USER on local database
1552200653: New client connected from 172.27.3.13 as sonoff-3 (c1, k10, u'MQTT_USER').
1552200712: Socket error on client sonoff-3, disconnecting.
1552200713: New connection from 172.27.3.13 on port 1883.
[INFO] found MQTT_USER on local database
1552200713: New client connected from 172.27.3.13 as sonoff-3 (c1, k10, u'MQTT_USER').
1552200738: Client sonoff-3 has exceeded timeout, disconnecting.
1552200738: Socket error on client sonoff-3, disconnecting.

platform: mqtt
    name: "Hevo 3D Printer"
    command_topic: "cmnd/sonoff-3/power"
    state_topic: "stat/sonoff-3/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: false

Yes the retain: true from the past is the cause of this. MQTT explorer will let you remove this from the database… or you need to delete the mosquito.db file. If using Hassio, the easiest way is to remove the mosquito addon and reinstall it.

There’s a video around that goes through powerretain settings… If you can’t locate it I will find it for you when I am on my PC tomorrow…

1 Like

Wehn i used tasmota, robs video from the hookup was an excellent one regarding retain in tasmota.

3 Likes

Yeah… that’s the one I was referring to…

Thanks guys! I really appreciate the quick response and help!!

FYI
Here’s an update for anyone reading this:
I did all the retain setting adjustments in the above YouTube video and it fixed all my Basic and TH16 switches, but my S26 module still kept disconnecting - even with the WiFi signal at 86%.
So I downgraded the firmware to 6.3.0 and so far, for 3 hours now, its not disconnected (before it would disconnect after about 15 minutes max).
Thanks again for everyone’s help!

Another update: It’s still broke

My S26 will only stay on for a few hours and then it turns itself off.
It’s not disconnecting from Wifi, but it is toggling the outlet off.
There is no load on the outlet - nothing is plugged into it.
And the WiFi signal is at 70%

Here’s the Hassio log:

1552447545: Saving in-memory database to /data/mosquitto.db.
1552448205: Client sonoff-3 has exceeded timeout, disconnecting.
1552448205: Socket error on client sonoff-3, disconnecting.
1552448208: New connection from 172.27.3.13 on port 1883.
[INFO] found MQTT_USER on local database
1552448208: New client connected from 172.27.3.13 as sonoff-3 (c1, k10, u'MQTT_USER').

Any ideas? It’s just timing out. Why?

So, I added this to the MQTT section in configuration.yaml

keepalive: 60

But apparently that’s only for connecting Home Assistant to MQTT:

1552450193: New client connected from 172.30.32.1 as xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx(c1, k60, u'homeassistant').

As my sonoff S26 switch still defaults to 10 seconds.

1552450531: New client connected from 172.27.3.13 as sonoff-3 (c1, k10, u'MQTT_USER').

I can’t find any place in the tasmota menus on the S26 that I can set the MQTT keepalive value.

Any ideas?

Looks like I have to download the source, make the change in pubsubclient.h, recompile and re-upload the modified firmware.
Bummer.
Hoping there was an option somewhere on the Web UI

Have you checked all the Tasmota set options?

Yes. did not find any

Seems you found this solution already
https://github.com/arendst/Sonoff-Tasmota/issues/5100

I have not jumped into editing and recompiling the firmware - yet.
I found some other threads that suggested using a different name for the MQTT client than the topic name.
So I’ve downgraded all my tasmota switches to 6.3.0 and given them unique Client names from their topic names.
Fingers crossed so far no disconnects…and its been over 12 hours…

Latest dev releases are available for core 2.3.0 v 6.4.1.21 currently. I use that with MQTT discovery and it’s finally stable now core 2.3.0 works again.

1 Like

Lets try this post again. Couldn’t get it to format properly…
The bug is back:

1552669720: Client Hevo3DPrinter has exceeded timeout, disconnecting.
1552669720: Socket error on client Hevo3DPrinter, disconnecting.
1552669726: Client TableLampSensor has exceeded timeout, disconnecting.
1552669726: Socket error on client TableLampSensor, disconnecting.
1552669740: New connection from 172.27.3.12 on port 1883.
[INFO] found MQTT_USER on local database
1552669740: New client connected from 172.27.3.12 as TableLampSensor (c1, k10, u'MQTT_USER').
1552669759: New connection from 172.27.3.13 on port 1883.
[INFO] found MQTT_USER on local database
1552669759: New client connected from 172.27.3.13 as Hevo3DPrinter (c1, k10, u'MQTT_USER').

Guess I’ll try v6.4.1.21