Here’s a bash script that reads feed data from a local instance of emonCMS
and forwards it to emoncms.org via curl.

#!/bin/bash
#
RO_KEY='your-local-emoncms-read-only-apikey'
RW_KEY='your-emoncms.org-read-write-apikey'
#
# change FF to the numerical id of the feed you wish to read data from
#
A=$(curl -s "http://127.0.0.1/emoncms/feed/value.json?id=FF&apikey=$RO_KEY")
B=$(curl -s "http://127.0.0.1/emoncms/feed/value.json?id=FF&apikey=$RO_KEY")
C=$(curl -s "http://127.0.0.1/emoncms/feed/value.json?id=FF&apikey=$RO_KEY") 
#
A=${A//\"} # strip quotes from json string
B=${B//\"}
C=${C//\"}
#
# change NN to the number of the node you want to send data to
#
curl -s "https://emoncms.org/input/post?node=NN&csv=$A,$B,$C&apikey=$RW_KEY" > /dev/null 2>&1
#

get-data.txt (638 Bytes)

Delete the .txt extension, or change it to .sh

1 Like