Did you try the gc.collect()?
Another question is how much data is getting returned from the GET?
Dave
Basic questions about PyPortal display
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15674
- Joined: Tue Oct 20, 2015 3:22 pm
- ghulse
- Posts: 97
- Joined: Tue Nov 30, 2021 10:49 am
Re: Basic questions about PyPortal display
Yes, I have gc.collect() in there just before the time.sleep.
As to your second question, oof! A lot of data as it turns out.
This particular url has data for about 20 buoys.
Code: Select all
r = requests.get(noaa_url)
text = r.text
viewtopic.php?p=958619&hilit=boaa+buoy#p958619
- dastels
- Posts: 15674
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Basic questions about PyPortal display
That'll do it. If you can reduce the amount to data being returned, it will definitely help.
Dave
Dave
- ghulse
- Posts: 97
- Joined: Tue Nov 30, 2021 10:49 am
Re: Basic questions about PyPortal display
This new NOAA data feed provides the time in UTC format. Is there an easy way to convert this to local time?
- dastels
- Posts: 15674
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Basic questions about PyPortal display
The PyPortal class has a get_local_time method that takes a string indicating your city/country as a parameter, e.g. Your city and country, e.g. "America/New_York".
Dave
Dave
- ghulse
- Posts: 97
- Joined: Tue Nov 30, 2021 10:49 am
Re: Basic questions about PyPortal display
The NOAA url returns the time of last data collected, not current time. (It’s usually about 45 minutes before current time). Would I be able to feed this time to the PyPortal class for conversion to local time? (Before I dive down this rabbit hole)
- dastels
- Posts: 15674
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Basic questions about PyPortal display
I wonder....
what if you fetch the current time in UTC, as well as in local time, compute the difference and use that to offset the UTC time from the data. See io.adafruit.com/<your Adafruit IO usename>services/time
Dave
what if you fetch the current time in UTC, as well as in local time, compute the difference and use that to offset the UTC time from the data. See io.adafruit.com/<your Adafruit IO usename>services/time
Dave
- ghulse
- Posts: 97
- Joined: Tue Nov 30, 2021 10:49 am
Re: Basic questions about PyPortal display
I solved all my problems by finding a different rss feed—one that contains only the Cambridge buoy data. The time is already in eastern time zone, so I don't have to try to figure out how to convert UTC. Then I tweaked the code so the display so it is somewhat readable. This updates every five minutes and no crashes for more than 24 hours. Thanks for all the help.
- dastels
- Posts: 15674
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Basic questions about PyPortal display
Awesome!
Dave
Dave
Please be positive and constructive with your questions and comments.