|
Post by Botletics on Sept 8, 2022 1:48:00 GMT
Sorry, I wasn't saying to actually connect to "https://foo.bar" but to fill in the URL with something like "https://dweet.io"
|
|
|
Post by Botletics on Sept 8, 2022 2:00:51 GMT
OK, I figured it out!!! Please do the following: - Set "SSL_FONA" to 1 in .h file - Download the latest .cpp file from GitHub - Open the unedited LTE_Demo example sketch and change "http://dweet.io" to "https://dweet.io" on line 1035 (under the '2' option) - Upload to the Arduino - Run the 'G' command to enable data connection, then run '2' to send data to dweet.io using SSL. And voila! 😊
|
|
|
Post by aeonpsych on Sept 8, 2022 6:47:43 GMT
quick update: I made a section in my code I could trigger at will to disable/reenable data. The function basically looks like this (pretty much copied from initial setup code):
#if !defined(SIMCOM_3G) && !defined(SIMCOM_7500) && !defined(SIMCOM_7600)
// Disable data just to make sure it was actually off so that we can turn it on
if (!fona.enableGPRS(false)) Serial.println(F("Failed to disable data!"));
int retryData = 0;
// Turn on data
while (!fona.enableGPRS(true)) {
if (retryData > 3) {
Serial.println(F("Failed to enable data."));
break;
}
Serial.println(F("Failed to enable data, retrying..."));
delay(2000); // Retry every 2s
retryData++;
}
Serial.println(F("Enabled data!"));
#endif
Note, I have it to break re-trying to connect data so that it doesn't get stuck in endless loop if it's never able to connect, which would break the rest of my code from even running, which I have it to do other things that don't need data or GPS to function...
Since last posting, nearly exactly 24 hours ago, I have left the device running on a newly uploaded code, still with the changes recommended from previous response:
My code to posting to webhook using original fona.postData("POST", URL, body)) code and the code to post to adafruitio with mqtt using traditional MQTT code, with a fall back to fona.postData code (to adafruit specified webhook url)
The connection to MQTT still does not work on fresh upload/power on, nor after hours, and fallback to fona.postData code works initially, but breaks within 24 hours. The connection to IFTTT webhook works initially, but breaks within 24 hours (just tried it before making this post)
Interesting caveat here: As mentioned, just tested the Posting data before making this update, after almost 24 hours of the program running on fresh upload... The Post failed on all fronts after having it running this long. No MQTT, no adafruit webhook, no IFTTT webhook... Ok, so I triggered the data reset of the code. With nothing else done, and no reset or power cycling of the boards or devices, the WEBHOOK posts to both MQTT and IFTTT worked successfully. (Traditional MQTT still bricked, likely because of the SSL setting for some reason)
It seems to me now that there is some flaw/setting/issue that the data connection breaks for either the sim7000 board, or my ISP (hologram running me on Tmobile) after an undefined amount of idle time (within 24 hours tested), and cycling the data connection fixes this issue (at least for now lol).
|
|
|
Post by aeonpsych on Sept 8, 2022 6:55:02 GMT
OK, I figured it out!!! Please do the following: - Set "SSL_FONA" to 1 in .h file - Download the latest .cpp file from GitHub - Open the unedited LTE_Demo example sketch and change "http://dweet.io" to "https://dweet.io" on line 1035 (under the '2' option) - Upload to the Arduino - Run the 'G' command to enable data connection, then run '2' to send data to dweet.io using SSL. And voila! 😊 I just now seen your posts, I have not yet tried this, I guess it sent to a new page of this thread, and me refreshing, was not seeing them, until I made a new post, which redirected me to the most recent page LOL. Anyways, my most recent test appears to show that the data connection bricks after idling an undefined (currently within a tested 24 hours, but have not seen how fast) amount of time. Recycling the connection by re-triggering the data off/on code from the initial setup/connection part of the code seems to fix the issue (at least until it breaks after a while again). I have only ran 1 test (literally just a few minutes ago after leaving the fresh code upload idling for nearly 24 hours), but it worked. I'm assuming it will keep working like this. I'm a little weary to try changing any of the code now (trying your newest suggestion), as I don't want to change anything now LOL... Just out of curiosity, was there something ELSE changed in the .cpp file since the last time I had downloaded it, that would now make it work? I realize I was using the wrong url with foo.bar, but I even tried using fona.HTTP_connect("https://io.adafruit.com"); and wasn't able to get it to connect.
|
|
|
Post by Botletics on Sept 8, 2022 11:56:26 GMT
So I still need to update the other library functions to use the SSL commands. The one that should work is fona.HTTP_connect(). Currently the SSL option for other functions like TCP and MQTT still try to verify certs. If you want, you could try replacing all the if statements checking if "SSL_FONA is true" in the .cpp file to the if statement in the HTTP_connect() function, which only runs the sslversion and SHSSL=1,"" commands.
|
|
|
Post by Botletics on Sept 8, 2022 11:57:59 GMT
Can you verify that you can send to dweet.io using the LTE_Demo?
|
|
|
Post by aeonpsych on Sept 9, 2022 13:03:17 GMT
Can you verify that you can send to dweet.io using the LTE_Demo? I'm kind of weary to try changing anything atm, since I might have figured out the problem (being that the data connection seems to stop working after a certain amount of time (within 24 hours), and that disabling and re-enabling the data function seems to fix it. TBH, I don't think it was an issue with SSL or HTTPS, I am still sending to NORMAL http IFTTT URL, and if it really was an SSL issue, I don't see how I could even connect at all in the first place (besides some glitch). The only reason I was thinking it was an SSL issue was because I was still seemingly able to post through MQTT, but I think I might have been off on that. After some more testing, I will give it a shot and report back, but I think what is solving my issue is just either having a code method I can call at will with triggers/or timers, to disable and re-enable data every so often. The one thing I do know does have an affect with the SSL is setting it to 1 won't have a working MQTT system, whether with normal adafruit url and port, or with their specified SSL url and port.
|
|
|
Post by aeonpsych on Jun 13, 2023 6:30:03 GMT
So now that ifttt has limited the events you can have on the free plan (to 2), I have needed to switch services, and have been encountering this SSL issue again. I don't remember if I had changed the files and used the different methods, but now that I am willing to try this, it appears that the github repository for the updated code is way different than what I have now... i.e. the libraries are now BotleticsSIM7000.cpp BotleticsSIM7000.h which seems to be that now it is fully on your own custom logic. I don't think what I am running would be directly compatible with the updated repositories, but I want to make sure of this, so I can be prepared to make the changes when/if needed to update my own logic
thanks
|
|
|
Post by Botletics on Jun 14, 2023 1:44:23 GMT
Most of the code you have already should work fine with the new libraries. The main thing I would change in the old code is the "#include" at the top of course. You can now install the library directly from the Arduino IDE Library manager. For SIM7000A with SSL, see the comments under the code for "case '2'" in the LTE_Demo, where you can uncomment some things. Also remember to change "BOTLETICS_SSL" to 1 in the .h file.
|
|
|
Post by aeonpsych on Jun 18, 2023 7:26:50 GMT
ok, finally got time to pull the device and bring it back inside for testing and overhaul. the latest update I put on it broke SMS for some reason.
Anyways, I updated to the botletics sim library, and #include it up top. Changed the variable from modem to fona (which is what my code uses, I figured it would be fastest way to migrate, instead of changing all to modem). Changed the .h file to = 1 for SSL.
when I try to do HTTP_connect() I get a CME error, operation not allowed.
Also, trying to post the old way fona.postData() I've been getting HTTP status error 603 trying to go over https, and then if I turn off redirect HTTPS, I get http 301. This is both before and after migrating my code over.
So far fona.postData() to ifttt has been the only way I could send any data out lol
Edit: So I loaded up the newest lte demo sketch, and tried posting to dweet, without changing anything in code. It works. I then change the .h file ssl to 1, and then change in the lte sketch dweet url to https, instead of http. I get the cme error operation not allowed, and "failed to connect to server..." printout
|
|
|
Post by Botletics on Jun 18, 2023 12:05:05 GMT
SIM7000A or SIM7000G?
|
|
|
Post by aeonpsych on Jun 18, 2023 14:17:40 GMT
sim7000A
|
|
|
Post by Botletics on Jun 18, 2023 14:41:11 GMT
SIM7000A should work with SSL if you follow the comments in the LTE_Demo under case '2'. Please post a screenshot of your serial monitor.
|
|
|
Post by aeonpsych on Jun 18, 2023 22:21:21 GMT
Ok, so I re-uploaded, verified I set SSL to 1, and this is the serial monitor using fresh downloaded LTE demo, no changes, except what I show here in the first image, I change the url to https SO this is what I have usually been seeing in serial monitor. operation not allowed, as well as failed to connect (or whatever else I have in serial print debug) Now here is where it changed, after I tried 2 and 3 more times. It returned HTTP 601 status. Just fyi, this is what I was getting as a status code using the other postdata() method or whatever the method is, or I get a 301 if I try and use the non https link (using the other postdata function, not this one. If I use http link, it posted fine with this current method, last I checked).
|
|
|
Post by aeonpsych on Jun 20, 2023 23:48:30 GMT
would I maybe have to re-flash my shield?
|
|