Skip to content

OTA update with ESP failed, "connection refused" error appeared! #8996

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

Open
nh5701 opened this issue Sep 25, 2023 · 1 comment
Open

OTA update with ESP failed, "connection refused" error appeared! #8996

nh5701 opened this issue Sep 25, 2023 · 1 comment

Comments

@nh5701
Copy link

nh5701 commented Sep 25, 2023

----------------------------- Delete below -----------------------------

"How can I fix the "connection refused" error when using the OTA update feature with the esp kit?",

Platform

  • Hardware: [ESP-12|ESP-01|ESP-07|ESP8285 device|ESP32]
  • Development Env: [Platformio]
  • Operating System: [Ubuntu]

Settings in IDE

  • platform = espressif32
  • board = esp32dev
  • framework = arduino
  • lib_extra_dirs = lib/libesp32
  • monitor_speed = 115200
  • board_build.f_cpu = 240000000L

Problem Description

I have an ota link loaded into String ota_get_urllink = ""; before. For example: https://getOTA update link. On my computer, I can still access that link to download the file, but when using ESP, the DNS domain name cannot be resolved. The "connection refused" phenomenon still occurs from time to time. Many times ESP still downloads files successfully and updates successfully. Please tell me how to handle this problem?
Thank!

MCVE Sketch

#include <Arduino.h>
#include <WiFiClientSecure.h>
String ota_get_urllink = "https://getOTA"; //example link
void update() {
WiFiClientSecure client;
  // WiFiClient client;
  Serial.println("UpdateOTA.....");
 // client.setCACert(rootCACertificate);
  client.setInsecure();
  client.setTimeout(240); //timeout 4 phut
  httpUpdate.setLedPin(LED_BUILTIN_IR, LOW);
  t_httpUpdate_return ret = httpUpdate.update(client, ota_get_urllink);
  switch (ret) {
  case HTTP_UPDATE_FAILED: //ret = 0
    Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s\n", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str());

    break;
  case HTTP_UPDATE_NO_UPDATES: //ret = 1
    Serial.println("HTTP_UPDATE_NO_UPDATES");
    break;

  case HTTP_UPDATE_OK: //ret = 2
    Serial.println("HTTP_UPDATE_OK");
    break;
  }
}

Debug Messages

HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused

HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused
@d-a-v
Copy link
Collaborator

d-a-v commented Nov 4, 2023

There is an updater debug option.

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

2 participants