I'm trying to read specific values from the Amazon SQS queue and I've managed to filter the xml I get when I run the Receive Message sketch to get the value I want.
However I'm having issues accessing the value (in this case LED1) and comparing it to a predefined condition.
(This is what I see in the serial monitor
Running ReceiveMessage - Run #1
body
LED1
HTTP_CODE
200
#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information, as described below
int numRuns = 1; // Execution count, so this doesn't run forever
int maxRuns = 10; // Maximum number of times the Choreo should be executed
void setup() {
pinMode(13, OUTPUT);
Serial.begin(9600);
// For debugging, wait until the serial console is connected.
delay(4000);
while (!Serial);
Bridge.begin();
}
void loop() {
if (numRuns <= maxRuns) {
Serial.println("Running ReceiveMessage - Run #" + String(numRuns++));
TembooChoreo ReceiveMessageChoreo;
// Invoke the Temboo client
ReceiveMessageChoreo.begin();
// Set Temboo account credentials
ReceiveMessageChoreo.setAccountName(TEMBOO_ACCOUNT);
ReceiveMessageChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
ReceiveMessageChoreo.setAppKey(TEMBOO_APP_KEY);
// Set Choreo inputs
ReceiveMessageChoreo.addInput("AWSAccountId", "x");
ReceiveMessageChoreo.addInput("AWSAccessKeyId", "x");
ReceiveMessageChoreo.addInput("QueueName", "x");
ReceiveMessageChoreo.addInput("AWSSecretKeyId", "x");
// Identify the Choreo to run
ReceiveMessageChoreo.setChoreo("/Library/Amazon/SQS/ReceiveMessage");
// add an output filter to extract the latest message
ReceiveMessageChoreo.addOutputFilter("body", "//ReceiveMessageResult/Message/Body", "Response");
// Run the Choreo; when results are available, print them to serial
// ReceiveMessageChoreo.addOutputFilter("ReceiveMessageResult", "/Message", "/@Body");
ReceiveMessageChoreo.run();
while (ReceiveMessageChoreo.available()) {
char c = ReceiveMessageChoreo.read();
Serial.print(c);
}
ReceiveMessageChoreo.close();
}
Serial.println("Waiting...");
delay(30000); // wait 30 seconds between ReceiveMessage calls
}