Server OTA support for ESP8266

Nice catch. That’s a bug. Thanks.

However, I think it should work even with it. @vshymanskyy yes?

1 Like

OOooo please fix it soon because my business partner is coming over in less than 24 hours to take away a prototype and I need OTA updates working haha :smiley:

1 Like

Give me 3 hours. I need to go right now, but right after I come back - I’ll fix it.

I’m asleep the next 6 hours so no prob :smiley:

1 Like

Not a bug. This part is attached on hardware side. So it is ok. However, OTA may fail. It is not stable (because of code inside ESP core).

Is there any way to remove the auth arg?

This part is not added by fw (in master branch)

@Jamin what curl command do you use so I can double check.

curl -v -F file=@Project-Unicorn-Provisioning.ino.adafruit.bin --insecure -u admin@blynk.cc:admin https://192.168.1.2:9443/admin/ota/start

I don’t know. It is not the server. I have tests for that. Maybe you are using old sketch? I remember it was in some version of sketch.

I have used the one that comes the with blynk library. But I did see that the OTA file was updated on the github repo so i tried using that version too with the same results.

This is definitely something with the sketch. The server doesn’t have “auth” param at all. And on hardware we had

  overTheAirURL = param.asString();
  overTheAirURL += String("?auth=") + configStore.cloudToken;

Please double check you uploaded correct and latest sketch.

3 posts were merged into an existing topic: Does Auth Token or Account Login have expiry

Hi @Dmitriy. Is there an intention to allow updates to devices using the blynk OTA option if I am not a business user and don’t have my own server. I.e. update over the blynk cloud. I only ask as I have devices on my network which don’t show up on my ide due to AP issues. My pc needs to be attached to specific APs on my network to see a device for the update to happen. This means me physically moving my pc around the property. :scream::joy:. I am using wemos and am using the wifimanager OTA function.

Hello @Dmitriy,

Can i use “server ota updates” in my private server OR should i be a business customer?

@ekeloglu you can use it on the local server. I’m not sure we have full documentation for that. However, you may try.

Hello Dmitriy

Thanks for the feedback.

Actually i tried it on my local server (a running remote VPS), i could managed to send curl command to specific device with specific token, but after the command sent, my wemos led turned into blue, lost blynk local server connection and no firmware downloaded

after i reset wemos, everything went normal. But of course without new firmware.

Anyway, i did not want to go into details and spent hours before being sure about that OTA updates can be achieved on local servers. Now i will give new tries.

If i can not manage to run blynk ota update, i will stay with esp8266 http updates.

Thanks a lot again.

Hello again @Dmitriy,

I could manage to upload new firmware with curl command by modifiying ota.h as below and i just included ota.h to my main program.

added below line to main program,

#include "OTA.h"

i just edited OTA.h as below in order to use it without Blynk Provisioning template. After editing OTA.h,

curl -v -F file=@Template_ESP8266.ino.nodemcu.bin --insecure -u admin@blynk.cc:admin https://localhost:9443/admin/ota/start?token=123

command worked like a charm.

On that point i have one question for you,

In my “OTA.h”, if i would use,

ESPhttpUpdate.update(overTheAirURL, BOARD_FIRMWARE_VERSION)

instead of

ESPhttpUpdate.update(overTheAirURL)

how ESPhttpUpdate command in ESP8266 code will check and compare firmware version from server side? Does blynk server keep a file which contains firmware information based on tokens? I just could not understand that how firmware version is compared between server side and mcu side?

By the way, it would be great to add an options to curl command which enables to send firmware to devices based on “tags”. Lets say, i have 100 devices in my project and 70 of them are temperature sensors and running same code and 30 of them pressure sensors which are running different code than temperature sensors. In my project i have two tags → “temp” and “pressure”. If there would be a command like below which ends /ota/start?tag=temp, it would be great to send firmware 70 pcs of temperature sensor without sending curl commands with 70 different tokens separately.

curl -v -F file=@Template_ESP8266.ino.nodemcu.bin --insecure -u admin@blynk.cc:admin https://localhost:9443/admin/ota/start?**_tag=temp_**

Thanks a lot.

Here is my edited OTA.h

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

String overTheAirURL;


void enterOTA() {

  Serial.println(String("Firmware update URL: ") + overTheAirURL);
  switch (ESPhttpUpdate.update(overTheAirURL)) {
  case HTTP_UPDATE_FAILED:
    Serial.println(String("Firmware update failed (error ") + ESPhttpUpdate.getLastError() + "): " + ESPhttpUpdate.getLastErrorString());
    break;
  case HTTP_UPDATE_NO_UPDATES:
    Serial.println("No firmware updates available.");
    break;
  case HTTP_UPDATE_OK:
    Serial.println("Firmware update: OK.");
    delay(10);
    ESP.restart();
    break;
  }
}

BLYNK_WRITE(InternalPinOTA) {
  overTheAirURL = param.asString();

  // Disconnect, not to interfere with OTA process
  Blynk.disconnect();

  // Start OTA
  enterOTA();  
  delay(500);
}
1 Like

Yes. On login hardware sends additional info regarding firmware. The server stores this info. So server has firmware version and build date and it uses it for OTA.

currently we are working on web part. And all this will be implemented there. At some point :slight_smile:. As managing OTA without Web UI is very hard. It has so many info that it is hard to place on mobile.

Thanks for the replies @Dmitriy.

Since you do not go into details and sharing a complete documentation regarding OTA Server feature, i guess your team is still implementing full functionality to OTA server feature.

I will be waiting the news.

BR
Erdinc