Hi all,
i found a tons of solutions for Sending data to Xively, but now i would like to receive data!
What i want to do? It's very simple (i hope): Open my home gate from Xively!
I'm using Arduino uno with CC3000 Breakout board: anyone else have tried to read data from Xively? i didn't find nothing about this!
Thanks to everyone who want to help me :)
EDIT: i found something on the Xively Site (but i still have some doubts).
i write my request like this in Safari Browser and the result is a page with all the informations of this feed (this is just an example: i get the current value of the kitchenTemperature).
But Now what i have to do for put this result in a String?
CC3000 + Xively : How to Read a Value
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit2
- Posts: 22148
- Joined: Fri Mar 11, 2005 7:36 pm
Re: CC3000 + Xively : How to Read a Value
If it requires SSL you cannot do it - the CC3000 does not have SSL support and Arduino can't do it. Beyond that you may want to ask Xively, as we've never done it
-
- Posts: 15
- Joined: Tue Jul 08, 2014 8:40 am
Re: CC3000 + Xively : How to Read a Value
Where can i find that Xively requires SSL?
If you try that link, it works like this.
The first one is an "http" request and the second is an "https", but the content is equal.
This page contains all the information that i need:
If you try that link, it works like this.
The first one is an "http" request and the second is an "https", but the content is equal.
This page contains all the information that i need:
I just want to copy the bolded text, using the cc30000Client object.{"id":1257980085,"title":"Arduino","private":"true","feed":"https://api.xively.com/v2/feeds/1257980 ... atastreams":[{"id":"Gate-Command","current_value":"4","at":"2014-07-15T12:46:23.423740Z","max_value":"4.0","min_value":"0.0","tags":["Manage Gate"]}],"location":{"name":"FloRoBa House","domain":"physical","lat":44.3294,"lon":7.55762000000004},"product_id":"kJIV5AF2LbhYuBAYgfyY","device_serial":"ZGPRHTH6J2F4"}
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: CC3000 + Xively : How to Read a Value
If the request with HTTP:// works then you would send that and receive the json code returned. You willl then need to parse out the pertinent data.
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: CC3000 + Xively : How to Read a Value
You're going to want to familiarize yourself with Xively's API documentation and write the code to talk to their read API. I took a quick look to see if there are any tutorials for reading with their APIs but unfortunately couldn't find anything. My suggestion would be to see if they have forums or support that might be able to point you to some sample code for reading data.
Looking at their APIs it looks like SSL is not required so it should be possible to read data, however realize it's not secure and mentioned as not recommended by Xively. From their docs it looks like authentication with xively is through a sending a secret API key value, so if you aren't using SSL (like with the cc3000) this key could be exposed to someone sniffing the traffic. Definitely don't run this on a public/unencrypted wifi network.
As far as parsing the data returned and getting the bolded data, it's not fun on an Arduino because there isn't enough memory to load the entire response and search it for the desired output. You'll want to familiarize yourself with C's string functions like searching a string for a substring. Read in chunks of the response and look for a specific identifier like "Gate-Command", then take that as a sign to start grabbing characters until you find a sentinel value after the data you desire, like "max_value". If you haven't done a lot of string processing like this I would start in a higher level language or on your PC so you can iterate more easily until you get something working, then port it to the Arduino. Good luck!
Looking at their APIs it looks like SSL is not required so it should be possible to read data, however realize it's not secure and mentioned as not recommended by Xively. From their docs it looks like authentication with xively is through a sending a secret API key value, so if you aren't using SSL (like with the cc3000) this key could be exposed to someone sniffing the traffic. Definitely don't run this on a public/unencrypted wifi network.
As far as parsing the data returned and getting the bolded data, it's not fun on an Arduino because there isn't enough memory to load the entire response and search it for the desired output. You'll want to familiarize yourself with C's string functions like searching a string for a substring. Read in chunks of the response and look for a specific identifier like "Gate-Command", then take that as a sign to start grabbing characters until you find a sentinel value after the data you desire, like "max_value". If you haven't done a lot of string processing like this I would start in a higher level language or on your PC so you can iterate more easily until you get something working, then port it to the Arduino. Good luck!
-
- Posts: 15
- Joined: Tue Jul 08, 2014 8:40 am
Re: CC3000 + Xively : How to Read a Value
Thanks for your attention!
I'll try to make something on c# language, following your tips.
Thanks a lot!
ps: if it works, i'll post it here :)
Yes, i know: i'm using it just in my home protected wifi. So i hope that is enough secure.tdicola wrote: so if you aren't using SSL (like with the cc3000) this key could be exposed to someone sniffing the traffic. Definitely don't run this on a public/unencrypted wifi network.
I'll try to make something on c# language, following your tips.
Thanks a lot!
ps: if it works, i'll post it here :)
Please be positive and constructive with your questions and comments.