Developer Support Iotic Labs

Print received data


To print data and information from the feeds which this Thing is following in Iotic Space, add this section to your Thing script.


Python logo

def connect_subscriptions(my_thing):
    print("Printing received data")

    # List any feeds or controls you're following
    # Note: 'id' is the feed/control's global point ID (gpid)
    sub_list = my_thing.list_connections()

    for key in sub_list:
        gpid = sub_list[key]['id']
        if sub_list[key]['type'] == R_FEED:
            my_thing.follow(gpid, follow_feed_callback)
        print("Global point ID (GPID):", gpid)

def follow_feed_callback(args):

    # Print data recieved from followed feeds
    print("Received data:", args['data'])


You also need to add the following call to the MAIN section of your script.




Remember, before you can hook your Thing up to code you also need to:


  1. Create a new Iotic Agent in the Space app, and download an .ini file
  2. Assign Things to an Agent
  3. Organise your file directory

By continuing to use the site, you agree to the use of cookies. more information

This website uses cookies via Google Analytics to give you the best browsing experience possible. No personally-identifiable information is collected about you unless you explicitly submit that information on this website. Click "Accept" to continue.