FOTA(HTTP) update from dropbox or google drive?

When you have the bin file on GitHub is it one that was created as a NodeMCU or is it with Generic / WeMos? Needs to be NodeMCU.

Do you know the size of your Free Heap?

strange why its not working for
thanks anyway costa

I am guessing your Free Heap will be big enough from the data you provided but add this to setup() and let me know what it comes back with:

Serial.printf("ESP Free Heap: %d bytes\n", ESP.getFreeHeap());

I normally have around 29K Free but I added some “heavy stuff” that took it down to 22K and received a stack error when I did an update this morning. The stack error might not be directly related to Free Heap but having removed the heavy stuff the stack error has disappeared and https updates are back working.

Below is my Serial Monitor for a successful update. I will do a few more to see if the rst cause and boot mode data is consistent.

Server OK at: 13:38:54
Server OK at: 13:39:24
Checking for updates... 

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
@cp:0
ld

Starting
{"blynk_token":"cdd.............................

ESP Free Heap: 35072 bytes

35K should be fine.

Done a few more updates and Serial Monitor is identical each time.

strange why its not working for
thanks anyway costa

small update
i performed the FOTA update with the basic ESPHTTPUPDATE and everything works perfectly
but when i am trying to update with my script as soon as it recieves the update command it resets and not downloading and updating the software

here is my fool script:

#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <SimpleTimer.h>
#include <SPI.h>
#include "SSD1306.h"
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
WidgetRTC rtc;
WidgetTerminal terminal(V2);
SimpleTimer timer;

char auth[] = "???"; //insert here your token generated by Blynk

#define ONE_WIRE_BUS D1 //GPIO5

char Version[] = "1.0.8";

volatile int relay1 = 13;
const int interruptPin = 15;
const int interruptPin1 = 12;
const int interruptPin2 = 4;    
int relayVButton30 = 0;
int relayVButton45 = 0;
int relayVButton60 = 0;
volatile unsigned long debouncing_time = 250000; //Debouncing Time in Microseconds
volatile unsigned long last_micros=0;
volatile int relayState = LOW;
volatile unsigned long t1=0;
volatile int timerState = 0;
volatile int ONInterruptHappend=0;
volatile int OFFInterruptHappend=0;
unsigned long reset_time=2100000000;
float temperature;
int connectionstatus=0;
int timerId;
volatile int k;
volatile int CountdownTime;
unsigned long DisplayPeriod=1; //period time in minutes
int StartHour=99;
int StartMinute=99;
int StartSecond=99;
int StopHour=99;
int StopMinute=99;
int StopSecond=99;
int WeekDays[7]={0,0,0,0,0,0,0};
bool isFirstConnect = true;
int connectiontime=1;
int uphour;
int upminute;
int upday;
int upmonth;
int upyear;

int lastONhour=0;
int lastONminute=0;
int lastONday=0;
int lastONmonth=0;
int lastONyear=0;
int lastOnperiod=0;




OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
WidgetLED led1(11); //virtual led 
// Initialize the OLED display using Wire library
SSD1306  display(0x3c, D3, D5);

void setup() {
  Serial.printf("ESP Free Heap:   %d bytes\n", ESP.getFreeHeap());
  display.init();
  display.flipScreenVertically();
  display.setFont(ArialMT_Plain_24);
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  Serial.setDebugOutput(true);
 //Serial.begin(115200); // See the connection status in Serial Monitor
 //Serial.printf("ESP Free Heap:   %d bytes\n", ESP.getFreeHeap());
 
//Blynk.begin(auth, "oleg", "cde32wsx"); //insert here your SSID and password
Blynk.config(auth);
//WiFi.begin("olegp", "0544792871");  
WiFi.begin("oleg", "cde32wsx");  
pinMode(relay1, OUTPUT);
pinMode(interruptPin, INPUT);
pinMode(interruptPin1, INPUT);
pinMode(interruptPin2, INPUT);
attachInterrupt(digitalPinToInterrupt(interruptPin), debounceInterrupt, RISING);
attachInterrupt(digitalPinToInterrupt(interruptPin1), debounceInterrupt1, RISING);
attachInterrupt(digitalPinToInterrupt(interruptPin2), debounceInterrupt2, RISING);
rtc.begin();
 DS18B20.begin();
 timer.setInterval(1000L, SendTemp);
 timerId=timer.setInterval(60000L*DisplayPeriod, Countdown); 
 timer.disable(timerId); 
 timer.setInterval(5000L, CheckTimeInput);
}




void displayinfo(float t, int relayState, int timerState)
{ 
  
  display.clear();
  if(WiFi.status() == WL_CONNECTED){
  if (t==-127||t==85)
  {
  display.drawString(0, 0, "no sensor @");
  }
  else
  {
  display.drawString(0, 0, String(t,1) + " C  @");
  }
  }

  
 if(WiFi.status() != WL_CONNECTED){
  if (t==-127.00||t==85)
  {
  display.drawString(0, 0, "no sensor x");
  }
  else
  {
  display.drawString(0, 0, String(t,1) + " C  x");
  }
  }

  if (timerState>0&&relayState==HIGH)
  {
  display.drawString(0, 32, String(timerState)+ " min ON");   
  }

  else if (timerState==0 && relayState==LOW)
  {
  display.drawString(0, 32, "Boiler OFF"); 
  }
  else 
  {
  display.drawString(0, 32, "WRONG"); 
  }   
}


void SendTemp()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V4, String(temperature,1));
}

void Countdown()
{
 
 Blynk.virtualWrite(V3, "ON"+String(CountdownTime)+"-" + String(k*DisplayPeriod) +" min left");
 k--; 
}



float getTemperature() {
  float temp;

    DS18B20.requestTemperatures(); 
    temp = DS18B20.getTempCByIndex(0);
    delay(100);

  return temp;
}

BLYNK_CONNECTED() {
  if (isFirstConnect) {
    // Request Blynk server to re-send latest values for all pins
    Blynk.syncVirtual(V10);
    rtc.begin();
  
   

    isFirstConnect = false;
  }

}

BLYNK_WRITE(V2)
{

  // if you type "Marco" into Terminal Widget - it will respond: "Polo:"
  if (String("variable") == param.asStr()) {
    terminal.print("StartHour ") ;
    terminal.println(StartHour) ;
    terminal.print("StartMinute ") ;
    terminal.println(StartMinute) ;
    terminal.print("CurrentHour ") ;
    terminal.println(hour()) ;
    terminal.print("CurrentMinute ") ;
    terminal.println(minute()) ;
    terminal.print("timerState ") ;
    terminal.println(timerState) ;
    terminal.print("relayState ") ;
    terminal.println(relayState) ;
   
  }
  else if (String("reset") == param.asStr()) {
  terminal.println("Reset innitiated") ;
  terminal.flush();
  ESP.reset();  
  }
   else if (String("restart") == param.asStr()) {
  terminal.println("Restart innitiated") ;
  terminal.flush();
  ESP.restart();  
  }
   else if (String("version") == param.asStr()) {
   terminal.println(Version);
  }
   else if (String("startTime") == param.asStr()) {
   terminal.print("Connected at: ");
   terminal.print(uphour);
   terminal.print(":");
   terminal.print(upminute);
   terminal.print(" ");
   terminal.print(upday); 
   terminal.print("/");
   terminal.print(upmonth);
   terminal.print("/");
   terminal.println(upyear);
  }
  else if (String("lastOn") == param.asStr()) {
   terminal.print("Last powered ON: ");
   terminal.print(lastONhour);
   terminal.print(":");
   terminal.print(lastONminute);
   terminal.print(" ");
   terminal.print(lastONday); 
   terminal.print("/");
   terminal.print(lastONmonth);
   terminal.print("/");
   terminal.print(lastONyear);
   terminal.print(" ");
   terminal.print("for ");
   terminal.print(lastOnperiod);
   terminal.print(" ");
   terminal.println("minutes");
  }
 else if (String("commadsList") == param.asStr()) {
   terminal.println("1. variable-list of variables");
   terminal.println("2. reset");
   terminal.println("3. restart");
   terminal.println("4. version-current software version");
   terminal.println("5. startTime-first start time of the ESP");
   terminal.println("6. lastOn-last active time & period");
   terminal.println("7. update-currently not available");
   terminal.println("8. commandsList");
  }

  else if (String("update") == param.asStr()) {
    //wdt_disable();
     //terminal.println("Updating...") ;
     //terminal.flush();
   
        t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/opbeer/cxbcvx/master/Blink.bin","","CC AA 48 48 66 46 0E 91 53 2C 9C 7C 23 2A B1 74 4D 29 9D 33");
       
        switch(ret) {
            case HTTP_UPDATE_FAILED:
                //terminal.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
                //terminal.flush();
                break;

            case HTTP_UPDATE_NO_UPDATES:
                //terminal.println("HTTP_UPDATE_NO_UPDATES");
                //terminal.flush();
                break;

            case HTTP_UPDATE_OK:
                //terminal.println("HTTP_UPDATE_OK");
                //terminal.flush();
                break;
        }
        }
  
  else {

   
    terminal.println("Wrong command");
  
  }

  // Ensure everything is sent
  terminal.flush();
}





BLYNK_WRITE(V10)
{
TimeInputParam t(param);

StartHour=t.getStartHour();
StartMinute=t.getStartMinute();
StopHour=t.getStopHour();
StopMinute=t.getStopMinute();
StartSecond=t.getStartSecond();
StopSecond=t.getStopSecond();
 
 for (int i = 1; i <= 7; i++) {
 if (t.isWeekdaySelected(i)) {
    WeekDays[i-1]=1;     
    }
  else
  WeekDays[i-1]=0;  
   }
  
if((StartHour==6&&StartMinute==28&&StartSecond==15)||(StopHour==6&&StopMinute==28&&StopSecond==15))
  {

StartHour=99;
StartMinute=99;
StopHour=99;
StopMinute=99;
StartSecond=99;
StopSecond=99;
WeekDays[0]=0;
WeekDays[1]=0;  
WeekDays[2]=0;  
WeekDays[3]=0;  
WeekDays[4]=0;  
WeekDays[5]=0;  
WeekDays[6]=0;     
  }
}



void CheckTimeInput(){

  if(StartHour!=99&&StartMinute!=99){
    if(StartHour==hour()&&StartMinute==minute()){
      for (int i = 0; i <= 6; i++){
        if(WeekDays[i]==1&&((i==(weekday()-2)||(i==weekday()+5)))){
        if(timerState==0 && relayState==LOW){
        relayState=HIGH;    
         t1=millis();
         timerState=60*(StopHour-StartHour)+(StopMinute-StartMinute);
          digitalWrite(relay1, relayState);
           led1.on();
            ONInterruptHappend=timerState;
            Blynk.virtualWrite(V3, "ON "+String(ONInterruptHappend)+" min");
            break;       
    } 
        
      }
      }
    }
  }
}




BLYNK_WRITE(V5)
{
  // Get the state of the VButton
  relayVButton30 = param.asInt();
    if(relayVButton30 == 5){
   if(timerState==0 && relayState==LOW){
    relayState=HIGH;    
    t1=millis();
    timerState=30;
    digitalWrite(relay1, relayState);
    led1.on();
    ONInterruptHappend=30;
    Blynk.virtualWrite(V3, "ON "+String(ONInterruptHappend)+" min");       
    }
    else{
    relayState=LOW;
     timerState=0;
     digitalWrite(relay1, relayState);
     led1.off();
     OFFInterruptHappend=1;   
    }
  }
}
BLYNK_WRITE(V6)
{
  // Get the state of the VButton
   relayVButton45 = param.asInt();
   if(relayVButton45 ==5){
   if(timerState==0 && relayState==LOW){
    relayState=HIGH;   
    t1=millis();
    timerState=45;
    digitalWrite(relay1, relayState);
    led1.on();
    ONInterruptHappend=45;
    Blynk.virtualWrite(V3, "ON "+String(ONInterruptHappend)+" min");     
    }
    else{
    relayState=LOW;
     timerState=0;
     digitalWrite(relay1, relayState);
     led1.off();
     OFFInterruptHappend=1; 
     
    }
  }
}
BLYNK_WRITE(V7)
{
  // Get the state of the VButton
  relayVButton60 = param.asInt();
   if(relayVButton60 ==5){
   if(timerState==0 && relayState==LOW){
    relayState=HIGH;
     
    t1=millis();
    timerState=60;
    digitalWrite(relay1, relayState);
    led1.on();
    ONInterruptHappend=60;
    Blynk.virtualWrite(V3, "ON "+String(ONInterruptHappend)+" min");     
    }
    else{
     relayState=LOW;
     timerState=0;
     digitalWrite(relay1, relayState);
     led1.off();
     OFFInterruptHappend=1; 
    }
  }
}




void loop() {
    temperature = getTemperature();    
    displayinfo(temperature,relayState,timerState);
    display.display();
    
  if(!Blynk.connected()){
  connectionstatus=1; 
   }
  if((connectionstatus==1)&&(Blynk.connected())){
  connectionstatus=0;
  if(relayState==LOW){
  led1.off();
  Blynk.virtualWrite(V3, "OFF"); 
  timer.disable(timerId);
 }
 if(relayState==HIGH){
 led1.on();
 Blynk.virtualWrite(V3, "ON "+String(timerState)+" min");
}  
  }

    Blynk.run();
    timer.run();
  // put your main code here, to run repeatedly:

 //DEBUG 
 /*Serial.println(relayState);
 delay(500);*/
 
 if((millis()>reset_time)&&(relayState==LOW)){
   ESP.restart(); 
   }
   
 if(micros()< last_micros){
   last_micros=0; 
   }


if(connectiontime!=0&&hour()!=0&&minute()!=0){
   uphour=hour();
   upminute=minute();
   upday=day();
   upmonth=month();
   upyear=year();
   connectiontime=0; 
}







 
  if (timerState>0&&relayState==HIGH){
  if((unsigned long)(millis() - t1) >= (timerState*60000)){
    relayState=LOW;
    timerState=0;
    digitalWrite(relay1, relayState);
    led1.off();
    Blynk.virtualWrite(V3, "OFF");
    timer.disable(timerId);
  }
 }



if(ONInterruptHappend>0){
lastONhour=hour();
lastONminute=minute();
lastONday=day();
lastONmonth=month();
lastONyear=year();
lastOnperiod=ONInterruptHappend;
  k=(ONInterruptHappend/DisplayPeriod)-1;
  CountdownTime=ONInterruptHappend;
  timer.enable(timerId);
  timer.restartTimer(timerId);
  led1.on();
  Blynk.virtualWrite(V3, "ON "+String(ONInterruptHappend)+" min");
  Blynk.notify("Boiler ON for " + String(ONInterruptHappend) + " min");
  ONInterruptHappend=0;
  OFFInterruptHappend=0;
}


if(OFFInterruptHappend>0){
  timer.disable(timerId);
  led1.off();
  Blynk.virtualWrite(V3, "OFF");
  timer.disable(timerId);
  ONInterruptHappend=0;
  OFFInterruptHappend=0;
}
   

}

void debounceInterrupt() {
 if((micros() - last_micros) >= debouncing_time) {
  if(timerState==0 && relayState==LOW){
    relayState=HIGH;
    ONInterruptHappend=30;     
    t1=millis();
    timerState=30;
    digitalWrite(relay1, relayState);   
    }
    else{
    relayState=LOW;
    OFFInterruptHappend=1;
    timerState=0;
    digitalWrite(relay1, relayState);      
    }
last_micros = micros();
   }   
}


void debounceInterrupt1() {
 if((micros() - last_micros) >= debouncing_time) {
  if(timerState==0 && relayState==LOW){
    relayState=HIGH;
    ONInterruptHappend=45;     
    t1=millis();
    timerState=45;
    digitalWrite(relay1, relayState);   
    }
    else{
    relayState=LOW;
    OFFInterruptHappend=1;
    timerState=0;
    digitalWrite(relay1, relayState);       
    }
last_micros = micros();
   }   
}


void debounceInterrupt2() {
 if((micros() - last_micros) >= debouncing_time) {
  if(timerState==0 &&  relayState==LOW){
    relayState=HIGH;
    ONInterruptHappend=60;     
    t1=millis();
    timerState=60;
    digitalWrite(relay1, relayState);   
    }
    else{
    relayState=LOW;
    OFFInterruptHappend=1;
    timerState=0;
    digitalWrite(relay1, relayState);
    }
last_micros = micros();
   }   
}
```

What server are you using to do the http, rather than https, update?

i mean i used the basic example sketch (forgot the word sketch):

 * httpUpdate.ino
 *
 *  Created on: 27.11.2015
 *
 */

#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>

#define USE_SERIAL Serial

ESP8266WiFiMulti WiFiMulti;

void setup() {

    USE_SERIAL.begin(115200);
    // USE_SERIAL.setDebugOutput(true);

    USE_SERIAL.println();
    USE_SERIAL.println();
    USE_SERIAL.println();

    for(uint8_t t = 4; t > 0; t--) {
        USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
        USE_SERIAL.flush();
        delay(1000);
    }

    WiFiMulti.addAP("SSID", "PASSWORD");

}

void loop() {
    // wait for WiFi connection
    if((WiFiMulti.run() == WL_CONNECTED)) {

        t_httpUpdate_return ret = ESPhttpUpdate.update("http://server/file.bin");
        //t_httpUpdate_return  ret = ESPhttpUpdate.update("https://server/file.bin");

        switch(ret) {
            case HTTP_UPDATE_FAILED:
                USE_SERIAL.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
                break;

            case HTTP_UPDATE_NO_UPDATES:
                USE_SERIAL.println("HTTP_UPDATE_NO_UPDATES");
                break;

            case HTTP_UPDATE_OK:
                USE_SERIAL.println("HTTP_UPDATE_OK");
                break;
        }
    }
}
```

the same server:
```` t_httpUpdate_return ret = ESPhttpUpdate.update(“https://raw.githubusercontent.com/opbeer/cxbcvx/master/Blink.bin","","CC AA 48 48 66 46 0E 91 53 2C 9C 7C 23 2A B1 74 4D 29 9D 33”);```

So you are able to do https updates reliably with raw.githubusercontent.com and the basic sketch example but not your Blynk sketch, right?

yes
not with my particular sketch (mentioned above) that includes blynk

I don’t like the look of your loop().
It looks to have way too much stuff in it.

I think there are some parts of the basic http updater that are not technically required like all the “mutli” stuff. Can you try the following sketch a few times and if it fails use the fingerprint of “21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58”

// OTAviaGitHub.ino 26 March 2017 http://community.blynk.cc/t/fota-http-update-from-dropbox-or-google-drive/12867
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>

void setup() {
  Serial.begin(115200);
  //Serial.setDebugOutput(true);
  Serial.println();

  WiFi.begin("xxxx", "xxxxx");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }
  Serial.println("V12 Connected, updating");
  delay(1000);

  t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/opbeer/cxbcvx/master/Blink.bin","","CC AA 48 48 66 46 0E 91 53 2C 9C 7C 23 2A B1 74 4D 29 9D 33");

  // If OTA update is successful ESP will restart HERE
  
  Serial.print("Update failed with error number: ");
  Serial.println((int) ret);
  switch(ret) {
      case HTTP_UPDATE_FAILED:
          Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
          Serial.println();
          Serial.println();
          Serial.println();
          break;

      case HTTP_UPDATE_NO_UPDATES:
          Serial.println("HTTP_UPDATE_NO_UPDATES");
          Serial.println();
          Serial.println();
          break;
  }
  delay(500);

}

void loop() {
}

it worked from first try !!

You just need to try and build this into your Blynk sketch now.

As stated earlier you could remove the http case stuff as it doesn’t really serve any purpose.

this is what i done in my sketch
but its not working
when i recieving command from terminal i perform the update
maybe its something related to using blynk in the same sketch

No, because I have it working in my Blynk sketch and I am using much more heap than you. I have 23K free and it’s currently OK.

Perhaps try commenting out all the loop() stuff except timer and Blynk run. Try a few times as GitHub is flakey and it might be that the fingerprint changes depending which server you hit so it is always worth trying the standard fingerprint too.

You can comment out the following line in your sketch:
Serial.setDebugOutput(true);

hi
i tried commenting out almost all my code
leaving only blynk.run in the loop
it didnt helped
maybe its related that i am trying to update not in the setup()?

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <SimpleTimer.h>
#include <SPI.h>
#include "SSD1306.h"
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
WidgetRTC rtc;
WidgetTerminal terminal(V2);
SimpleTimer timer;

char auth[] = "???"; //insert here your token generated by Blynk

#define ONE_WIRE_BUS D1 //GPIO5

char Version[] = "1.0.8";
 
int qqq=0;



void setup() {
Serial.printf("ESP Free Heap:   %d bytes\n", ESP.getFreeHeap());
Blynk.config(auth);
WiFi.begin("oleg", "cde32wsx");  

}




BLYNK_WRITE(V2)
{

  // if you type "Marco" into Terminal Widget - it will respond: "Polo:"



   if (String("version") == param.asStr()) {
   terminal.println(Version);
  }
  

  else if (String("update") == param.asStr()) {
    //wdt_disable();
     //terminal.println("Updating...") ;
     //terminal.flush();
   
       // t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/opbeer/cxbcvx/master/Blink.bin","","CC AA 48 48 66 46 0E 91 53 2C 9C 7C 23 2A B1 74 4D 29 9D 33");
       qqq=1;
       
        }
  
  else {
   
    terminal.println("Wrong command");
  
  }

  // Ensure everything is sent
  terminal.flush();
}






void loop() {

if(qqq==1){
  t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/opbeer/cxbcvx/master/Blink.bin","","CC AA 48 48 66 46 0E 91 53 2C 9C 7C 23 2A B1 74 4D 29 9D 33");
  }
    Blynk.run(); 

}

this is all that left out of my code and it still resets immediately and not updating