Hi,
I have added som support, where the gateway can upload data to emoncms, transparant to other functions (not fully testet):
in gatewayutil add this in top of file, after the ARDUINO check:
#define EMONCMS
#ifdef EMONCMS
static WiFiClient emon_client;
const char* emon_host = "emoncms.org";
const int emon_httpPort = 80;
const int emon_addr_offset = 10;
#endif
Change this function to:
void incomingMessage(const MyMessage &message) {
// if (mGetCommand(message) == C_PRESENTATION && inclusionMode) {
// gw.rxBlink(3);
// } else {
// gw.rxBlink(1);
// }
// Pass along the message from sensors to serial line
serial(PSTR("%d;%d;%d;%d;%d;%s\n"),message.sender, message.sensor, mGetCommand(message), mGetAck(message), message.type, message.getString(convBuf));
#ifdef EMONCMS
if (!emon_client.connect(emon_host, emon_httpPort)) {
Serial.println("emoncms connection failed");
}
emon_client.print(String("GET /emoncms/input/post.json?&node="+ String(message.sender+emon_addr_offset)+"&json={"+String(message.sensor)+":"+message.getString(convBuf)+"}&apikey=XXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n"));
Serial.println(String("GET /emoncms/input/post.json?&node="+ String(message.sender+emon_addr_offset)+"&json={"+String(message.sensor)+":"+message.getString(convBuf)+"}&apikey=XXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n"));
#endif
}
It will upload data with NODE ID and Sensor ID from the network, with an offset of emon_addr_offset...
/Rapzak