How do I send output from delayed program with API to thingspeak? | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
How do I send output from delayed program with API to thingspeak?
No permission to create posts
September 21, 2017
3:53 pm
Avatar
Duck
New Member
Members
Forum Posts: 1
Member Since:
September 21, 2017
sp_UserOfflineSmall Offline

Hello,

I want to send the output of a program ./airsensor -v to my ThingSpeak account to see the air quality trend. The tool (./airsensor -v) needs ~ 15 seconds to print a number after you hit enter, but it does print out the values continuously every 15 seconds. The sensor is usb connected to a Raspberry Pi.

 

I tried the following two commands, but non of them worked. Can someone correct the commands? I'm very new to all this, as you might see. Confused

./airsensor -v | while read line; do curl -X GET -d "value=$line" "https://api.thingspeak.com/update?api_key=[API-WRITE-KEY]&field1=0" ; done
./airsensor | curl -X POST -d @- https://api.thingspeak.com/update?api_key=[API-WRITE-KEY]&field1=0

What would be the command or script to continuously send the outputs of ./airsensor -v to thingspeak?

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online: James181
28 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

James181, kimberlypg2, JamesAdorb, waynesmith, paulettebw60, ashleytb4

Administrators: Hans: 387, lee: 457