Open mtnbrit opened 8 years ago
Is MQTT really suitable for large transfers like this? What I would do is just send a MQTT message to notify the ESP that a OTA is available on some server and then the ESP would get the update from there.
Again, I don't know what I'm saying, that's just what I would do.
Are your code opensource ? I need ota uodate also ;-)
But i agree with @Sushinn, the official SDK have OTA methods and if i remember the esp core for Arduino also, so why create a new type of OTA on Mqtt protocoll ? Il 18/set/2015 05:08, "Marcio Granzotto Rodrigues" notifications@github.com ha scritto:
Is MQTT really suitable for large transfers like this? What I would do is just send a MQTT message to notify the ESP that a OTA is available on some server and then the ESP would get the update from there.
Again, I don't know what I'm saying, that's just what I would do.
— Reply to this email directly or view it on GitHub https://github.com/Imroy/pubsubclient/issues/35#issuecomment-141331542.
@mtnbrit Hi , i have same problem, is this problem fixed ? please help :)
Hi Iml having trouble getting OTA to work reliably over MQTT
I'm using @Imroy 's MQTT example as a base for my code, it uses UpdaterClass::writeStream
I added a lot of extra debugging to Updater.cpp to see why it was failing 98% of the time. I found the mqtt transfer stream was "bogging down", i.e. it starts out fast but gets slower and slower and eventually times out. I added
data.setTimeout(15000);
to the top of writeStream and this helped but I still get timeouts. This is from a broker located in a Chicago hosting co, so only about 70ms away and no packet loss.In order to eliminate network conditions as being the cause, I tried also from a broker on my local LAN, i.e. less than 1ms latency, and things look much better, i can get 6 out of 10 OTAs to work perfect. I get the "Staged" message and it restarts as it should.
Im getting lmac.c 662 the other 4 times out of 10 when testing from the LAN broker.
Back to testing from my internet-hosted broker (which is ultimately where it needs to work from), it mostly just bogs down and times out with
ERROR[5]: Stream Read Timeout
, sometimes I get lmac.c 662 also right after starting the OTA. The packets start out coming in at 4096 bytes each nice and rapidly, but they seem to slow down i.e. they get longer and longer gaps between them, eventually I start seeing some smaller-than-4096 packets, this is a pretty good sign its about to timeout, then it does. I addedSerial.println(toRead); Serial.println(written);
in the while inside writeStream to view the progress, heres the outputThere is no packet loss from the esp to my gateway and no loss from the gateway to the server, no congestion anywhere. It almost feels like my server is rate-limiting or throttling this large mqtt transfer, is that even possible? I'm running mosquito 1.4.3 broker.
Any ideas?