We will use that module to implement appropriate telemetry support in order to submit measurement data from the Terkin datalogger to the Kotori data historian using HTTP POST requests as outlined within HTTP - Kotori DAQ.
This is just a first attempt and has not been tested yet. @clemens or @poesel might want to give this a try on one of their TTGO T-Call-SIM800x devices. Thanks again, @sarusso!
Success!
I flashed a T-Call with the uPy 1.12 idf3 binary (idf4 has no PPP and I think we need that here).
Then I synced your github unto the device. I commented the debugging messages back in but apart from that no changes. The pins are already correct.
example_usage()
Starting up...
Modem info: "SIM800 R14.18"
Network scan: "[{'name': 'vodafone', 'shortname': 'voda D2', 'id': '26202'}, {'name': 'D1', 'shortname': 'TMO D', 'id': '26201'}, {'name': 'E-Plus', 'shortname': 'E-Plus', 'id': '26203'}]"
Current network: "E-Plus"
Signal strength: "60.0%"
Modem IP address: "10.179.170.111"
Now running demo http GET...
Response status code: 200
Response content: <html><head><title>Current IP Check</title></head><body>Current IP Address: 5.35.166.143</body></html>
Now running demo https POST...
Response status code: 200
Response content: {"args":{},"data":{"myparameter":42},"files":{},"form":{},"headers":{"x-forwarded-proto":"https","host":"postman-echo.com","content-length":"19","accept":"*/*","content-type":"application/json","user-agent":"SIMCOM_MODULE","x-forwarded-port":"443"},"json":{"myparameter":42},"url":"https://postman-echo.com/post"}
First run was a failure because signal strength was 0%. But it worked on the second.
I have a hologram card and this is the first time it worked!
p.s. I don’t think you need PPP as the communication is entirely serial with the SIM800L, so in theory idf4 should work as well, even if I am not sure what the benefits it would bring.
File "/dist-packages/pythings_sim800.py", line 360, in http_request
File "/dist-packages/pythings_sim800.py", line 173, in execute_at_command
GenericATError: Got generic AT error
Mit diesen Auskommentierungen in pythings_sim800.py
# ..Do we have to enable ssl as well?
if url.startswith('https://'):
logger.debug('Http request step #1.3 (enablessl)')
#self.execute_at_command('enablessl')
elif url.startswith('http://'):
logger.debug('Http request step #1.3 (disablessl)')
#self.execute_at_command('disablessl')
else:
raise Exception('I have no idea how to handle communication protocol for URL "{}"'.format(url))
While it looks like this specific modem firmware does not support SSL at all, I can’t really believe it. However, we might want to investigate by invoking ATI or AT+CGMR.
Datasheet page 35
ATI: Display Product Identification Information
Datasheet page 68
AT+CGMR: Request TA Revision Identification of Software Release
@clemens, did you also try the example_SIM800L.py which worked for @poesel (it formerly was a fn call example_usage()) ? What does this script say on your T-call ?
Your connection to https://swarm.hiveyes.org failed, while https://postman-echo.com/post succeeded on poesel’s tests, which should be investigated first: you both have a TTGO Tcall from the same production run - therefore it’s not very likely that a different firmware in the modem is the reason.
Hmm, is this a hardware issue or can it be updated via firmware?
@poesel you may have a look at the “firmware version” or whatever it is via AT+CGMR I did it with the TinyGSM lib but it should be possible via the pythings code, you may supplement it here:
On my SIM800 R14.18 it works fine.
The other one, SIM800 R13.08 reports that SSL is not supported.
So we should make steps in this direction. Btw. is there a date in SIM800L16_20141031_1027 and has my 2019 device a SIM800 module from 2014-10-31 or does it only look like a date by chance?
@clemens, @poesel: OK, I somehow thought you were buying this within a same order, apparently no: even very different fw versions.
But this is one more reason to switch over to PPP when running on an ESP32 and no longer depend on this old IP stack on the SIM800.
…but sadly only without PPP.
well, this is the only way to overcome the limitations of the inbuilt IP stack of the SIM800L in terms of reasonable transport layer security: this stack only “features” SSL2, SSL3 and TLS 1.0, and the firmware is about six years old. The three mentioned cryptographic protocols are considered deprecated; SSL2 and 3 are dead, TLS 1.0 ist dead by the BEAST attack also since at least six years, within this spring 2020 all major browser will switch off their support for TLS 1.0 (and even TLS 1.1).
Even if one gets a SIM800 fw updated, it then will only be able to run outdated ‘secure’ protocols and ciphers. So there no other chance remains to update to decent security except via PPP usage and having the ESP32 IP stack doing the work. This way, it even doesn’t matter what particular fw a respective SIM800 has, as its ‘secure’ features are simple not used (it simply of course needs PPP support in its fw).