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

Single Command Line Argument to Adafruit IO
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.

Single Command Line Argument to Adafruit IO

by NFarrow on Thu Jan 28, 2016 2:17 am

I thought that the Adafruit IO team might think this is cool. I am running this code on a Raspberry Pi 2. python 2.7

This is how I post data to the Adafruit IO feed. (./FeedPostAdaFruitIO.py 123)
https://github.com/VeggieVampire/AdaFruitIO/blob/master/FeedPostAdaFruitIO.py

Also this is how I read feed data from Adafruit IO.
https://github.com/VeggieVampire/AdaFruitIO/blob/master/ReadAdaFruitIO.py

I do have a small issue when I go check the feed values I see, '123' ticks on the data. Would any Python gurus know how to clean the string? Also note I have tried urllib but with no luck.....

Thanks,
Nick Farrow

Example usage:
So if I wanted to get NOAA's weather station and submit the data to AIO feed, I could do something like this. station KTUL
Code: Select all | TOGGLE FULL SIZE
./FeedPostAdaFruitIO.py $(curl -sS "http://w1.weather.gov/xml/current_obs/display.php?stid=KTUL"|sed -n  '32p'|awk '{print $1$2$3$4$5$6}'|awk -F'[<|>]' '{print $3}'|rev | cut -c 8- | rev)

NFarrow
 
Posts: 7
Joined: Tue Aug 04, 2015 12:27 am

Please be positive and constructive with your questions and comments.