# importing AIO key and username aio = Client('USERNAME', 'CLIENT_AIO') # Add the value 98.6 to the feed 'Temperature'. soumil = aio.feeds('soumil') aio.send_data(soumil.key, 98.6) # Receiving Data from server data = aio.receive('soumil') print('Received value: {0}'.format(data.value)) # Get list of feeds. feeds = aio.feeds() # Print out the feed names: for f in feeds: print('Feed: {0}'.format(f.name)) """ # Create Feed object with name 'Foo'. feed = Feed(name='Foo') # Send the Feed to IO to create. # The returned object will contain all the details about the created feed. result = aio.create_feed(feed) # Delete the feed with name 'Test'. aio.delete_feed('Test') """
# Set to your Adafruit IO username. # (go to https://accounts.adafruit.com to find your username) ADAFRUIT_IO_USERNAME = '******' # Create an instance of the REST client. aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY) # List all of your feeds print("Obtaining user's feeds...") feeds = aio.feeds() print('Feeds: ', feeds) # Create a new feed print("Creating new feed...") feed = Feed(name="PythonFeed") response = aio.create_feed(feed) print("New feed: ", response) # Delete a feed aio.delete_feed(response.key) # Create feed in a group feed = Feed(name="PythonGroupFeed") group_key = "example" print("Creating feed in group %s" % group_key) response = aio.create_feed(feed, group_key) print("New feed: ", response) # Delete a feed within a group print("Deleting feed within group %s" % group_key) aio.delete_feed(response.key)
pgt_len = tup_len = 0 train_arr = [] def time_unit(tu): tu = tu.split(' ') return (int(tu[0].split('-')[0])) * 525600 + (int( tu[0].split('-')[1])) * 43800 + (int(tu[0].split('-')[2])) * 1440 + ( int(tu[1].split(':')[0])) * 60 + int(tu[1].split(':')[1]) while True: setter = 0 pgt = aio_sta.data('station-particular-feeds.pgt') if (len(pgt) - pgt_len) != 0: aio_sta.delete_feed('cbe') aio_sta.create_feed(Feed(name='CBE')) setter += 1 pgt_len = len(pgt) tup = aio_sta.data('station-particular-feeds.tup') if (len(tup) - tup_len) != 0: aio_sta.delete_feed('cbe') aio_sta.create_feed(Feed(name='CBE')) setter += 1 tup_len = len(tup) if setter != 0: for i in pgt: print time_unit(str(datetime.datetime.now())) - time_unit( str(i.value.split(",")[0]))
import json # Set to your Adafruit IO key. # Remember, your key is a secret, # so make sure not to publish it when you publish this code! ADAFRUIT_IO_KEY = 'YOUR_AIO_KEY' # Set to your Adafruit IO username. # (go to https://accounts.adafruit.com to find your username) ADAFRUIT_IO_USERNAME = '******' # Create an instance of the REST client. aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY) # List all of your feeds feeds = aio.feeds() print(feeds) # Create a new feed feed = Feed(name="PythonFeed") response = aio.create_feed(feed) print(response) # List a specific feed feed = aio.feeds(response.key) print(feed) # Delete a feed aio.delete_feed(response.key)