pythings / Drivers

Some drivers for MicroPython
Apache License 2.0
63 stars 22 forks source link

[SIM800] Problems with AT+HTTPSSL commands #3

Closed amotl closed 4 years ago

amotl commented 4 years ago

Dear Stefano,

we are seeing problems invoking the AT+HTTPSSL commands on a specific TTGO T-Call, while it worked on another device. While we are still investigating the issue, we already wanted to share this with you. See also [1].

Invoking AT+CGMR yields firmware revision SIM800L16_20141031_1027 on the device in question.

With kind regards, Andreas.

[1] https://community.hiveeyes.org/t/unlocking-and-improving-the-pythings-sim800-gprs-module-for-micropython/2978/8

cc @ClemensGruber, @poesel

sarusso commented 4 years ago

Very interesting, thank you for sharing. Based on your discussion at [1], and the linked thread [2], my understanding is that on SIM800 version R14.18 it works, while on SIM800 version R13.08 it does not.

We could:

  1. before allowing to run an https request, check if version is >= R14.18 (assuming an ordered versioning system), or
  2. performing the https request and properly handle AT error messages, i.e. following [3], assuming that SIM800 version R13.08 provides a meaningful error message about SSL not being supported (which might not be the case).

[1] https://community.hiveeyes.org/t/unlocking-and-improving-the-pythings-sim800-gprs-module-for-micropython/2978/8 [2] https://github.com/vshymanskyy/TinyGSM/issues/29#issuecomment-328802556 [3] https://m2msupport.net/m2msupport/at-command-to-enable-error-codes/

amotl commented 4 years ago

Dear Stefano,

following 1. would be perfect. If we are on <R14.00 (just guessing here), let's not use AT+HTTPSSL at all. When the user requests a https:// connection, let's raise a NotImplementedError like

raise NotImplementedError("SIM800 does not support AT+HTTPSSL on firmware release <R14.00")

The most important thing would be to make it actually work for non-SSL connections to get at least something out of older hardware out there.

With kind regards, Andreas.

amotl commented 4 years ago

assuming an ordered versioning system

From looking at the discussion within [1], I believe it is not a good choice to use the firmware revision string. We are seeing things like SIM800L16_20141031_1027 (bad, i.e. not SSL capable) vs. 1418B05SIM800L24 (good, i.e. supporting HTTPS) here.

On the other hand, the "modeminfo" string seems to be better suited. Let these examples speak for themselves:

>>> 'SIM800 R13.08' < 'SIM800 R14.18'
True
>>> 'SIM800 R14.18' >= 'SIM800 R14.00'
True

So, we won't even have to parse the numeric version number if SIMCom keeps it that way. Otherwise, the community probably will tell us and we will be able to adjust accordingly.

[1] https://community.hiveeyes.org/t/unlocking-and-improving-the-pythings-sim800-gprs-module-for-micropython/2978

sarusso commented 4 years ago

Thank you Andreas, I agree on the approach. Just merged the PR.

amotl commented 4 years ago

That was quick. Thanks a bunch!