Anyway, I created a simple feed of the load averages of my RPi, which runs nothing but the stock raspbian 09-18-2012 image and does nothing but run my little shell script. Eventually I will be using COSM to log current and voltage data from a portable solar generator.
The feed is located here:
https://cosm.com/feeds/82165
Here are the steps I followed if anyone is interested in doing something similar:
1. Created a COSM account
2. Created a COSM feed, "something else", push data to feed
3. Created 3 datastreams in that feed
4. Generated an API key in COSM for the feed with 'update' permissions
5. Wrote a 1 line sed "script" on my RPi to transform /proc/loadavg to JSON format for COSM. I am not sure how this will display, but here is the one line:
Code: Select all
s/\([0-9]*\.[0-9][0-9]\) \([0-9]*\.[0-9][0-9]\) \([0-9]*\.[0-9][0-9]\)\(.*\)/{"datastreams":[ {"id":"5min","current_value":"\1"},{"id":"10min","current_value":"\2"},{"id":"15min","current_value":"\3"} ]}/
Code: Select all
sed -f cosm-test.sed /proc/loadavg > cosm-test.json
curl --request PUT --data-binary @cosm-test.json --header "X-ApiKey: api_key_I_generated_here" http://api.cosm.com/v2/feeds/82165
I just wanted to create a post about it because I have so far found COSM to be pretty easy to use and a nice service.


