0

Using Feeds for default settings?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Using Feeds for default settings?

by GregH105 on Wed Mar 22, 2017 8:45 pm

I would like to setup a dashboard on Adafruit.io and have a section or area of "default" or configuration values for my current project.
From what I have read about the Adafruit.io and MQTT if your not currently connected and a value gets sent, the msg is lost, so it might not be possible taking this approach.

For example I need to determine a threshold value over the next few days empirically.
I'm going to assume a default value of 700, but rather than hardcode this value I was thinking of setting up a feed to store the last or current configured threshold value. Then whenever the system turns on, it would get the last value from the feed history and use that.

Any ideas on implementing this?
Thanks in advance,
Greg

GregH105
 
Posts: 14
Joined: Thu Apr 23, 2015 10:29 pm

Re: Using Feeds for default settings?

by jwcooper on Mon Apr 03, 2017 3:01 pm

You could do this quite easily. Follow one of our tutorials to save and retrieve data: https://learn.adafruit.com/series/adafruit-io-basics

Create a feed that contains your configuration data, and save it. Then next time you need the data, you can connect to IO, pull the last value, and then disconnect again.

You could save the data as comma delimited in a single feed, or you could use multiple feeds if you didn't need that many configuration options.

jwcooper
 
Posts: 663
Joined: Tue May 01, 2012 9:08 pm

Re: Using Feeds for default settings?

by jacobgarner123 on Mon Jul 02, 2018 6:44 pm

jwcooper wrote:
...you can connect to IO, pull the last value, and then disconnect again.



Can you explain how to do this?

jacobgarner123
 
Posts: 5
Joined: Sat Jun 02, 2018 12:49 pm

Re: Using Feeds for default settings?

by brubell on Tue Jul 03, 2018 10:05 am

jacobgarner123 wrote:
jwcooper wrote:
...you can connect to IO, pull the last value, and then disconnect again.



Can you explain how to do this?


Could you provide the client library you are using (Adafruit IO Arduino, IO Python, raw API calls?) and the board?

Using the Adafruit IO API, you can make a call to previousData to obtain the previous data point in the data feed:
Code: Select all | TOGGLE FULL SIZE
https://io.adafruit.com/api/v2/{username}/feeds/{feed_key}/data/previous

https://io.adafruit.com/api/docs/#opera ... eviousData

Here's an example of getting previous data from the Python client:
https://github.com/adafruit/io-client-p ... ata.py#L46

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

Re: Using Feeds for default settings?

by jacobgarner123 on Fri Jul 06, 2018 12:45 am

Thanks for the reply. I am using a Node MCU V1.0 in the Arduino IDE. I actually ended up just using raw API calls with the ESP8266HTTPClient library, since that makes the most sense to my brain. :)

jacobgarner123
 
Posts: 5
Joined: Sat Jun 02, 2018 12:49 pm

Please be positive and constructive with your questions and comments.