Clear all data points in a feed?

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.
Locked
User avatar
breckymorris
 
Posts: 16
Joined: Wed Feb 06, 2019 11:25 pm

Clear all data points in a feed?

Post by breckymorris »

I've seen a number of posts inquiring about removing all data from a feed but keeping the feed, but I've never seen it answered. Is there a way to do it via GUI or from a command line (via curl, for example)?

It comes up frequently for me - like I make a change to the program and then I have all this stale data and the plot scale is goofy or I move the sensor from testing into 'production' and the same thing happens. Removing the entire feed and recreating it isn't convenient.

Thanks,

Brecky

User avatar
brubell
Learn User Page
 
Posts: 2010
Joined: Fri Jul 17, 2015 10:33 pm

Re: Clear all data points in a feed?

Post by brubell »

Hi Brecky,

There's no way to remove all data from a feed at once. Feed deletion is an API action (https://io.adafruit.com/api/docs/#delete-data-point) and is therefore limited to your account's data rate (30 or 60 data points per minute for IO Free and IO Plus, respectively).

You may want to create a script which uses the delete data point api endpoint (https://io.adafruit.com/api/docs/#delete-data-point) to remove data.

I'll put a feature request in for the devs., it's something I'd like to see too.

- Brent R.

User avatar
alanspearson
 
Posts: 1
Joined: Sat Feb 06, 2021 5:41 pm

Re: Clear all data points in a feed?

Post by alanspearson »

I'd love to have this feature too. I have a feed in which the sensor was not correctly connected for a while and it now has a bunch of invalid data. It is throwing off the charts now, and I'd like to just reset the feed to empty. I could delete the feed but I guess it would probably remove it from my dashboards.

User avatar
stanrock
 
Posts: 19
Joined: Sun Jul 30, 2017 6:00 pm

Re: Clear all data points in a feed?

Post by stanrock »

Found a workaround for clearing all data from a feed. Go to your feeds and delete all of them related to your sketch. Wait for your update period and magically, your feeds will re-appear!

From what I have observed, there is no need to re-create your feeds, them seem to be in the system even after you delete them.

User avatar
brubell
Learn User Page
 
Posts: 2010
Joined: Fri Jul 17, 2015 10:33 pm

Re: Clear all data points in a feed?

Post by brubell »

stanrock wrote:Found a workaround for clearing all data from a feed. Go to your feeds and delete all of them related to your sketch. Wait for your update period and magically, your feeds will re-appear!

From what I have observed, there is no need to re-create your feeds, them seem to be in the system even after you delete them.
The Adafruit IO Arduino library can programmatically create feeds from your sketch, if they do not already exist on your IO account.

User avatar
stanrock
 
Posts: 19
Joined: Sun Jul 30, 2017 6:00 pm

Re: Clear all data points in a feed?

Post by stanrock »

Thats a sweet feature! Gotta love Adafruit.

User avatar
mattcarp
 
Posts: 29
Joined: Sun Jul 10, 2011 7:40 pm

Re: Clear all data points in a feed?

Post by mattcarp »

DItto - I would like this feature, too - to delete all the data in a feed. This should be very easy to implement?

User avatar
mattcarp
 
Posts: 29
Joined: Sun Jul 10, 2011 7:40 pm

Re: Clear all data points in a feed?

Post by mattcarp »

I suppose this Python script will do it:

aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

feed_name = aio.feeds('feed')

data = aio.data('feed')

for d in data:
aio.delete(feed_name.key, d.id)
time.sleep(10) # avoid too many calls to adafruit



(I think a network firewall is preventing me from testing this, but I thought I'd post it to get either an upvote, or to help someone who needs this in the future)

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”