Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep looping sign-in when using with sim7000 (tinygsm) (sim-card instead of wifi) #4

Closed
komkritc opened this issue Sep 2, 2022 · 3 comments

Comments

@komkritc
Copy link

komkritc commented Sep 2, 2022

esp-signer_error

something wrong about the time since the sim7000 cannot sync the time from ntp-time sever.

thank you for great lib & best regards

@komkritc komkritc added bug Something isn't working good first issue Good for newcomers invalid This doesn't seem right wontfix This will not be worked on labels Sep 2, 2022
@stale stale bot removed the wontfix This will not be worked on label Sep 2, 2022
@mobizt
Copy link
Owner

mobizt commented Sep 2, 2022

This library supports only ESP32 and ESP8266 that work on WiFi only.

@mobizt mobizt closed this as completed Sep 2, 2022
@mobizt mobizt removed bug Something isn't working good first issue Good for newcomers invalid This doesn't seem right labels Sep 2, 2022
@domingguss
Copy link
Contributor

domingguss commented Jan 29, 2024

int updateFromGsmTime()
  //Serial.printf("GSM Time: %s\n", modem.getGSMDateTime(DATE_FULL).c_str());
  int     GSMyear = 0;
  int     GSMmonth = 0;
  int     GSMdate = 0;
  int     GSMhours = 0;
  int     GSMminutes = 0;
  int     GSMseconds = 0;
  float   GSMtimezone = 0;
  time_t  GSMUTCtime = 0;

  if (modem.getNetworkTime(&GSMyear, &GSMmonth, &GSMdate, &GSMhours, &GSMminutes, &GSMseconds, &GSMtimezone))
  {
    struct tm s;
    s.tm_sec  = (GSMseconds);
    s.tm_min  = (GSMminutes);
    s.tm_hour = (GSMhours);
    s.tm_mday = (GSMdate);
    s.tm_mon  = (GSMmonth - 1);
    s.tm_year = (GSMyear - 1900);
    GSMUTCtime   = mktime(&s);

    GSheet.setSystemTime(GSMUTCtime);
    time_t now = getTime();

    Serial.printf("GSM Time:    %s",  ctime(&GSMUTCtime));
    Serial.printf("getTime:    %s",  ctime(&now));

    if (GSMUTCtime > 1615155060) {      //  check for valid time, not 1939!
      setenv("TZ", "CET-0CET-0,M3.5.0/02:00:00,M10.5.0/03:00:00", 1);
      tzset();
      struct timeval tv;
      memset(&tv, 0, sizeof(struct timeval));
      tv.tv_sec = GSMUTCtime;
      settimeofday(&tv, NULL);
    }
    return 1;    
  }
  return 0;
}

I'm actually using this with TinyGSM and am ignoring wifi en ethernet on my esp32. I also use the fix from my PR (#27)

i call this function updateFromGsmTime(), and now i get a little further, but I now receive this error:

[3522] Initializing modem...
[3522] ### TinyGSM Version: 0.11.7
[3522] ### TinyGSM Compiled Module:  TinyGsmClientSIM7080
[3836] ### Modem: SIMCOM SIM7080
[3852] Modem Name: SIMCOM SIM7080
[3856] Modem Info: R1951.04
Connecting to apn
[7052] ### Daylight savings time state updated.
[7053] ### Network time and time zone updated.
ESP Google Sheet Client v1.4.3

GSM Time:    Tue Jan 30 00:20:29 2024
getTime:    Tue Jan 30 00:20:29 2024
Token info: type = OAuth2.0 access token, status = on initializing
Token info: type = OAuth2.0 access token, status = on signing
Token info: type = OAuth2.0 access token, status = on exchange request
Token info: type = OAuth2.0 access token, status = error
Token error: code: -4, message: connection lost
Token info: type = OAuth2.0 access token, status = on exchange request
Token info: type = OAuth2.0 access token, status = error
Token error: code: -4, message: connection lost
[..]

Does anyone know what error -4 means? @mobizt maybe?

@mobizt
Copy link
Owner

mobizt commented Feb 1, 2024

@domingguss

It is because of no network detected.

Do you add this macro #define TINY_GSM_MODEM_SIM7080 in this following file?

https://github.com/mobizt/ESP-Google-Sheet-Client/blob/master/src/ESP_Google_Sheet_Client_FS_Config.h

I will check this tomorrow to confirm.

During this time, I'm so busy and sorry for late reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants