yaourdt/mgos-to-tasmota

Flashing other firmware

Closed this issue · 8 comments

Thanks for the great tool. Wondering if I can flash any .bin file. I'm using zumungo.com ESP software and I like everything to be on the same platform. For example will this work

http://shellyip/ota?url=http://myownwebserver/htdocs/mybinfile.bin

, where mybinfile.bin is the binary file that I want to flash into Shelly. Typically it comes from Arduino IDE compiler - "Export compiled binary" but in the case of zumungo.com it comes from the vendor per-compiled .bin file. Yes, zumungo.com is OTA enabled software so that memory partitions should be observed for OTA.

The firmware is not yet designed to accept arbitrary URLs, however, you can work around that. This would be the procedure (but be aware it is untested and requires some background knowledge with regard to networking, so proceed at your own risk):

Variant A:

  1. Compile your own version of this firmware, setting the download URL in mos.yml to whatever target bin file you want
  2. Host the resulting fw.zip on a web server of your choosing, which can serve files over HTTP (not HTTPS due to limitations of the stock firmware!)
  3. Update with http://shellyip/ota?url=http://yourownwebserver/fw.zip

Variant B:

  1. Cut the device's internet access and host a matching build of this firmware on a local web server of your choosing, which can serve files over HTTP (not HTTPS due to limitations of the stock firmware!),
  2. Update with http://shellyip/ota?url=http://yourownlocalwebserver/fw.zip
  3. Due to the missing internet access, the firmware will not be able to proceed to tasmota. Alter the download URL using this command: curl -d '{"config":{"mg2x":{"url":"https://yourtarget.bin/file.bin"}}, "save": true,"reboot": true,"level": 9}' http://shellyip/rpc/Config.Set
  4. Re-enable internet access

If you try it, let me know how it works out. If I have some spare time during the next months I'm planning on releasing a version one can use to flash any bin file, until then, these are the ways

Thanks for the prompt and detailed response. Tried both no luck.
Plan A.
There is no setting for "download URL" in mos.yml file (see below). There are "Libraries" but I think that it is something else. Also I couldn't find any documentation on the subject that would help adding "download URL".
Plan B
I can't put a file fw.zip on my server "http://yourownlocalwebserver/fw.zip" that I don't have (p.2. of plan B)


author: mongoose-os
description: A JS-enabled demo Mongoose OS firmware
arch: PLATFORM
version: 1.0
manifest_version: 2017-05-18
libs_version: ${mos.version}
modules_version: ${mos.version}
mongoose_os_version: ${mos.version}

config_schema:

  • ["mqtt.server", "iot.eclipse.org:1883"]
  • ["i2c.enable", true]

tags:

  • js

filesystem:

  • fs

libs:

conds:
It's not that we can't work with multicore
but we cannot afford it because of space (32K).

  • when: mos.platform == "esp32"
    apply:
    build_vars:
    ESP_IDF_SDKCONFIG_OPTS: >
    ${build_vars.ESP_IDF_SDKCONFIG_OPTS}
    CONFIG_FREERTOS_UNICORE=y

Plan B
I can't put a file fw.zip on my server "http://yourownlocalwebserver/fw.zip" that I don't have (p.2. of plan B)

I believe what Mark meant to say was that you should use the matching firmware update url for your device from this site:
https://github.com/yaourdt/mgos-to-tasmota

This makes sense but than in p.3 of Plan B same issue as in plan A. How to alter "download URL" when there is no "download URL" in the mos.yml file to begin with.

Hi @ivanvach - Variant A: You should use the mos.yml and other files from this Repo, not from the Mongoose demo - git clone this repository, replace mg2x.url, and follow the instructions at the bottom of the README.md file.

Variant B: You need to host a copy of Mongoose to Tasmota locally and cut the internet access to prevent the device from downloading the target firmware during the process, so you have time to modify the download URL. As I said: It requires some background knowledge with regard to networking, e.g. setting up your own local web server.

If you are not sure about how to do this, I strongly recommend waiting until I or someone else gets around to finishing this feature (but this may take a while).

Hi Mark, thanks for the help. Making progress now. mos executed the build command and produced fw.zip file.
I copied the file fw.zip in my web server's folder for content called htdocs and issued this URL command

http://192.168.1.163/ota?url=http://192.168.1.248/fw.zip

As a result Shelly1 got bricked.

My web server does have a log and the log shows this

192.168.1.163 - - [31/Jan/2021:22:12:37 -0800] "GET /fw.zip HTTP/1.1" 200 887835 "-" "-"
192.168.1.163 - - [31/Jan/2021:22:12:54 -0800] "GET /ZInstall8266.bin HTTP/1.1" 200 331792 "-" "-"

, where ZInstall8266.bin is the target file to be uploaded. I guess it became encoded in the fw.zip file and it is correct.

Will keep trying tomorrow. Maybe plan B will work.

It looks like it worked. Can you please post the Shelly 1 device logs?

Yes, Indeed it worked !!!!! Hurray !!!

Previously reported "bricking" problem was my problem that I corrected and it does work now.

Follow the instructions per plan A above strictly if you wish to flash your own .bin file into Shelly1 hardware.

Many thanks to Mark for making it possible and helping along the way.