s60sc / ESP32-CAM_MJPEG2SD

ESP32 Camera motion capture application to record JPEGs to SD card as AVI files and stream to browser as MJPEG. If a microphone is installed then a WAV file is also created. Files can be uploaded via FTP or downloaded to browser.
GNU Affero General Public License v3.0
888 stars 209 forks source link

Updates for MQTT #451

Closed genehand closed 3 months ago

genehand commented 3 months ago

Hey just found the repo and working great for me, although ran into some problems with MQTT. Seems to be a timing issue with startMqttClient called from statusCheck & updateStatus that can run it twice before mqttConnected is updated:

[00:00:06.184 startMqttClient] Mqtt connect to mqtt://10.10.10.3:1883...
[00:00:06.186 startMqttClient] Created mqtt task: 1
[00:00:06.235 startMqttClient] Mqtt connect to mqtt://10.10.10.3:1883...
[00:00:06.236 startMqttClient] Created mqtt task: 1

Resetting the initial mqtt_client could cause the topic subscription to fail, which then calls stopMqttClient and starts the process over. This fixes https://github.com/s60sc/ESP32-CAM_MJPEG2SD/issues/316. I also changed reloadConfigs to send all the vars as json to a config topic, leaving the status topic mainly for motion events.

If this works for you I could also take a look at the updates for arduino-esp32 v3. Thx!

s60sc commented 3 months ago

Thanks Happy for you update MQTT for v3, I want to update I2S and MCPWM first.