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.
./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?
Most Users Ever Online: 114
Currently Browsing this Page:
Guest Posters: 1
Administrators: Hans, lee