Hey all, first post in the forum here. Enjoying Thinger so far and have connected my test device via WiFi without issue and am excited to build this into our production codebase.
I am using PlatformIo in VSCode for an IDE and I have two issues at the moment, one is more practical and the other conceptual.
Practically: we are using an ESP32-S3-DevKit-C1 board with a SIMCOM7600G-H modem for GSM connectivity over HardwareSerial. Additionally, because this gsm module does not support SSL natively, I use SSLClient to setup our HTTP clients for handling network requests.
On top of that, we aim to use both WiFi and GSM, falling back to WiFi if our LTE connection is unavailable.
On to my questions, at the moment, I have included the necessary library files to connect to Thinger over GSM, but cannot compile. This is the error message:
In file included from src/main.cpp:8:
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerTinyGSM.h:136:5: error: 'TinyGsmClientSecure' does not name a type; did you mean 'TinyGsmClient'?
TinyGsmClientSecure client_;
^~~~~~~~~~~~~~~~~~~
TinyGsmClient
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerTinyGSM.h: In constructor 'ThingerTinyGSM::ThingerTinyGSM(const char*, const char*, const char*, Stream&)':
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerTinyGSM.h:37:23: error: 'Client& ThingerClient::client_' is private within this context
ThingerClient(client_, user, device, device_credential),
^~~~~~~
In file included from .pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerWifi.h:27,
from .pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerESP32.h:32,
from src/main.cpp:2:
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerClient.h:571:13: note: declared private here
Client& client_;
^~~~~~~
In file included from src/main.cpp:8:
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerTinyGSM.h:39:9: error: 'Client& ThingerClient::client_' is private within this context
client_(modem_)
^~~~~~~
In file included from .pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerWifi.h:27,
from .pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerESP32.h:32,
from src/main.cpp:2:
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerClient.h:571:13: note: declared private here
Client& client_;
^~~~~~~
In file included from src/main.cpp:8:
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerTinyGSM.h:39:9: error: class 'ThingerTinyGSM' does not have any field named 'client_'
client_(modem_)
^~~~~~~
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerTinyGSM.h: In member function 'TinyGsmClient& ThingerTinyGSM::getTinyGsmClient()':
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerTinyGSM.h:110:16: error: 'Client& ThingerClient::client_' is private within this context
return client_;
^~~~~~~
In file included from .pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerWifi.h:27,
from .pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerESP32.h:32,
from src/main.cpp:2:
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerClient.h:571:13: note: declared private here
Client& client_;
^~~~~~~
In file included from src/main.cpp:8:
.pio/libdeps/esp32-s3-devkitc-1/thinger.io/src/ThingerTinyGSM.h:110:16: error: invalid initialization of reference of type 'TinyGsmClient&' {aka 'TinyGsmSim7600::GsmClientSim7600&'} from expression of type 'Client'
return client_;
These are the relevant include directives from main.cpp
#define HAVE_HWSERIAL1
#include <ThingerESP32.h>
#define TINY_GSM_MODEM_SIM7600
#define TINY_GSM_RX_BUFFER 1024
#include <TinyGsmClient.h>
#include <ThingerTinyGSM.h>
#include <ThingerESP32OTA.h>
#include <Arduino.h>
#include <ArduinoJson.h>
#include <ArduinoHttpClient.h>
#include "SSLClient.h"
#ifdef NETWORK_MODE_LTE
HardwareSerial gsmSerial(1);
TinyGsm modem(gsmSerial);
TinyGsmClient gsmClient(modem, 0);
SSLClient secure_layer_lte(&gsmClient);
HttpClient lte_ssl_client = HttpClient(secure_layer_lte, API_HOST, PORT);
ThingerTinyGSM gsmthing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, gsmSerial);
ThingerESP32OTA ota(gsmthing);
gsmSerial.begin(BAUD_RATE, SERIAL_8N1, LTE_RX, LTE_TX, false);
secure_layer_lte.setCACert(api_root_ca);
modem.init();
modem.setNetworkMode(38);
modem.waitForNetwork();
#endif
I’m wondering because I know the SIM7600 module is not listed in the example sketch for GSM, perhaps this is not a supported module? I tried just to see switching to SIM900 but the same error.
More conceptually, what I would like to do is simply provide clients to Thinger so that I can handle setting up WiFi and GSM clients myself with SSL and not have the Thinger library itself managing the modem connection. Has anyone attempted this or know if it would be possible? What we are really going for is for our connection to Thinger to happen over GSM or WiFi depending on the state of our application (ie: LTE is connected? if not, try WiFi).
I read through the discussion at Connect to thinger.io via GPRS module (done) to get some context but so far no luck getting just GSM to work with Thinger, as per my errors above. I think if I could get the connection going, I could figure out a way with config variables to choose a routine based on the active connection type.
Thanks for reading and happy to clarify further or provide more samples. Here is our platform.ini file:
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
lib_deps =
thinger.io
bblanchon/ArduinoJson@7.0.3
vshymanskyy/TinyGSM@0.11.7
makuna/NeoPixelBus@2.7.8
arduino-libraries/ArduinoHttpClient@0.6.0
digitaldragon/SSLClient@1.1.8