Continues mode - Start & Stop = cannot interpret JSON: unknown combination of addressing mode and dtd datatype for string

Hello,
I am trying to resolve the following bad commands:
Any help or guidance will be appreciated!

C++ code:

bool lte_send(String text){

J *req = notecard.newRequest("hub.set");
JAddStringToObject(req, "start","true");
notecard.sendRequest(req);

req = notecard.newRequest("web.get");
if (req != NULL) {
    JAddStringToObject(req, "route", "weather");
    JAddStringToObject(req, "name", text.c_str());
    notecard.sendRequest(req);
}

//put back to periodic
req = notecard.newRequest("hub.set");
JAddStringToObject(req, "stop","true");
notecard.sendRequest(req);

return true;

}

Notecard responses:

{“req”:“hub.set”,“start”:“true”}
{“err”:“cannot interpret JSON: unknown combination of addressing mode and dtd datatype for string {io}”}
{“req”:“web.get”,“route”:“weather”,“name”:“dateutc=2022-08-08+00%3A28%3A12&tempf=78.46&humidity=45.03&dewptf=58.67&baromin=29.64&winddir=0.00&windspeedmph=nan&rainin=0.00&dailyrainin=0.00&UV=&soilmoisture=&action=updateraw&realtime=1&rtfreq=60”}
{“total”:1}
{“req”:“hub.set”,“stop”:“true”}
{“err”:“cannot interpret JSON: unknown combination of addressing mode and dtd datatype for string {io}”}

@aguerrejoaquin,

It looks like you have a data type mismatch on a couple lines of code. The start and stop arguments are boolean, so on line 2 you’ll need:

JAddBoolToObject(req, "start", true);

Likewise the same with the stop argument at the end.

Hope that helps!
Rob

1 Like

Thanks! Thanks for what I thought. I guess I will need to update the notecard library.
The issue is the function is expecting a String = **J *JAddStringToObject(J *object, const char name, const char string)

It’s a different function actually: JAddBoolToObject (not JAddStringToObject).

1 Like

FYI we just noticed a bug in our docs! The correct syntax for temporarily enabling/disabling continuous mode like you are doing is on and off, (not start/stop).

1 Like

Hello,
it appears to not be working any more. I am not sure whats going on…
debug console:

“req”:“hub.set”,“on”:true}
{}
{“req”:“web.get”,“route”:“weather”,“name”:“dateutc=2022-08-30+17%3A31%3A59&tempf=32.00&humidity=0.00&dewptf=-4.00&baromin=0.00&winddir=0.00&windspeedmph=nan&rainin=0.00&dailyrainin=0.00&UV=&soilmoisture=&action=updateraw&realtime=1&rtfreq=60”}
{“err”:“web operations in continuous mode require being online (hub.set) {not-connected}”}
{“req”:“hub.set”,“off”:true}
{}

Hi @aguerrejoaquin - Are you on the latest version of the Notecard developer firmware (3.4.1)?

Hi Rob!
yes, 3.4.1.15117
I think I may have some issues with the host firmware update… but can’t figure it out yet…

this is the full consol output:

LTE enabled
{“req”:“hub.set”,“product”:“com.hotmail.aguerrejoaquin:estacion_meteorologica”,“mode”:“periodic”,“outbound”:28800,“body”:{“agent”:“note-arduino”,“compiler”:“gcc 5.2.0”,“req_interface”:“i2c”,“cpu_name”:“esp32”}}
{}
{“req”:“dfu.status”,“version”:“{"org":"Tlaloc","product":"WeatherStation","description":"","firmware":"v1.0","version":"1.1.0","built":"Aug 30 2022 13:31:04","ver_major":1,"ver_minor":1,"ver_patch":0,"ver_build":0,"builder":""}”}
{“status”:“successfully downloaded”,“mode”:“ready”,“on”:true,“body”:{“crc32”:2956402775,“created”:1661870981,“firmware”:{“built”:“Aug 30 2022 10:48:19”,“firmware”:“v1.0”,“org”:“Tlaloc”,“product”:“WeatherStation”,“ver_major”:1,“ver_minor”:1,“version”:“1.1.0”},“info”:{},“length”:1206112,“md5”:“d86642da3da25325c80ef2db0542ee5a”,“modified”:1661870981,“name”:“firmware$20220830144941.bin”,“source”:“firmware.bin”,“type”:“firmware”}}
Set date-time: 2022-08-30+17:49:30
{“req”:“hub.set”,“on”:true}
{}
{“req”:“web.get”,“route”:“weather”,“name”:“dateutc=2022-08-30+17%3A49%3A30&tempf=32.00&humidity=0.00&dewptf=-4.00&baromin=0.00&winddir=0.00&windspeedmph=nan&rainin=0.00&dailyrainin=0.00&UV=&soilmoisture=&action=updateraw&realtime=1&rtfreq=60”}
{“err”:“web operations in continuous mode require being online (hub.set) {not-connected}”}
{“req”:“hub.set”,“off”:true}
{}
Going to sleep now

Can you issue a {"req":"card.version"} request? That will tell you the version of the firmware running on the device, in case you’re concerned that the DFU process didn’t complete properly.

thanks. Firmware looks good.

{“req”:“card.version”}
{“version”:“notecard-3.4.1.15117”,“device”:“dev:864475046544663”,“name”:“Blues Wireless Notecard”,“sku”:“NOTE-NBGL-500”,“board”:“1.11”,“api”:3,“body”:{“org”:“Blues Wireless”,“product”:“Notecard”,“version”:“notecard-3.4.1”,“ver_major”:3,“ver_minor”:4,“ver_patch”:1,“ver_build”:15117,“built”:“Jul 29 2022 11:30:03”}}
Set date-time: 2022-08-30+19:40:47

Now I tried to just run in continuous mode for testing, but I have the same result. any thoughts?

Feedback:

{“req”:“hub.set”,“product”:“com.XXX.XXXXX:estacion_meteorologica”,“mode”:“continuous”,“body”:{“agent”:“note-arduino”,“compiler”:“gcc 5.2.0”,“req_interface”:“i2c”,“cpu_name”:“esp32”}}
{}
{“req”:“web.get”,“route”:“weather”,“name”:“dateutc=2022-08-30+19%3A40%3A47&tempf=32.00&humidity=0.00&dewptf=-4.00&baromin=0.00&winddir=0.00&windspeedmph=nan&rainin=0.00&dailyrainin=0.00&UV=&soilmoisture=&action=updateraw&realtime=1&rtfreq=60”}
{“err”:“web operations in continuous mode require being online (hub.set) {not-connected}”}
{“req”:“hub.set”,“product”:“com.XXX.XXXX:estacion_meteorologica”,“mode”:“periodic”,“outbound”:28800,“body”:{“agent”:“note-arduino”,“compiler”:“gcc 5.2.0”,“req_interface”:“i2c”,“cpu_name”:“esp32”}}
{}
Wakeup was not caused by deep sleep: 0
Going to sleep now

Can you try issuing a hub.sync request immediately after setting "on":true in your code?

Same thing:

feedback:

{“req”:“hub.set”,“on”:true}
{}
{“req”:“hub.sync”}
{}
{“req”:“web.get”,“route”:“weather”,“name”:“dateutc=2022-08-30+19%3A54%3A53&tempf=32.00&humidity=0.00&dewptf=-4.00&baromin=0.00&winddir=0.00&windspeedmph=nan&rainin=0.00&dailyrainin=0.00&UV=&soilmoisture=&action=updateraw&realtime=1&rtfreq=60”}
{“err”:“web operations in continuous mode require being online (hub.set) {not-connected}”}
{“req”:“hub.set”,“off”:true}
{}

I’m sorry - in my haste I failed to read the error message more closely. The problem is that you aren’t actively connected to Notehub (but that’s what the hub.sync will help to resolve). After issuing a hub.sync to initiate a connection to Notehub, you’ll need to wait for a hub.status request to return "connected":true.

Here is a quick and dirty example in Python, but the same idea applies to Arduino:

connectedToNotehub = False

while not connectedToNotehub:
    req = {"req": "hub.status"}
    rsp = card.Transaction(req)

    if "connected" in rsp:
        connectedToNotehub = True
    else:
        sleep(1)
1 Like

you guys are the best! thanks

1 Like