Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Possible to have 3 variables in same 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.
Please be positive and constructive with your questions and comments.

Possible to have 3 variables in same feed?

by akamediasystem on Fri Jan 15, 2016 4:00 pm

Hi, I'm trying to track 3 axes of accelerometer value in one feed.

I'm able to put a string into a feed, but I'm not clear on how to create a feed that accepts 3 values and not one. Is this possible? Or shall I create 3 feeds, one for each dimension?

FWIW, I was closely reading the learn.adafruit.com guide for several days before I happened to discover the "real" API docs here: http://io.adafruit.com/api/docs/ ...it might be helpful to others to amend the guide to point more obviously to the API docs (and my apologies if I missed some obvious references to them)

Thanks!

AKA

akamediasystem
 
Posts: 76
Joined: Tue Apr 30, 2013 1:38 pm
Location: New York

Re: Possible to have 3 variables in same feed?

by jwcooper on Mon Jan 18, 2016 12:33 pm

You'd want to create a group for this. It's essentially creating three feeds, but will be grouped specific for those 3 feeds. You can name the group, etc.

Docs for groups api here:
http://io.adafruit.com/api/docs/#!/Groups/all

Also, thanks for the suggestion. I bolded the link in the learn guide, but we'll figure out a better way to get folks to the right api docs soon.

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

Re: Possible to have 3 variables in same feed?

by akamediasystem on Mon Jan 18, 2016 1:06 pm

Thanks for the reply - especially on a holiday!

I saw the "Groups" feature in the docs (sorry for not mentioning that), but I didn't realize it applied to my issue - if I "group" my three feeds, can I update them all in one network transaction?

I worked around the issue for now by just shoving a concatenated string into one feed that I'll parse on the client side - but long-term, I'd love to be able to graph/display these three variables on a dashboard...

Thanks again!

AKA

akamediasystem
 
Posts: 76
Joined: Tue Apr 30, 2013 1:38 pm
Location: New York

Re: Possible to have 3 variables in same feed?

by jwcooper on Mon Jan 18, 2016 1:22 pm

Yea, you can send them all in a single call to IO.

Send them something like:

Code: Select all | TOGGLE FULL SIZE
{
 "x": 234,
 "y": 23,
 "z": 11
}

To /api/groups/#{groupname}/send

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

Re: Possible to have 3 variables in same feed?

by akamediasystem on Mon Jan 18, 2016 2:49 pm

Thanks again for the reply!

Unfortunately I'm still having trouble writing new values to feeds via the Groups POST interface.

The URL I'm POSTing to:
https://io.adafruit.com/api/groups/fixture2/send

The data payload:
{
"x-fix":149,
"y-fix":117,
"z-fix":252
"x-aio-key":MY_KEY
}

In response, I get a Success message but the values never update. Here's the full success message:
Code: Select all | TOGGLE FULL SIZE
{
    "id":33128,
    "name":"fixture2",
    "key":"fixture2",
    "description":null,
    "source":null,
    "properties":null,
    "source_keys":null,
    "created_at":"2016-01-18T18:29:17.413Z",
    "updated_at":"2016-01-18T18:29:36.022Z",
    "feeds":[
        {
        "id":506976,
        "name":"x-fix",
        "key":"x-fix",
        "unit_type":null,
        "unit_symbol":null,
        "mode":null,
        "history":true,
        "last_value":"0.15088623762130737",
        "last_value_at":"2016-01-16T18:58:04.513Z",
        "created_at":"2016-01-16T16:25:14.832Z",
        "updated_at":"2016-01-18T18:29:24.655Z",
        "last_stream":null
        },
        {
        "id":506978,
        "name":"y-fix",
        "key":"y-fix",
        "unit_type":null,
        "unit_symbol":null,
        "mode":null,
        "history":true,
        "last_value":"0.14370118081569672",
        "last_value_at":"2016-01-16T18:58:04.559Z",
        "created_at":"2016-01-16T16:25:28.967Z",
        "updated_at":"2016-01-18T18:29:30.347Z",
        "last_stream":null
        },
        {
        "id":506979,
        "name":"z-fix",
        "key":"z-fix",
        "unit_type":null,
        "unit_symbol":null,
        "mode":null,
        "history":true,
        "last_value":"9.78126049041748",
        "last_value_at":"2016-01-16T18:58:04.506Z",
        "created_at":"2016-01-16T16:25:49.916Z",
        "updated_at":"2016-01-18T18:29:36.026Z",
        "last_stream":null
        }
    ]
}


...I'm not sure what could be wrong - any thoughts or suggestions would be much appreciated!

AKA

akamediasystem
 
Posts: 76
Joined: Tue Apr 30, 2013 1:38 pm
Location: New York

Re: Possible to have 3 variables in same feed?

by akamediasystem on Mon Jan 18, 2016 2:59 pm

...after a little more experimentation, it seems that the endpoint /api/groups/{groupname}/send only accepts GET requests and not POST requests...

Leaving this here in case anyone else runs up against this.

Thanks again for the quick holiday-weekend help!

AKA

akamediasystem
 
Posts: 76
Joined: Tue Apr 30, 2013 1:38 pm
Location: New York

Re: Possible to have 3 variables in same feed?

by jwcooper on Tue Jan 19, 2016 11:32 am

Interesting, it should accept a POST as well as a GET. Will add it to our list of things to check out.

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

Please be positive and constructive with your questions and comments.