Shelly with ESPHome: OTA Rollback to Shelly?

I have a couple of Shelly 1’s with ESPhome that I’d like to flash back to stock Shelly firmware.

I know I can flash over a serial connection, but that would mean a trip to the roof and a sad face.
Is there a way I can flash back to Shelly OTA similar to the way you can flash from Tasmota to ESPHome ?

My instance of ESPHome is running as an add-on to HAOS on a HA Blue. Also running portainer so have access to the docker container.

If you enable the web interface in esphome you should be able to upload the Shelly bin there

If you have access to the firmware. Do Shelly make these available?

They do !

You’ll need to log in

Can you tell me where ? I’ve not seen anything related to firmware upload on the devices webpage

Well, I had a look with my STRONG eye and blow me down if there wasn’t some buttons to upload and flash some firmware !

Thanks for the heads up @LangeJan :+1::+1:

So, just some feedback in case someone else is wanting to roll back…

It looks like I have to climb into the roof.
Trying an OTA update with original firmware fails with

Update Failed: ERROR[4]: Not Enough Space

Updating OTA requires a large chunk of free memory to store basically BOTH firmwares during the update process.

That’ll learn me to stuff with things that 'aint broke ! :crying_cat_face:

What I don’t understand is why the ESPhome binaries are ~300k and the shelly binaries are 2MB :thinking:

ESPhome only supports the HA api, the Shelly firmware supports the shelly cloud, mqtt and coap. It is normal it is bigger :slight_smile:

OTOH Shelly can upgrade its own firmware OTA.

Are you sure you have the right flash size set in esphome?

I have

board: esp01_1m

Doesn’t help that I can only do this through the webserver which uses lots or ram

And how much flash does the device have? esptool will tell you.

Interesing !
The link below suggests 2MB !!

So…
Might it be as simple as changing the board type to _2m ?

Choose one with 2Mb from the list pointed to in the docs.

Thanks for the tips.
I’ll post back with what I find :+1:

Could you flash an absolutely minimal sketch with only ota and wifi enabled? Would that give you headroom to load the shelly binary?

I tried that last night with no luck.
Still need webserver: to be able to select a bin file.

I think @nickrout might be on to something.
I’ll know more in a few hours :crossed_fingers:

Is there a reason you can’t use the header on the Shelly1 to flash via serial ??

shelly1_pinout_s2

Gaz

Laziness :rofl:

Seriously though, that will be my last resort.
If I don’t have to retrieve it from the roof cavity, I won’t.

Sooo close !

After changing

board: esp01_1m

to

board: esp_wroom_02 ( ESP8266 with 2MB flash )

still fails with not enough space but uploading gets to 76% where previously it was failing at 25%

Interestingly, I’ve connected a spare Shelly 1 to esptool which reports

Auto-detected Flash size: 16m

From what I’ve read, this mismatch cannot be corrected OTA.

Potentially, had I started using ESPhome with the correct board type selected ( d1_mini_pro ? ) I wouldn’t be asking all these silly questions.

I think I’ve just killed a Shelly 1 :grimacing:

As a test I tried uploading a ESPhome image over serial with board: d1_mini_pro selected
After the upload I couldnt get a response from the Shelly.
I uploaded a Shelly restore image over serial and its still dead.

Vale Shelly 1

:latin_cross: