|
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.
|
|