ESP8266 & ESP32 VSCode OTA Support

You can now update the RoadMap in the documentation: :white_check_mark: ESP32 & ESP8266 OTA

Hi, @alvarolb . I was curious to learn more about the features:

The “Alerts manager” would be a functionality similar to what is already done by Endpoints, or similar to what NodeRED can do, for example, send an alert, to the email, if the device is offline for more than 3 hours?

Will the “Reporting generator tool” and “Reporting tool” make it possible to make reports with data from the buckets, for example, in Python or R language and send it by email?

I was excited about the possibilities.

Hello @ega

I upload the example script with platformio to an Esp32 dev Kit and I can’t get it to work.
In platformio the card does not seem to me
Have you got it without problems?

Yes, I had no problems,

I installed platformio (I used to code in arduino ide, so big advance for me to switch to platformio), then the thinger extension, I created the token into the instance and then set it into the thinger extension, and it shows me the actual devices created (in VSCode), and if I select some that is not online, the icon becomes red.

Specifically what you can’t do? or which step you are not able to reach? are you working with the public server or a private instance?

I use a private instance.
I have created a token with all the permissions and put in the extension
If I create a data bucket with ESP32 that I am trying to configure if that Ota data appears to me. ¿?¿?
Do you create the token for the Device or general?

Hi @JAVIER_MARIN, for private instances you need to configure the extension in VSCode settings, there is a section for Thinger.io there to configure host (with your private instance), and token. The token is fine with all permissions, it should work, but it is more secure if you limit the acccess for Device and the following permissions:

  • ListDevices
  • AccessDeviceResources
  • ReadDeviceStatistics

I had difficulty at first because I didn’t work with VS Code. But I managed (image below). It would be nice to document this with some images.
One question: You don’t need to indicate the Thinger.io account username in the extension, but only the token?

I did some testing with the ESP8266. After successfully uploading the Firmware… It only worked when I pressed the reset button on the NodeMCU. I don’t know if this is the default behavior, but it would be better if the NodeMCU resets right after the firmware update.
I’m going to investigate if this is because I’m using USB as a power supply or if it’s something from the VS Code.

1 Like

I did tests powering the ESP8266 with USB and with the JACK connector.

The Firmware Upload was successful, but I only managed to get the firmware into operation by pressing the RESET button on the NodeMCU. Otherwise, NodeMCU was still running the previous firmware.
I also simulated turning off/on the NodeMCU, removing the power cable, and I was also unsuccessful. ESP8266 has not moved to the latest firmware.


Thanks @alvarolb and @ega .
my problem was the token.
it’s already working

very very happy with this update, save a lot of workota-ok

1 Like

Include a button to “uncheck” the device.
This functionality is important, otherwise a device will always be tagged, and the developer may confuse the “Upload by Serial USB” buttons with the “Upload by OTA/internet” buttons when updating a firmware.

It is also interesting not to select any device when resetting the VS CODE. Otherwise, the developer may mistake and “Upload by OTA” by mistake when trying to “Upload by Serial”.
I also suggest changing the device’s background color from blue to green, to draw the developer’s attention, avoiding “Upload by Serial” instead of “Upload by OTA”.


verde

Hi!

I would test what happens for ESP8266, but in theory a reboot is issued at the end of flash both for ESP32 and ESP8266 to apply the update.

Will check how to solve it.

In theory it keeps selected the latest flashed device for that project. So, if you change between projects, the flashed device will change. With the ability to deselect a device it should be solved.

VSCode Studio does not allow setting arbitrary colors on the toolbar… a “normal state” is without any background color. You can only set backgrounds for warnings, errors, etc…

We have new version of the Visual Studio Code Extension:

Release Notes

1.0.5 (2021-08-24)

  • Add configuration to disable SSL verification for local deployments
  • Add command to palette for clearing selected device
  • Device search box now also query by device name
  • Improved OTA cancellation mechanism in any step
  • Preliminar support for LZSS compression for Arduno devices
  • OTA Speedup (~15%) with HTTP Keep-Alive (see recommendations on Readme)

Is “remote console” definitively abandoned, or do you have a schedule to get it working?

I can successfully telnet into my ESP32 devices within the wlan, but doing that worldwide over thinger.io without requesting a port forwarding would have been ways more sexy…

Hi @rin67630 ,

today I have been working on it. Some advances:

Now it display messages correctly

void loop() {
  delay(1000);
  Console.println("yes! it works!");
}

4PSuEZi13E

Now it also accepts reading commands from the terminal. Can be used normally as a Serial port

void loop() {
  if(Console.available()) {
    String cmd = Console.readStringUntil('\n');
    Serial.printf("Read command: %s", cmd.c_str());
  }
}

041V4v7L3

Saving the distances, It works practically like a linux terminal, each character is echoed back to the web terminal to ensure the message arrived fine to the device.

I think it can be released tomorrow. I need to do some more testing. :wink:

2 Likes

Still working on it… some work in progress. A minimal example… it says ESP32 but it is compatible with any other device.

TiA0aJgRQx

  console.set_terminal("ESP32", [&](String cmd){
    if(cmd=="free"){
      console.println(ESP.getFreeHeap());
    }else if(cmd=="reboot"){
      console.println("device will reboot now...");
      thing.reboot();
    }else if(cmd=="model"){
      console.println(ESP.getChipModel());
    }else if(cmd=="cores"){
      console.println(ESP.getChipCores());
    }else{
      console.println("\033[31munknown cmd");
    }
  });
1 Like

Hi @rin67630, we have finally published the ThingerConsole functionality. Just take a look to the new Arduino release:

1 Like

I have already used this service from Visual Studio Code, I have a private instance. But now it seems that it has stopped working, it is not listing the devices, the token is the same that I have used in the past.

Can anybody help me?

It is a problem related with latest VS Code Studio in Windows:

This does not look good, RIGHT NOW IT BRINGS ME A LOT OF PROBLMES !! The dependency on Visual Studio Code does not make it scalable and if vulnerable to third parties. Perhaps documentation on the OTA update process with Thinger.io will help to implement a solution via REST API (Not everything has to be done by you), with this I would think about sending updates to my fleet of devices and not depending on third parties like Visual Studio Code.

It is out of our hand. You can switch back to previous VSCode version (it is mentioned in this topic); you can test any of the workarounds mentioned; or even, you can try it on Linux where it works perfectly.

We are working on other OTA processes for fleets of devices, but it will take some time.