Trouble selecting resources in dashboard widget


#1

I have a device connected, and it shows connected in the devices list. However,

  1. I can’t access the API Explorer (it shows is it connected? message).

  2. Trying to add a widget in the dashboard, but after selecting the device, it does not come up with a resource list. This happens randomly. Sometimes, I can and sometimes I can’t.

  3. Previously added widgets are working fine and showing sensor data correctly.

Any idea what is going wrong? This is really hampering our IoT development.

Sam


#2

Hello @samudra_gupta,

We need additional information, please add this parameter in the first line of you code and open a serial port:

#define _DEBUG_

Then copy the [NETWORK] traze and paste it here in order to provide us a way to understand the behavior of your device.

Could be great if you copy here your code too, because it is probably that the problem is just there.

Best


#3

Hi
With DEBUG on, I notice this that whenever I am trying to configure the widget I see the following
[THINGER] Available bytes: 14
[THINGER] Writing bytes: 32 [FAIL]
[THINGER] Expected:32
[THINGER] Wrote:0
[THINGER] Writing bytes: 32 [FAIL]
[THINGER] Expected:32
[THINGER] Wrote:0
[THINGER] Writing bytes: 5 [FAIL]
[THINGER] Expected:5
[THINGER] Wrote:0

Whereas normally when it is regularly transmitting sensor data it gives out the following log

[_SOCKET] Connecting to iot.thinger.io:25200
[_SOCKET] Using secure TLS/SSL connection: no
[_SOCKET] Connected!
[THINGER] Authenticating. User: dm Device: IP01
[THINGER] Writing bytes: 27 [OK]
[THINGER] Authenticated
[THINGER] Writing bytes: 41 [OK]

And occassionally I see this also and the dashboard shows no data when this happens
[THINGER] Available bytes: 29
[THINGER] Writing bytes: 8 [OK]
[THINGER] Writing bytes: 50 [FAIL]
[THINGER] Expected:50
[THINGER] Wrote:0
[THINGER] Writing bytes: 40 [FAIL]
[THINGER] Expected:40
[THINGER] Wrote:0


#4

Hello @samudra_gupta,

need to see the code to try to help you
best


#5

this is the code—the troubles are

  1. Now I go to Device API, I see in_out in there but no textbox to input data or to show output.
    I am using TinyGSM with SIM800L module.

  2. The network log shows the same type of FAIL as I had given earlier in the post.

#define TINY_GSM_MODEM_SIM800
#define _DEBUG_

#include <TinyGsmClient.h>
#include <ThingerTinyGSM.h>
#include <SoftwareSerial.h>
#include <timer.h>
SoftwareSerial gsmChannel(10, 11); //rx, tx
TinyGsm modem(gsmChannel);
ThingerTinyGSM thing("dm", "IP01", "12345678", gsmChannel);
const char apn[]  = "airtelgprs.com";

auto timer = timer_create_default(); // create a timer with default settings
Timer<> default_timer; // save as above

void setup() {
  //new Iot setup
   timer.every(500, da);
   timer.every(1000, ma);

  //BEGIN THE PORTS
  Serial.begin(9600);

  
  for (int i = 0; i < 10; i++) {
    Serial.print(i);
    delay(1000);

  }
  TinyGsmAutoBaud(gsmChannel,9600,9600);


  /*******CHECK CONTACT IS AVAILABLE*****/
  ////////Serial.println("SEARCHING CONTACT..");
  delay(2000);


  //set up thinger
  thing.setAPN(apn, "", "");


  //input controls
     thing["balance"] = [](pson& in, pson& out){
        out["currBalance"] = getBalance(in);
      };

    thing["in_out"] = [](pson& in, pson& out){
    out["sum"] = (int)in["value1"] + (int)in["value2"];
    out["mult"] = (int)in["value1"] * (int)in["value2"];
    };
  
  //set up complete
  //isSetupComplete = true;
  Serial.println("****SET UP NOW COMPLETE***");

}

void loop() {
  // put your main code here, to run repeatedly:
  timer.tick();
  thing.handle();

}

String getBalance(String provider){
  String s = modem.sendUSSD("*123*#");
  Serial.println(s);
  return s;
}

void da(){
  return true;
}

void ma(){
  return true;
}