Issue Sending Data to Notehub with ESP8266 and LoRa Notecard: 'template for sensors.qo is not found' Error

I’m using a Feather ESP8266 with a LoRa Notecard and Notecarrier F. While I can successfully connect to the notehub (it shows up under devices), I’m running into an issue when trying to send data to the notehub and I can’t update any new events.

Interestingly, I can send “data” through the website terminal without a problem, but when I try to do it through my Arduino code and the microcontroller, I get this error:

[INFO] {"err":"template for sensors.qo is not found"}

I tried running the pseudo sensor code given on the “Collecting Sensor Data” guide (using C/C++ Arduino), but I get the same error.

Has anyone encountered this issue before, or does anyone know what might be causing this error? Thanks in advance for any insights!

Hey @Dan,

Sorry about this.

You’re getting that error because there’s no template defined for the sensors.qo Notefile, and the Notecard for LoRa requires a template for every Notefile you use.

You can fix it by running this on your Notecard:

{
  "req":"note.template",
  "file":"sensors.qo",
  "port":12,
  "format":"compact",
  "body":{"temp":14.1,"humidity":14.1}
}

Or this in your firmware:

J *req = notecard.newRequest("note.template");
if (req != NULL)
{
  JAddStringToObject(req, "file", "sensors.qo");
  JAddNumberToObject(req, "port", 12);
  JAddStringToObject(req, "format", "compact");
  J *body = JAddObjectToObject(req, "body");
  if (body)
  {
    JAddNumberToObject(body, "temp", 14.1);
    JAddNumberToObject(body, "humidity", 14.1);
  }
  notecard.sendRequest(req);
}

I’m going to get this added to the tutorial itself later this week. Appreciate you reaching out and letting us know.

  • TJ
2 Likes

Great, I’ll give that a try. Thank you