🎁📬❄️📦Adafruit Holiday Shipping Deadlines 2019: Please place all UPS 2 Day orders by 11am Monday, December 16 📦❄️📬🎁
0

Get All Feed Data
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Get All Feed Data

by JoseeMallah on Mon Nov 11, 2019 1:27 pm

Hello everyone,
I need to get all feed data in Arduino code (I am using NodeMCU with Arduino IDE). I found this for Python:
Code: Select all | TOGGLE FULL SIZE
# Import library and create instance of REST client.
from Adafruit_IO import Client
aio = Client('YOUR ADAFRUIT IO USERNAME', 'YOUR ADAFRUIT IO KEY')

# Get an array of all data from feed 'Test'
data = aio.data('Test')

# Print out all the results.
for d in data:
    print('Data value: {0}'.format(d.value))


How to do the same in Arduino IDE? I want to save each string/data value in array of strings if there is a needed type conversion.
Thank you

JoseeMallah
 
Posts: 7
Joined: Thu Oct 31, 2019 6:34 am

Re: Get All Feed Data

by brubell on Mon Nov 11, 2019 1:54 pm

Check out the examples bundled with the Adafruit IO Arduino Library

https://github.com/adafruit/Adafruit_IO_Arduino

brubell
 
Posts: 649
Joined: Fri Jul 17, 2015 10:33 pm

Re: Get All Feed Data

by JoseeMallah on Mon Nov 11, 2019 2:31 pm

Can you please precise which one although I may be insisting?

JoseeMallah
 
Posts: 7
Joined: Thu Oct 31, 2019 6:34 am

Re: Get All Feed Data

by brubell on Mon Nov 11, 2019 4:52 pm

JoseeMallah wrote:Can you please precise which one although I may be insisting?


I don't think you'll be able to get all the feed data from Adafruit IO Arduino. as it allows you to either get the current state of a feed, or subscribe to updates from the feed via the Adafruit IO MQTT Server.

If you can perform HTTP GET requests from your NodeMCU, take a look at the Get Feed Data endpoint for the Adafruit IO API:
https://io.adafruit.com/api/docs/?shell#get-feed-data

This is what Adafruit IO Python uses. You may want to use the ESP8266's WiFiSSLClient example and modify it for that API endpoint.

If you hit any issues or roadblocks, feel free to post up below.

brubell
 
Posts: 649
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.