Adafruit_IO_Arduino icon indicating copy to clipboard operation
Adafruit_IO_Arduino copied to clipboard

getting data unreliable if datapoint is large

Open HannesZei opened this issue 4 years ago • 4 comments

  • Arduino board: ESP32 from AZ-Delivery

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.13 (or/and plattform io)

  • List the steps to reproduce the problem below (if possible attach a sketch or copy the sketch code in too): Simple Sketch that inits a connection subscribes to a topic and requests that with feed->get() or gets the last data with feed->lastValue()
    If you enter data of more than 80-85 characters the value is not received. (with get() it will never call the handler and with lastValue() it will never finish the call) (That is true for feeds with history turned off and on)

It also happens with the example sketch: https://github.com/adafruit/Adafruit_IO_Arduino/blob/master/examples/adafruitio_01_subscribe/adafruitio_01_subscribe.ino

HannesZei avatar Nov 21 '20 15:11 HannesZei

Could you try increasing the MAXBUFFERSIZE in the Adafruit_MQTT_Library on your computer?

https://github.com/adafruit/Adafruit_MQTT_Library/blob/master/Adafruit_MQTT.h#L110

brentru avatar Nov 23 '20 14:11 brentru

Thank you. Unfortunately it did not resolve my problem. Since the problem does also occur if i use lastValue which uses http (as far as i can tell) i suppose it is a common problem. I checked with http. It works if i manually enter the query in the browser as per the api. So currently i wrote my costume http implementation which does work, so it shows it schould be possible. I did look into the problem a bit. But the errors/info i get are changing from try to try if i add some print statements for example. That is why i think an array overflow or something like that might be the cause. (But keep in mind i tried this with my whole code so it might be some unrelated issue as well).
I also get issues with ssl certificates (even using different/my own libraries). Maybe it is specific to my device only (I tested it with 2 esp32's). It would be nice if someone could confirm the behavior and/or provide a fix/suggestion for it.

I saw the AIO_DATA_LENGTH definition (https://github.com/adafruit/Adafruit_IO_Arduino/blob/master/src/AdafruitIO_Definitions.h#L131), which seemed to be the thing i am looking for, but it did not work as well. (I am curious: what is it for? because it was set to 45 but i used data values larger than that. Do I misunderstand that or did i just got lucky with memory placement or something.)

HannesZei avatar Nov 24 '20 17:11 HannesZei

I also get issues with ssl certificates (even using different/my own libraries).

What issues are you getting with your SSL certs?

brentru avatar Nov 25 '20 14:11 brentru

I get An invalid SSL record was received. But i think that is an issue on my side. (This mentioned something similar although it did not resolve my problem: https://github.com/espressif/arduino-esp32/issues/2733#issuecomment-625814342) I have trouble locating the specific code that causes the issue however since the issue will not occur always and most of the times no issue will arise but the next step in code will not be executed as well. For now i use my own implementation because i only have very easy data manipulation. I will still try and see if i might find the issue but i am not equipped with a debugger and just started programming with the esp32 so im dont have a lot of hope.

HannesZei avatar Nov 25 '20 19:11 HannesZei