arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.15k stars 4.8k forks source link

Device disconnecting from mqtt every 60 seconds, even after reflashing. #6816

Closed cbullo closed 4 years ago

cbullo commented 4 years ago

BUG DESCRIPTION

I have accidentally (sic!) flashed a perfectly working sonoff device with the newest firmware. Before it worked perfectly and the connection was super stable. Now after flashing the latest firmware it disconnects from mqtt server exactly every 60 seconds. I have followed the steps from the FAQ MQTT troubleshooting without any change.

FAILURE TO COMPLETE THE REQUESTED INFORMATION WILL RESULT IN YOUR ISSUE BEING CLOSED

TO REPRODUCE

Connect to Mosquitto MQTT server on my raspberry pi.

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen. Not disconnecting from MQTT server

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

The same is happening with my generic esp 01 module that I flashed with the same firmware.

And these are messages received on my MQTT:

myhome/livingroom/sonoff/LWT Offline
myhome/livingroom/sonoff/LWT Online
myhome/livingroom/sonoff/cmnd/POWER (null)
myhome/livingroom/sonoff/RESULT {"POWER":"OFF"}
myhome/livingroom/sonoff/POWER OFF
myhome/livingroom/sonoff/LWT Offline
myhome/livingroom/sonoff/LWT Online
myhome/livingroom/sonoff/cmnd/POWER (null)
myhome/livingroom/sonoff/RESULT {"POWER":"OFF"}                                                                        myhome/livingroom/sonoff/POWER OFF
myhome/livingroom/sonoff/LWT Offline
myhome/livingroom/sonoff/LWT Online
myhome/livingroom/sonoff/cmnd/POWER (null)
myhome/livingroom/sonoff/RESULT {"POWER":"OFF"}
myhome/livingroom/sonoff/POWER OFF

(Please, remember to close the issue when the problem has been addressed)

ascillato commented 3 years ago

Hi, in latest firmware there isn't any known bug about that. So, if you are having mqtt reconnections with latest version, you should look for an issue in your network or in your broker. Please, after you gather some more information, address this to the Tasmota support chat. Thanks

qcrist commented 3 years ago

Alright, will do

jcrespoc commented 3 years ago

Alright, will do

Not related to Tasmota nor network nor MQTT broker. Check DHCP lease time configuration on your router.

bolislav2 and mine is 60 seconds. ESP8266 core broke established TCP connections every time dhcp lease is renewed if lease time is smaller than 2 minutes even though IP address doesn't change. Tested with ESP8266 WiFiClient example (nothing related to Tasmota).

bolislav2 fixed it by changing lease time to 72h. I fixed it by configuring static ip address in Tasmotas (my router doesn't allow change DHCP settings).

I'm trying to open a ESP8266 core issue.

Jason2866 commented 3 years ago

No, there is no problem with the DHCP release and Arduino ESP8266. I have not a single reconnect for devices running for days and i have a DHCP release renew time of 300 minutes. The problem is "somewhere" in your network.

jcrespoc commented 3 years ago

No, there is no problem with the DHCP release and Arduino ESP8266. I have not a single reconnect for devices running for days and i have a DHCP release renew time of 300 minutes.

Not the test case. Please, set a 60 seconds lease time and test. If reproduced (for sure will do), recompile Tasmota with LWIP 1.4 (I'm testing right now)

ascillato commented 3 years ago

Hi, I couldn't reproduce your issue neither. I have the default lease time and zero problems. Tried 60 as yours and no problem. Please, check the config of your router, update the firmware of your router or report to your routers manufacturer. Thanks.

ntcong commented 3 years ago

I have the same problem with a Tuya switch: a SYN request with the wrong checksum followed by a TCP RST 200ms later. image

The request seems fine, my network card doesn't have TCP offload as the request from another device (192.168.1.22) has the correct checksum.

I believe maybe the device sends the packet with the wrong checksum, my server drop it. After 200ms the device gives up and sends TCP RST

jcrespoc commented 3 years ago

Please, confirm 60 seconds pattern. If so, please confirm it gone away when setting up a fixed ipadress (IpAddress1 xxx.xxx.xxx.xxx in Console)