Open reusables-official opened 2 months ago
@narangmayank please take a look at this new issue. using gsm is important for our use case. ideally I'd like to be able to use both WiFi and GSM. Our codebase has routines to use SSLClients for each one depending on what is available.
Can you try compiling with the following BytebeamArduinoDefines.h
file
#ifndef BYTEBEAM_ARDUINO_DEFINES_H
#define BYTEBEAM_ARDUINO_DEFINES_H
//
// Enable the define as per your connectivity interface
// Make sure you enable only one interface at a time
//
// defines for using the wifi interface
// #define BYTEBEAM_ARDUINO_USE_WIFI
// defines for using the modem interface
#define TINY_GSM_MODEM_SIM7600
#define BYTEBEAM_ARDUINO_USE_MODEM
#if defined(ESP32) || defined(ARDUINO_ARCH_ESP32)
// ESP32 architecture dependent defines
#define BYTEBEAM_ARDUINO_ARCH_ESP32
#define BYTEBEAM_ARDUINO_ARCH_SUPPORTS_FS
#define BYTEBEAM_ARDUINO_ARCH_SUPPORTS_FATFS
#define BYTEBEAM_ARDUINO_ARCH_SUPPORTS_SPIFFS
#define BYTEBEAM_ARDUINO_ARCH_SUPPORTS_LITTLEFS
#define BYTEBEAM_ARDUINO_ARCH_SUPPORTS_SD
// ESP32 architecture dependent includes
#include <FS.h>
#include <FFat.h>
#include <SPIFFS.h>
#include <LittleFS.h>
#include <Preferences.h>
#ifdef BYTEBEAM_ARDUINO_USE_WIFI
#include <WiFi.h>
#include <WiFiUdp.h>
#include <NTPClient.h>
#include <WiFiClientSecure.h>
#include <HTTPUpdate.h>
#endif
#ifdef BYTEBEAM_ARDUINO_USE_MODEM
#include <time.h>
#include <TinyGsmClient.h>
#include <SSLClient.h>
#include "BytebeamHTTPUpdate.h"
#endif
#elif defined(ESP8266) || defined(ARDUINO_ARCH_ESP8266)
// ESP8266 architecture dependent defines
#define BYTEBEAM_ARDUINO_ARCH_ESP8266
#define BYTEBEAM_ARDUINO_ARCH_SUPPORTS_FS
#define BYTEBEAM_ARDUINO_ARCH_SUPPORTS_SPIFFS
#define BYTEBEAM_ARDUINO_ARCH_SUPPORTS_LITTLEFS
#define BYTEBEAM_ARDUINO_ARCH_SUPPORTS_SD
// ESP8266 architecture dependent includes
#include <FS.h>
#include <LittleFS.h>
#include <WiFiClientSecureBearSSL.h>
#include <ESP8266httpUpdate.h>
#include <EEPROM.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <NTPClient.h>
#endif
#endif /* BYTEBEAM_ARDUINO_DEFINES_H */
@narangmayank Yes, updating BytebeamArduinoDefines.h
accordingly does compile the code. However, Bytebeam does not initialize. Are you able to try on your end? I'm confused about what kind of testing you are doing with these example sketches, because in no way would this sketch work as is given that the library does not expose a way to override these variables...
This is my log output:
BytebeamLogger::LOG_ERROR (BytebeamArduino) loop : Bytebeam Client is not Initialized.
BytebeamLogger::LOG_ERROR (BytebeamArduino) loop : Bytebeam Client is not Initialized.
BytebeamLogger::LOG_ERROR (BytebeamArduino) loop : Bytebeam Client is not Initialized.
BytebeamLogger::LOG_ERROR (BytebeamArduino) loop : Bytebeam Client is not Initialized.
BytebeamLogger::LOG_ERROR (BytebeamArduino) loop : Bytebeam Client is not Initialized.
Modem Powered ON
Modem Name : SIMCOM SIM7600G-H
Modem Info : Manufacturer: SIMCOM INCORPORATED Model: SIMCOM_SIM7600G-H Revision: SIM7600G_V2.0.2 IMEI: 862636052593322 +GCAP: +CGSM
SIM is Ready.
Modem Initialized Successfully !
Waiting for network...
success
Network connected
Connecting to apn :
success
GPRS connected
Current Time : 24/04/09,10:51:58-28
BytebeamLogger::LOG_INFO (BytebeamArduino) printArchitectureInfo : * ****************************************************************** *
BytebeamLogger::LOG_INFO (BytebeamArduino) printArchitectureInfo : * Architecture : ESP32 *
BytebeamLogger::LOG_INFO (BytebeamArduino) printArchitectureInfo : * Chip Model : ESP32-S3 *
BytebeamLogger::LOG_INFO (BytebeamArduino) printArchitectureInfo : * CPU Freq : 240 MHz *
BytebeamLogger::LOG_INFO (BytebeamArduino) printArchitectureInfo : * Flash Size : 8 MB *
BytebeamLogger::LOG_INFO (BytebeamArduino) printArchitectureInfo : * Free Heap : 354 KB *
BytebeamLogger::LOG_INFO (BytebeamArduino) printArchitectureInfo : * SDK Version : v4.4.6-dirty *
BytebeamLogger::LOG_INFO (BytebeamArduino) printArchitectureInfo : * ****************************************************************** *
BytebeamLogger::LOG_INFO (BytebeamArduino) readDeviceConfigFile : SPIFFS file system detected !
BytebeamLogger::LOG_INFO (BytebeamArduino) readDeviceConfigFile : Reading file : /device_config.json
BytebeamLogger::LOG_INFO (BytebeamArduino) readDeviceConfigFile : - read from file
BytebeamLogger::LOG_DEBUG (BytebeamArduino) readDeviceConfigFile : deviceConfigStr : {"project_id":"srbv3","broker":"cloud.bytebeam.io","port":8883,"device_id":"1","authentication":{"ca_certificate":etc... }
BytebeamLogger::LOG_INFO (BytebeamArduino) parseDeviceConfigFile : deserializeJson() success
BytebeamLogger::LOG_INFO (BytebeamArduino) parseDeviceConfigFile : Obtaining device config file variables
BytebeamLogger::LOG_INFO (BytebeamArduino) parseDeviceConfigFile : - obtain device config file variables
BytebeamLogger::LOG_DEBUG (BytebeamArduino) parseDeviceConfigFile : mqttPort : 8883
BytebeamLogger::LOG_DEBUG (BytebeamArduino) parseDeviceConfigFile : mqttBrokerUrl : cloud.bytebeam.io
BytebeamLogger::LOG_DEBUG (BytebeamArduino) parseDeviceConfigFile : deviceId : 1
BytebeamLogger::LOG_DEBUG (BytebeamArduino) parseDeviceConfigFile : projectId : srbv3
BytebeamLogger::LOG_DEBUG (BytebeamArduino) parseDeviceConfigFile : caCertPem :
... certs
BytebeamLogger::LOG_DEBUG (BytebeamArduino) parseDeviceConfigFile : clientId : BytebeamClient
BytebeamLogger::LOG_INFO (BytebeamArduino) parseDeviceConfigFile : Project Id : srbv3 and Device Id : 1
BytebeamLogger::LOG_INFO (BytebeamOTA) retrieveOTAInfo : NVS: Retrieving OTA Information
BytebeamLogger::LOG_INFO (BytebeamArduino) initSDK : RESTART: Normal Reboot !
BytebeamLogger::LOG_INFO (BytebeamArduino) setupBytebeamClient : Connecting To Bytebeam Cloud ...
BytebeamLogger::LOG_ERROR (BytebeamArduino) setupBytebeamClient : ERROR
BytebeamLogger::LOG_ERROR (BytebeamArduino) initSDK : Initialization failed, error while connecting to cloud.
Bytebeam Client Initialization Failed.
BytebeamLogger::LOG_ERROR (BytebeamArduino) isConnected : Bytebeam Client is not Initialized.
Bytebeam Client is Disconnected.
BytebeamLogger::LOG_ERROR (BytebeamArduino) loop : Bytebeam Client is not Initialized.
These are my installed libraries:
The same device (esp32) and device configuration json from Bytebeam works over WiFi as per the issue you just closed.
@reusables-official
I'm able to connect and send the data to bytebeam successfully. I've used the following board https://robu.in/product/ttgo-sim7600e-h-module-esp32-wrover-b-chip-wifi-bluetooth-18560-battery-holder-solar-charge-development-board-unsoldered/
Unfortunately, I don't have ESP32-S3 alternative at the moment to test. Can you test with ESP32?
BytebeamLogger::LOG_INFO (BytebeamArduino) parseDeviceConfigFile : deserializeJson() success
BytebeamLogger::LOG_INFO (BytebeamArduino) parseDeviceConfigFile : Obtaining device config file variables
BytebeamLogger::LOG_INFO (BytebeamArduino) parseDeviceConfigFile : - obtain device config file variables
BytebeamLogger::LOG_INFO (BytebeamArduino) parseDeviceConfigFile : Project Id : ota and Device Id : 1
BytebeamLogger::LOG_INFO (BytebeamOTA) retrieveOTAInfo : NVS: Retrieving OTA Information
BytebeamLogger::LOG_INFO (BytebeamArduino) initSDK : RESTART: Normal Reboot !
BytebeamLogger::LOG_INFO (BytebeamArduino) setupBytebeamClient : Connecting To Bytebeam Cloud ...
BytebeamLogger::LOG_INFO (BytebeamArduino) setupBytebeamClient : CONNECTED
BytebeamLogger::LOG_INFO (BytebeamArduino) subscribe : subscribe success, {topic : /tenants/ota/devices/1/actions, qos : 1}
BytebeamLogger::LOG_INFO (BytebeamArduino) publishDeviceHeartbeat : publishing device heartbeat.
BytebeamLogger::LOG_INFO (BytebeamArduino) publish : publish success, {topic : /tenants/ota/devices/1/events/device_shadow/jsonarray, message : [{"timestamp":1712748185671,"sequence":1,"Reset_Reason":"Power On Reset","Uptime":37671,"Status":"Device is Up!","Software_Type":"setup-gsm-client-ino","Software_Version":"1.0.0","Hardware_Type":"ESP32 Dev Module","Hardware_Version":"rev1"}]}
BytebeamLogger::LOG_INFO (BytebeamArduino) initSDK : Bytebeam Client Initialized Successfully !
Bytebeam Client is Initialized Successfully.
Bytebeam Client is Connected.
BytebeamLogger::LOG_INFO (BytebeamArduino) loop : I am BytebeamArduino::loop()
BytebeamLogger::LOG_INFO (BytebeamArduino) loop : I am BytebeamArduino::loop()
BytebeamLogger::LOG_INFO (BytebeamArduino) loop : I am BytebeamArduino::loop()
BytebeamLogger::LOG_INFO (BytebeamArduino) loop : I am BytebeamArduino::loop()
BytebeamLogger::LOG_INFO (BytebeamArduino) loop : I am BytebeamArduino::loop()
BytebeamLogger::LOG_INFO (BytebeamArduino) loop : I am BytebeamArduino::loop()
BytebeamLogger::LOG_INFO (BytebeamArduino) loop : I am BytebeamArduino::loop()
@narangmayank what is it that you want me to test? have you updated the examples? I tried running the tinyGsm example and the output is what I pasted above, no information about why the connection failed.
@reusables-official I tested ESP32 <> SIM7600 and it worked for me. Can you tell me which ESP and Modem you are using?
@reusables-official Are you able to connect to bytebeam?
esp32s3-dekvit-C1 modem: SIMCOM 7600G-H
no I was not able to connected and we ended up using a different provider
@reusables-official Okay. Can you tell me which backend solution you are using now
Board
esp32s3
Device Description
dev kitc1
Arduino-ESP32 Version
latest
Bytebeam Arduino SDK Version
latest
IDE Name
arduino IDE
Operating System
macOs 13.6.6
Problem Description
Running the SetupClient_GSM does not compile. The first error is due to a bad signature for
Bytebeam.begin(&modem)
, which can be resolved by adding:#define BYTEBEAM_ARDUINO_USE_MODEM
to the top of the file.However, the errors (pasted below) cannot be resolved with this line:
#undef BYTEBEAM_ARDUINO_USE_WIFI
and it is unclear how to override the definitions set in
BytebeamArduinoDefines.h
Sketch
Debug Message