|
Post by Botletics on Jun 26, 2023 23:57:42 GMT
In addition to setting BOTLETICS_SSL to 1 in the .h file and using dweet.io for the URL, you also need to uncomment this line: #if defined(SIMCOM_7000) || defined(SIMCOM_7070) // Use this if you have SIM7000A, especially with SSL and comment out the line above it. It should look like: // #ifdef SIMCOM_7070 // Use this line if you have the SIM7000G because the 1529B01SIM7000G firmware doesn't seem to run the commands below well #if defined(SIMCOM_7000) || defined(SIMCOM_7070) // Use this if you have SIM7000A, especially with SSL And of course, make sure you have a LiPo battery plugged in. I just tried it and it worked for my SIM7000A.
|
|
|
Post by aeonpsych on Jun 27, 2023 5:08:05 GMT
I have the line uncommented, and tried re-running the ltedemo. Enabled data, and then ran this. changing nothing else, but going back to http, I get an http status 200, so it seems to work without https. I have checked it is set to 1 in the .h file as well
|
|
|
Post by Botletics on Jun 27, 2023 18:27:54 GMT
What's your SIM7000A firmware version? Check with "AT+CGMR"
|
|
|
Post by aeonpsych on Jun 28, 2023 1:15:19 GMT
tried running that command through the lte demo and it didn't respond with anything, but luckily, on boot it displays this info automatically... Should be 1351B04SIM7000A_20200824
|
|
|
Post by Botletics on Jun 28, 2023 1:26:56 GMT
So my SIM7000A is actually using the default firmware that it came with, 1351B03SIM7000A. I wonder if it would help if you tried downgrading... 🙃
|
|
|
Post by aeonpsych on Jul 4, 2023 19:09:43 GMT
so we actually had me update to the b03 firmware a while back to try and fix the GPS/Data issue (I think it was on the other forum). I think it turned out that my board was just dropping connection after being idle for too long, and so I solved it (I think) by just resetting the data connection if I tried using the network and it failed, programmatically through code, for the most part, everything seemed to work after that using IFTTT, even though it was apparently not using SSL/HTTPS. The only issue I had was that for some reason, SMS messages could delay sending to the device, possibly related to the data connection needing to be reset for that as well, but did not have it being done in code. I wonder if it was going into sleep somehow, even though, I think I had sleep disabled.
Anyways, I'm in the process of downgrading to b03 again, and will try and give it a test today or throughout this week /end.
I finally found a nice automation service to use for my HTTP requests as well, just need the damn arduino to work lol.
Also, I'm just gonna nuke my libraries, and try and start fresh lol
|
|
|
Post by aeonpsych on Jul 4, 2023 19:48:13 GMT
ok so I started fresh, lte demo startup shows I'm on revision: 1351B03SIM7000A have commented/uncommented code, and SSL = 1 in botletics.h file, trying to send to https://dweet etc.
serial shows "Failed to connect to server..." I have enabled data using G, but it took a few tries, as I was getting errors for "AT+SAPBR=1,1", and returning "Failed to turn on", I ran g to turn off "Failed to turn off" eventually, G runs and doesn't return any status, just:
12:40:08.192 -> G
12:40:08.239 -> ---> AT+CIPSHUT
12:40:08.286 -> <--- SHUT OK
12:40:08.286 -> ---> AT+CGATT=1
12:40:09.785 -> <--- OK
12:40:09.785 -> ---> AT+SAPBR=3,1,"CONTYPE","GPRS"
12:40:09.832 -> <--- OK
12:40:10.069 -> ---> AT+SAPBR=3,1,"APN","hologram"
12:40:10.116 -> <--- OK
12:40:10.209 -> ---> AT+CSTT="hologram"
12:40:10.209 -> <--- OK
12:40:10.255 -> ---> AT+SAPBR=1,1
12:40:10.302 -> <--- OK
12:40:10.302 -> ---> AT+CIICR
12:40:10.349 -> <--- OK
12:40:10.396 -> ---> AT+CNACT=1,"hologram"
12:40:10.443 -> <--- OK
12:40:10.489 -> <--- +APP PDP: ACTIVE
12:41:20.528 -> Modem> 2
12:41:23.866 -> ---> AT+CBC
12:41:23.912 -> <--- +CBC: 0,83,4088
12:41:24.005 -> ---> AT+SHDISC
12:41:24.005 -> <--- ERROR
12:41:24.052 -> ---> AT+CSSLCFG="sslversion",1,3
12:41:24.098 -> <--- OK
12:41:24.145 -> ---> AT+SHSSL=1,""
12:41:24.145 -> <--- OK
12:41:24.193 -> ---> AT+SHCONF="URL","https://dweet.io"
12:41:24.240 -> <--- OK
12:41:24.287 -> ---> AT+SHCONF="BODYLEN",1024
12:41:24.334 -> <--- ERROR
12:41:24.381 -> ---> AT+SHCONF="HEADERLEN",350
12:41:24.428 -> <--- OK
12:41:24.475 -> ---> AT+SHCONN
12:41:24.475 -> <--- ERROR
12:41:24.523 -> ---> AT+SHSTATE?
12:41:24.570 -> <--- +SHSTATE: 0
12:41:24.570 -> Failed to connect to server...
12:41:24.617 ->
12:41:24.617 -> OK
// Format the floating point numbers as needed
dtostrf(temperature, 1, 2, tempBuff); // float_val, min_width, digits_after_decimal, char_buffer
//#ifdef SIMCOM_7070 // Use this line if you have the SIM7000G because the 1529B01SIM7000G firmware doesn't seem to run the commands below well
#if defined(SIMCOM_7000) || defined(SIMCOM_7070) // Use this if you have SIM7000A, especially with SSL
// Add headers as needed
// modem.HTTP_addHeader("User-Agent", "SIM7070", 7);
// modem.HTTP_addHeader("Cache-control", "no-cache", 8);
// modem.HTTP_addHeader("Connection", "keep-alive", 10);
// modem.HTTP_addHeader("Accept", "*/*, 3);
// Connect to server
// If https:// is used, #define BOTLETICS_SSL 1 in Botletics_modem.h
if (! modem.HTTP_connect("https://dweet.io")) {
Serial.println(F("Failed to connect to server..."));
break;
}
// GET request
// Format URI with GET request query string
sprintf(URL, "/dweet/for/%s?temp=%s&batt=%i", imei, tempBuff, battLevel);
modem.HTTP_GET(URL);
// POST request
/*
sprintf(URL, "/dweet/for/%s", imei); // Format URI
// Format JSON body for POST request
// Example JSON body: "{\"temp\":\"22.3\",\"batt\":\"3800\"}"
// sprintf(body, "{\"temp\":\"%s\",\"batt\":\"%i\"}", tempBuff, battLevel); // construct JSON body
// modem.HTTP_addHeader("Content-Type", "application/json", 16);
modem.HTTP_addPara("temp", "23.4", 5); // Test value
modem.HTTP_addPara("batt", "4120", 5); // Test value
modem.HTTP_POST(URL, body, strlen(body));
*/ Edit (network/device status ):
12:54:31.854 -> Modem> i
12:54:33.217 -> ---> AT+CSQ
12:54:33.264 -> <--- +CSQ: 27,99
12:54:33.264 -> RSSI = 27: -60 dBm
12:54:33.311 -> Modem> n
12:54:43.640 -> ---> AT+CGREG?
12:54:43.687 -> <--- +CGREG: 0,5
12:54:43.687 -> Network status 5: Registered roaming
12:54:43.733 -> Modem> 1
12:54:47.907 -> ---> AT+CPSI?
12:54:48.050 -> <--- +CPSI: LTE CAT-M1,Online,310-410,0x800B,123122192,85,EUTRAN-BAND12,5110,3,3,-10,-86,-59,13
12:54:48.145 -> ---> AT+COPS?
12:54:48.192 -> <--- +COPS: 0,0,"AT&T Hologram",7
12:54:48.192 -> Modem> L
12:55:05.660 -> ---> AT+CGNSINF
12:55:05.707 -> <--- +CGNSINF: 1,0,,,,,,,0,,,,,,3,,,,26,,
12:55:05.753 -> Modem>
Maybe I just need a new sim shield, some defective on here, or maybe defective antenna. IDK, I'm just shooting in the dark at this point, since A fresh clean install should replicate your results. Don't see why not.
|
|
|
Post by Botletics on Jul 5, 2023 18:04:56 GMT
Please shoot me an email, botletics at gmail dot com. I'll get you another board.
|
|
|
Post by aeonpsych on Jul 14, 2023 3:51:59 GMT
Update to any who might encounter similar issues... Turns out my sim shield just did not work with the SSL/HTTPS features. Not sure why, but got a replacement board that was verified working with this feature... In order to post using HTTPS/SSL: Define the SSL code in the .h source file to 1 Use .HTTP_connect("https:/url.com"); sprintf(URL, "/restofpostingurladdressaftercomofbaseaddress"); //note URL is char URL[200]; setup similar to lte demo... Also note URL has a max length! (Think it is 64 characters, not exactly sure, it's in the sim documentation) If you exceed the length, it will error out and not work.
In order to send JSON formatted data in the body of the payload: .HTTP_addHeader("Content-Type", "application/x-www-form-urlencoded", 64); //necessary to preserve format as JSON //addPara was the only way I could get the code to post successfully WITH body content in the payload. SHBOD, etc didn't work. .HTTP_addPara("value1", value1, 64); // ("Key","value", maxlength in bytes of value)
.HTTP_addPara("value2", value2, 64);
.HTTP_addPara("value3", value3, 64);
That will format your data to your post url similar to, where each addPara seems (haven't verified) to add a new array entry key/value pair under body in JSON field. Then you simply post to the url: .HTTP_POST(URL, body, 29); //NOTE the body here actually doesn't seem to matter. It doesn't seem to post it anywhere, the previous addPara is what adds to the body Note: In my application, I am sending JSON payload in body through HTTPS url to a webhook receiver tool. The image above is a screenshot from the receiver running this code with a successful post. I am then able to parse the JSON payload for my own purposes, and use the webhook receiver platform/tool to then send data elsewhere if needed. screenshot of the webhook receiver platform sending the data from value1 to my discord (actual from these screenshots), with additional information programmatically added: Much appreciation for botletics to help diagnose issues with this! Edit: You don't need to mess with or deal with certs, either.
|
|