Skip to content

issue with get_io_data() after get_local_time() #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Stalkii opened this issue Nov 19, 2020 · 6 comments · Fixed by #52
Closed

issue with get_io_data() after get_local_time() #51

Stalkii opened this issue Nov 19, 2020 · 6 comments · Fixed by #52

Comments

@Stalkii
Copy link

Stalkii commented Nov 19, 2020

I stumbled upon an issue, which I was asked to file here.
My code creates an matrixportal object and calling get_local_time() works without issues. Once I try to get data from/to adafruit IO my program throws an exception and is stuck in it.

matrixportal.get_local_time()
matrixportal.get_io_data("test")
>>> An error occured, retrying! 1 - Sending request failed

I verified that there is data in the feed. I do also get data from it when switching both lines. They just don't run in this order.
Can someone else verify this?

By this time I forge my request URL myself and call it via a request object. I would, however, more likely use the matrixportal built-in functions.

Thanks and best regards

@tannewt
Copy link
Member

tannewt commented Nov 19, 2020

Please double check you are using the latest versions of ESP32SPI and Requests libraries (and let us know what versions). We fixed a number of issues in them.

@Stalkii
Copy link
Author

Stalkii commented Nov 20, 2020

Just downloaded and installed latest libraries 20201120. Still the same error.

@makermelissa
Copy link
Collaborator

@Stalkii I just tried out https://learn.adafruit.com/aio-quote-board-matrix-display using the latest libraries from the bundle. This project uses get_io_data() and it is working for me. Keep in mind that Adafruit IO deletes older data after a certain period of time. If you can see the data, then it should be ok.

@makermelissa
Copy link
Collaborator

makermelissa commented Nov 20, 2020

Never mind, I see that it works if you don't call matrixportal.get_local_time(), but fails if you do. I'll take a closer look.

@makermelissa
Copy link
Collaborator

After commenting out the embedded error handlers, here's the real traceback:

Traceback (most recent call last):
  File "code.py", line 61, in <module>
  File "code.py", line 44, in update_data
  File "/lib/adafruit_matrixportal/matrixportal.py", line 345, in get_io_data
  File "/lib/adafruit_matrixportal/network.py", line 396, in get_io_data
  File "/lib/adafruit_io/adafruit_io.py", line 592, in receive_all_data
  File "/lib/adafruit_io/adafruit_io.py", line 545, in _get
  File "/lib/adafruit_esp32spi/adafruit_esp32spi_wifimanager.py", line 225, in get
  File "/lib/adafruit_requests.py", line 674, in get
  File "/lib/adafruit_requests.py", line 572, in request
  File "/lib/adafruit_requests.py", line 441, in _get_socket
RuntimeError: Sending request failed

@Pokornz
Copy link

Pokornz commented Jan 16, 2022

After commenting out the embedded error handlers, here's the real traceback:

Traceback (most recent call last):
  File "code.py", line 61, in <module>
  File "code.py", line 44, in update_data
  File "/lib/adafruit_matrixportal/matrixportal.py", line 345, in get_io_data
  File "/lib/adafruit_matrixportal/network.py", line 396, in get_io_data
  File "/lib/adafruit_io/adafruit_io.py", line 592, in receive_all_data
  File "/lib/adafruit_io/adafruit_io.py", line 545, in _get
  File "/lib/adafruit_esp32spi/adafruit_esp32spi_wifimanager.py", line 225, in get
  File "/lib/adafruit_requests.py", line 674, in get
  File "/lib/adafruit_requests.py", line 572, in request
  File "/lib/adafruit_requests.py", line 441, in _get_socket
RuntimeError: Sending request failed

I'm getting the same error in 2022 using the MagTag. The weirdest thing is that it sometimes works and sometimes doesn't (in between restarts), so it's probably adafruit IO servers that are the cause.
EDIT: Even weirder, it tends to fail when resetting via button or power, but not when doing soft reboot in REPL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants