Exception regarding data posting on the notehub through notecard

hello,

I’ve been trying to post data on the notehub.io through my esp32 board.
NOTE: I am simply trying to post an integer value on notehub…Here’s my code…

#define productUID “com.tlabglobal.pranav.jasani:teksun_soil_pranav”

Notecard notecard;
int tek;
void setup() {
Serial.begin(115200);

notecard.begin();
notecard.setDebugOutputStream(Serial2);

//configure the notecard
J *req = notecard.newRequest(“hub.set”);
JAddStringToObject(req, “product”, productUID);
JAddStringToObject(req, “mode”, “continuous”);
notecard.sendRequest(req);
tek=21;
}

void loop() {

J *req = notecard.newRequest(“note.add”);
if (req != NULL) {
JAddStringToObject(req, “file”, “sensors.qo”);
JAddBoolToObject(req, “sync”, true);
J *body = JCreateObject();
if (body != NULL) {
JAddNumberToObject(body, “sensordata”, 25.5);
Serial.println(tek);
JAddNumberToObject(body, “humidity”, tek);
JAddItemToObject(req, “body”, body);
delay(1000);

}
notecard.sendRequest(req);

}
}

After flashing this code, I have checked my notehub dashboard and i saw the TLS related exception. I CAN’T SEE ANY DATA.

From my perspective i think that something is going wrong with either my code or the network service provider . If its right, please notify me and guide me further how to resolve this.

THANK YOU.

Hi @Pranav_Patel,

I wasn’t able to get your sketch to compile, so I started a new one from scratch to replicate what you’re trying to do. This works for me just fine:

#include <Notecard.h>

#define serialDebug Serial // for serial debugging
#define productUID "com.xxx.yyy:zzz"

Notecard notecard;
int tek;

void setup() {
  serialDebug.begin(115200);

  // init Notecard
  notecard.begin();
  notecard.setDebugOutputStream(serialDebug);

  J *req = notecard.newRequest("hub.set");
  JAddStringToObject(req, "product", productUID);
  JAddStringToObject(req, "mode", "continuous");
  notecard.sendRequest(req);
  
  tek=21;
}

void loop() {
  J *req = notecard.newRequest("note.add");
  
  if (req != NULL) {
      JAddStringToObject(req, "file", "sensors.qo");
      JAddBoolToObject(req, "sync", true);
      J *body = JCreateObject();
      if (body != NULL) {
          JAddNumberToObject(body, "sensordata", 25.5);
          JAddNumberToObject(body, "humidity", tek);
          JAddItemToObject(req, "body", body);
      }
      notecard.sendRequest(req);
  }

  delay(5000);
}

@RobLauer,

I tried with your code, but I am facing the same issue. Is it because of notecard compatibility with my country’s bandwidth or something else???

You were able to successfully configure the external SIM card previously, correct? If so, the first thing I would check is to connect your Notecarrier to the web REPL at https://dev.blues.io and just type in the sim command. This command will tell you which SIM (internal or external) the Notecard is trying to use. If it returns using internal SIM you’ll know that you need to run through the using external SIM cards guide.

Hello @RobLauer,

-Are you talking about internal sim (which is EG21), if yes then I inform you that in INDIA e-sim is not supported so I inserted external sim.

  • As e-sim is not supported, the device is unable to detect on the notehub dashboard. So when I insert the External sim, the board gets detected.

here’s the screenshot after inserting external sim

Hi @Pranav_Patel, which provider are you using for that external sim? To connect, you’ll need to issue a few commands to the Notehub to let it know which APN to use for your provider. For instance, this post provided details for Airtel: Couldn't connect network using external SIM - #28 by gwolff

Hello @bsatrom I am currently using Vodafone SIM as my external sim

Ok great, you’ll need to determine the correct APN to use with Vodafone via their docs, but once you have it, you can se the apn using the request below. More details here

# set the Airtel APN
{"req":"card.wireless","apn":"[vodafone apn]"}

Where the “[vodafone apn]” string above should be replaced the url for Vodafone’s public apn.