Multiple Routes / Device

Hi Rob, quick questions about multiple routes for a single device. I have a simple demo app that is using 2 routes, one for each Thingspeak channel that are used to store data collected by the firmware running on the device and uploaded via Notecard. The first route I defined continues to work as expected, but I don’t see the 2nd, newer route being fired (the “Log” tab shows no route events.) Is there something I need to do in the host firmware to identify or otherwise kickoff the execution of this second route, or is this done automagically? In other words, how does Notecard/Notehub know about the route(s) and are they executed sequentially (in which order?) or some other way? Is there a limit on how many routes I can fire/device? Thanks!

Hi @drewcssv,

The routes are fired automatically, so as long as the route itself is enabled and the Note matches parameters specified in the “filters” section, it should absolutely work just like the other one.


Rob, makes sense, but not what’s apparently happening. The note.add in my firmware loads values into the body, and the first route is executed (at some point…not clear when routes are executed or what exactly triggers them…the sync request?) But the second route - very similar to the first except for some different values - doesn’t fire. Here is the code that loads the values into body. Note that all of the values I wish to route are loaded here, some for Route 1, others for Route 2 (I am assuming this is OK…):

 // send data to cloud
    J *req = notecard.newRequest("note.add");
    if (req != NULL) {
        JAddBoolToObject(req, "sync", true);
        JAddStringToObject(req, "file", "env.qo");
        J *body = JCreateObject();
       if (body != NULL) {
            JAddNumberToObject(body, "temperature", senTemp);
            JAddNumberToObject(body, "humidity", senHumid);
            JAddNumberToObject(body, "pm1", PM1_0);
            JAddNumberToObject(body, "pm25", PM2_5);
            JAddNumberToObject(body, "pm10", PM10_0);
            JAddNumberToObject(body, "co2", co2);
            JAddStringToObject(body, "comments", comments);
            JAddStringToObject(body, "icon", icon);
            JAddStringToObject(body, "trackname", trackName);
            JAddStringToObject(body, "user", user);
            JAddItemToObject(req, "body", body);

Here is Route 1:

   "api_key": $thingspeak_Write_Key_A,
   "field1": $round(body.pm1,1),
   "field2": $round(body.pm25,1),
    "field3" : $round(body.pm10,1),
    "field4": $round(body.temperature,1),
    "field5": $round(body.humidity,1),
    "field6": where_lat ? where_lat : tower_lat,
    "field7": where_lon ? where_lon : tower_lon,
    "field8": body.co2

…and here is Route 2:

    "api_key": $thingspeak_Write_Key_C,
    "field1": body.user,
    "field2": where_lat ? where_lat : tower_lat,
    "field3": where_lon ? where_lon : tower_lon,
    "field4": $round(body.pm25,1),
    "field5" : body.trackName,
    "field4": body.icon,
    "field7": body.co2,
    "field8": body.comments

Anything here that might be causing Route 2 to not go? Thanks!

Hi @drewcssv,

If you navigate to the route and click the “Logs” tab, you should be able to see what’s going on (or not) with the 2nd route:


Routes are executed as soon as matching Notes appear in Notehub.


Rob, here’s the log for Route 2:

…and here’s the log for Route 1:

Under EVENTS the green diamond tells me “All Routes Successful”:

Is there another diagnostic I can look at to see what’s going on?