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.2k stars 4.81k forks source link

ESP 32 webcam - MQTT socket error #12294

Closed Enjoy-Combi closed 3 years ago

Enjoy-Combi commented 3 years ago

PROBLEM DESCRIPTION

A clear and concise description of what the problem is. Regular socket error on client with disconnection & reconnection

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

- [ ] If using rules, provide the output of this command: `Backlog Rule1; Rule2; Rule3`:
```lua
  Rules output here:
- [ ] Set `weblog` to 4 and then, when you experience your issue, provide the output of the Console log:
```lua
  Console output here:
16:13:02.255 MQT: tele/webcam_salon_2/SENSOR = {"Time":"2021-06-04T16:13:02","ESP32":{"Temperature":70.0},"TempUnit":"C"}
16:13:58.572 MQT: Attempting connection...
16:13:58.606 MQT: Connected
16:13:58.612 MQT: tele/webcam_salon_2/LWT = Online (retained)

TO REPRODUCE

Steps to reproduce the behavior: Nothing special, it appears in a unpredictable way. Nohting special to do

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen. Do not have MQTT disconnection (broker on a raspberry pi, if mosquitto v1.6.x the devices is usable, if mosquitto v 2.x.x the devices is not usable as there is two must disconnections and connections)

SCREENSHOTS

If applicable, add screenshots to help explain your problem. image

ADDITIONAL CONTEXT

Add any other context about the problem here.

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

sfromis commented 3 years ago

You may have unstable wifi for the board.

Enjoy-Combi commented 3 years ago

I don't think so. I did a test with two raspberry:

ascillato commented 3 years ago

Please, provide the complete output of the console for the command STATUS 0. Thanks.

Also check that you don't have several devices with the same MQTT CLIENT name.

Jason2866 commented 3 years ago

Can not reproduce with my AI-Tinker CAM

00:00:00.001 HDW: ESP32-D0WDQ6
00:00:00.047 UFS: FlashFS mounted with 52 kB free
00:00:00.114 CFG: Loaded from File, Count 0
00:00:00.206 CFG: Use defaults
00:00:00.572 Project sonoff Tasmota Version 9.4.0.4(webcam)-1_0_6(2021-06-05T15:56:06)
00:00:00.738 CMD: 
00:00:04.661 WIF: Connecting to AP1 Jason_Home_WLAN Channel 4 BSSId 88:C3:97:B1:1D:56 in mode 11n as sonoff-952728-1832...
00:00:12.515 WIF: Connected
16:01:12.244 HTP: Web server active on sonoff-952728-1832 with IP address 192.168.2.174
16:01:13.778 MQT: Attempting connection...
16:01:13.808 MQT: Connected
16:01:13.816 MQT: tele/sonoff-952728/LWT = Online (retained)
16:01:13.830 MQT: cmnd/sonoff-952728/POWER = 
16:01:13.843 MQT: tele/sonoff-952728/INFO1 = {"Info1":{"Module":"ESP32-DevKit","Version":"9.4.0.4(webcam)","FallbackTopic":"cmnd/sonoff-952728_fb/","GroupTopic":"cmnd/sonoffs/"}}
16:01:13.853 MQT: tele/sonoff-952728/INFO2 = {"Info2":{"WebServerMode":"Admin","Hostname":"sonoff-952728-1832","IPAddress":"192.168.2.174"}}
16:01:13.868 MQT: tele/sonoff-952728/INFO3 = {"Info3":{"RestartReason":"Software reset digital core"}}
16:01:18.553 MQT: tele/sonoff-952728/STATE = {"Time":"2021-06-05T16:01:18","Uptime":"0T00:00:18","UptimeSec":18,"Heap":198,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":33,"MqttCount":1,"Wifi":{"AP":1,"SSId":"Jason_Home_WLAN","BSSId":"88:C3:97:B1:1D:56","Channel":4,"RSSI":98,"Signal":-51,"LinkCount":1,"Downtime":"0T00:00:11"}}
16:01:18.580 MQT: tele/sonoff-952728/SENSOR = {"Time":"2021-06-05T16:01:18","ESP32":{"Temperature":52.2},"TempUnit":"C"}
Jason2866 commented 3 years ago

I do not think it is (WebCam)ESP32 related, have you tried the ESP8266 to connect to the mosquitto v.2.0 ? Is there a specific reason for using mosquitto v2.0? Tasmota does not use features of the v2.0 and will not do in the future. Probably the v2.0 version needs "tunning" in the setup.

sfromis commented 3 years ago

By now, the main reason for using Mosquitto v2.0 is probably that it is the current version, generally flagged as "latest". Extra work to switch to an older one. For now, I've postponed upgrading my old setup running very smoothly.

Enjoy-Combi commented 3 years ago

I was using mosquitto v2 simply because it the stable verison on raspberry OS right now. When having this I enabled listening on port 1883 & anoymous connection. the modules (two at the total) were operating good for sometime and start continiously disconnecting and reconnecting (MQTT, not wifi). I downgraded to mosquitto v1 and the modules are usable but with few mqtt disconnections & reconnections. I do not have this issue at with sononf devices, esp-01 devices I have (and I have roughly 15 devices like this).

Here is the log with more data when the issue appears: Jun 5 12:50:06 webcam-salon-2 ESP-WIF: Checking connection... Jun 5 12:50:11 webcam-salon-2 ESP-DOM: idx 9, nvalue 0 Jun 5 12:50:11 webcam-salon-2 ESP-DOM: idx 32, nvalue 0 Jun 5 12:50:21 webcam-salon-2 ESP-DOM: idx 8, nvalue 0 Jun 5 12:50:26 webcam-salon-2 ESP-WIF: Checking connection... Jun 5 12:50:31 webcam-salon-2 ESP-DOM: idx 7, nvalue 0 Jun 5 12:50:31 webcam-salon-2 ESP-DOM: idx 105, nvalue 0 Jun 5 12:50:31 webcam-salon-2 ESP-DOM: idx 106, nvalue 0 Jun 5 12:50:32 webcam-salon-2 ESP-DOM: idx 107, nvalue 0 Jun 5 12:50:33 webcam-salon-2 ESP-DOM: idx 24, nvalue 0 Jun 5 12:50:33 webcam-salon-2 ESP-DOM: idx 26, nvalue 0 Jun 5 12:50:33 webcam-salon-2 ESP-DOM: idx 25, nvalue 0 Jun 5 12:50:33 webcam-salon-2 ESP-DOM: idx 23, nvalue 0 Jun 5 12:50:46 webcam-salon-2 ESP-WIF: Checking connection... Jun 5 12:51:01 webcam-salon-2 ESP-DOM: idx 7, nvalue 0 Jun 5 12:51:01 webcam-salon-2 ESP-DOM: idx 105, nvalue 0 Jun 5 12:51:02 webcam-salon-2 ESP-DOM: idx 106, nvalue 0 Jun 5 12:51:02 webcam-salon-2 ESP-DOM: idx 107, nvalue 0 Jun 5 12:51:06 webcam-salon-2 ESP-WIF: Checking connection... Jun 5 12:51:11 webcam-salon-2 ESP-HTP: Main Menu Jun 5 12:51:26 webcam-salon-2 ESP-CAM: Handle camserver Jun 5 12:51:26 webcam-salon-2 ESP-CAM: Create client Jun 5 12:51:26 webcam-salon-2 ESP-CAM: Start stream Jun 5 12:51:26 webcam-salon-2 ESP-DOM: idx 11, nvalue 0 Jun 5 12:51:27 webcam-salon-2 ESP-HTP: Consoles Jun 5 12:51:27 webcam-salon-2 ESP-CAM: Handle camserver Jun 5 12:51:27 webcam-salon-2 ESP-CAM: Create client Jun 5 12:51:27 webcam-salon-2 ESP-CAM: Client fail Jun 5 12:51:27 webcam-salon-2 ESP-CAM: Stream exit Jun 5 12:51:27 webcam-salon-2 ESP-CAM: Handle camserver Jun 5 12:51:27 webcam-salon-2 ESP-CAM: Create client Jun 5 12:51:27 webcam-salon-2 ESP-CAM: Start stream Jun 5 12:51:27 webcam-salon-2 ESP-MQT: Attempting connection... Jun 5 12:51:27 webcam-salon-2 ESP-MQT: Connected Jun 5 12:51:27 webcam-salon-2 ESP-MQT: tele/webcam_salon_2/LWT = Online (retained) Jun 5 12:51:27 webcam-salon-2 ESP-MQT: cmnd/webcam_salon_2/POWER = Jun 5 12:51:27 webcam-salon-2 ESP-MQT: Subscribe to cmnd/webcam_salon_2/# Jun 5 12:51:27 webcam-salon-2 ESP-MQT: Subscribe to cmnd/tasmotas/# Jun 5 12:51:27 webcam-salon-2 ESP-MQT: Subscribe to cmnd/DVES_EAA038_fb/# Jun 5 12:51:27 webcam-salon-2 ESP-MQT: Subscribe to domoticz/out/# Jun 5 12:51:27 webcam-salon-2 ESP-MQT: Unsubscribe from homeassistant/status Jun 5 12:51:31 webcam-salon-2 ESP-HTP: Console Jun 5 12:51:31 webcam-salon-2 ESP-DOM: idx 8, nvalue 0 Jun 5 12:51:32 webcam-salon-2 ESP-DOM: idx 7, nvalue 0 Jun 5 12:51:32 webcam-salon-2 ESP-DOM: idx 105, nvalue 0 Jun 5 12:51:32 webcam-salon-2 ESP-DOM: idx 106, nvalue 0 Jun 5 12:51:32 webcam-salon-2 ESP-DOM: idx 107, nvalue 0 Jun 5 12:51:32 webcam-salon-2 ESP-DOM: idx 9, nvalue 0 Jun 5 12:51:32 webcam-salon-2 ESP-DOM: idx 32, nvalue 0 Jun 5 12:51:33 webcam-salon-2 ESP-DOM: idx 24, nvalue 0 Jun 5 12:51:33 webcam-salon-2 ESP-DOM: idx 26, nvalue 0 Jun 5 12:51:33 webcam-salon-2 ESP-DOM: idx 25, nvalue 0 Jun 5 12:51:33 webcam-salon-2 ESP-DOM: idx 23, nvalue 0 Jun 5 12:51:45 webcam-salon-2 ESP-WIF: Checking connection... Jun 5 12:51:47 webcam-salon-2 ESP-HTP: Consoles Jun 5 12:51:47 webcam-salon-2 ESP-DOM: idx 128, nvalue 44 Jun 5 12:51:48 webcam-salon-2 ESP-HTP: Main Menu Jun 5 12:51:51 webcam-salon-2 ESP-CAM: Handle camserver Jun 5 12:51:51 webcam-salon-2 ESP-CAM: Create client Jun 5 12:51:51 webcam-salon-2 ESP-CAM: Start stream Jun 5 12:51:52 webcam-salon-2 ESP-CAM: Handle camserver Jun 5 12:51:52 webcam-salon-2 ESP-CAM: Create client Jun 5 12:51:52 webcam-salon-2 ESP-CAM: Start stream Jun 5 12:51:55 webcam-salon-2 ESP-DOM: idx 51, nvalue 0 Jun 5 12:52:01 webcam-salon-2 ESP-DOM: idx 7, nvalue 0 Jun 5 12:52:01 webcam-salon-2 ESP-DOM: idx 105, nvalue 0 Jun 5 12:52:01 webcam-salon-2 ESP-DOM: idx 106, nvalue 0 Jun 5 12:52:01 webcam-salon-2 ESP-DOM: idx 107, nvalue 0 Jun 5 12:52:08 webcam-salon-2 ESP-WIF: Checking connection...

Apparently, the disconnection follow a client fail.

Enjoy-Combi commented 3 years ago

Status 0 gives:

21:33:59.342 CMD: STATUS 0 21:33:59.350 MQT: stat/webcam_salon_2/STATUS = {"Status":{"Module":0,"DeviceName":"Webcam salon 2","FriendlyName":["Tasmota"],"Topic":"webcam_salon_2","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0}} 21:33:59.383 MQT: stat/webcam_salon_2/STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota32/release/tasmota32.bin","RestartReason":"Software reset CPU","Uptime":"3T00:45:39","StartupUTC":"2021-06-02T19:48:20","Sleep":50,"CfgHolder":4617,"BootCount":94,"BCResetTime":"2021-05-20T14:08:41","SaveCount":229}} 21:33:59.420 MQT: stat/webcam_salon_2/STATUS2 = {"StatusFWR":{"Version":"9.4.0.4(webcam)","BuildDateTime":"2021-05-19T15:28:36","Core":"1_0_6","SDK":"v3.3.5-1-g85c43024c","CpuFrequency":240,"Hardware":"ESP32-D0WDQ6","CR":"390/699"}} 21:33:59.439 MQT: stat/webcam_salon_2/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"serveur","LogPort":514,"SSId":["SFR_B7A8",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","2805C8000100060000005A0A000000000000","00000080","00006000","00000000"]}} 21:33:59.468 MQT: stat/webcam_salon_2/STATUS4 = {"StatusMEM":{"ProgramSize":1357,"Free":1856,"Heap":122,"PsrMax":4095,"PsrFree":3345,"ProgramFlashSize":4096,"FlashSize":4096,"FlashFrequency":40,"FlashMode":3,"Features":["00000809","8FDAC78F","00140001","000000CF","010013C0","40000981","80004000","00200000","00000024"],"Drivers":"1,2,3,4,5,7,8,9,10,12,20,21,24,26,27,29,50,81","Sensors":"1,2,3,5,6,87"}} 21:33:59.501 MQT: stat/webcam_salon_2/STATUS5 = {"StatusNET":{"Hostname":"webcam-salon-2","IPAddress":"192.168.1.22","Gateway":"192.168.1.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.1.1","Mac":"9C:9C:1F:EA:A0:38","Webserver":2,"WifiConfig":0,"WifiPower":17.0}} 21:33:59.525 MQT: stat/webcam_salon2/STATUS6 = {"StatusMQT":{"MqttHost":"serveur","MqttPort":1883,"MqttClientMask":"DVES%06X","MqttClient":"DVES_EAA038","MqttUser":"DVES_USER","MqttCount":33,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30,"SOCKET_TIMEOUT":4}} 21:33:59.547 MQT: stat/webcam_salon_2/STATUS7 = {"StatusTIM":{"UTC":"2021-06-05T20:33:59","Local":"2021-06-05T21:33:59","StartDST":"2021-03-28T02:00:00","EndDST":"2021-10-31T03:00:00","Timezone":"+01:00","Sunrise":"04:48","Sunset":"20:48"}} 21:33:59.568 MQT: stat/webcam_salon_2/STATUS10 = {"StatusSNS":{"Time":"2021-06-05T21:33:59","ESP32":{"Temperature":66.7},"TempUnit":"C"}} 21:33:59.582 MQT: stat/webcam_salon_2/STATUS11 = {"StatusSTS":{"Time":"2021-06-05T21:33:59","Uptime":"3T00:45:39","UptimeSec":261939,"Heap":118,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":170,"MqttCount":33,"POWER":"OFF","Dimmer":42,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"SFR_B7A8","BSSId":"E4:5D:51:69:B7:AE","Channel":11,"RSSI":72,"Signal":-64,"LinkCount":1,"Downtime":"0T00:00:06"}}}

Enjoy-Combi commented 3 years ago

Regarding the topic name, there is only this device having webcam_salon_2

ascillato commented 3 years ago

Sorry, it is known that are some issues with mosquitto V2 itself. If you can use previous version of mosquitto you won't have this issue. If not, please do a new clean install of mosquitto. If the issue continues, please do a search in home assistant's issues where it is explained how to reconfigure mosquitto to not have this issue. I don't have the exact issue number, sorry.

Jason2866 commented 3 years ago

Using mosquitto v1.6 with Raspberry. Rock solid with every device. I do NOT use Home Assistant. It is not a Tasmota issue.

Enjoy-Combi commented 3 years ago

Using mosquitto v1.6 with Raspberry. Rock solid with every device. I do NOT use Home Assistant. It is not a Tasmota issue.

I use it with domoticz. I just do some test with home assistant. FYI, if I use mosquitti broker with home assistant (on a separate raspberry) no issue. I have the issue when using it with the raspberry which hosts domoticz (even with the raspberry shutted down where home assistant is)

Jason2866 commented 3 years ago

You just wrote yourself you have a setup issue when using Domoticz / mosquitto together. Tasmota github is not the place to solve these issues.

Enjoy-Combi commented 3 years ago

I understand, but how to be sure this is not an issue with the tasmota firmware ?

Jason2866 commented 3 years ago

Tasmota is working in many many mqtt installations without issues. We have no open issue regarding mqtt problems. Since we do not have issues we cant isolate where your issues do came from. You are the only one who can do.

Enjoy-Combi commented 3 years ago

OK, then I can close this one. When finding the issue I will update it for information. Thanks for all your comments