Flashing - mongoose-os-apps/shelly-homekit GitHub Wiki

Updating from stock firmware

  • Watch a 2 minute video.

  • Use the following URL (replace A.B.C.D with your devices current IP address):

    • http://A.B.C.D/ota?url=http://shelly.rojer.cloud/update
  • If everything goes well, after at most a minute or so you will see LED blinking (see LED indication section here) and a different web interface at the same device address.

  • Script for an automated way to update your devices (see below).

    • ./flash-shelly.py hostname (for single device)
    • ./flash-shelly.py -a (for all devices on the network)

Reverting to stock firmware

It is possible to revert back to stock firmware.


Script

There is a Python script works with macOS / Linux / Windows. It can be downloaded here, simply download the zip, unpack and in terminal navigate to the tools folder and run the command.

  • i.e ./flash-shelly.py -a will scan your network for all available devices and ask you if you wish to flash the found device(s) to homekit firmware.

Requirements: Python 3.6 or later, Firmware version 2.1 or later.

You can do various things with the script see below:

usage: flash-shelly.py [-h] [-m {homekit,keep,revert}] [-t {homekit,stock,all}] [-a] [-q] [-l] [-e [EXCLUDE ...]] [-n] [-y] [-V VERSION] [--variant VARIANT] [--local-file LOCAL_FILE] [-c HAP_SETUP_CODE]
                       [--ip-type {dhcp,static}] [--ip IPV4_IP] [--gw IPV4_GW] [--mask IPV4_MASK] [--dns IPV4_DNS] [-v {0,1,2,3,4,5}] [--log-file LOG_FILENAME]
                       [hosts ...]

Shelly HomeKit flashing script utility

positional arguments:
  hosts

optional arguments:
  -h, --help            show this help message and exit
  -m {homekit,keep,revert}, --mode {homekit,keep,revert}
                        Script mode.
  -t {homekit,stock,all}, --type {homekit,stock,all}
                        Limit scan to current firmware type.
  -a, --all             Run against all the devices on the network.
  -q, --quiet           Only include upgradeable shelly devices.
  -l, --list            List info of shelly device.
  -e [EXCLUDE ...], --exclude [EXCLUDE ...]
                        Exclude hosts from found devices.
  -n, --assume-no       Do a dummy run through.
  -y, --assume-yes      Do not ask any confirmation to perform the flash.
  -V VERSION, --version VERSION
                        Force a particular version.
  --variant VARIANT     Prerelease variant name.
  --local-file LOCAL_FILE
                        Use local file to flash.
  -c HAP_SETUP_CODE, --hap-setup-code HAP_SETUP_CODE
                        Configure HomeKit setup code, after flashing.
  --ip-type {dhcp,static}
                        Configure network IP type (Static or DHCP)
  --ip IPV4_IP          set IP address
  --gw IPV4_GW          set Gateway IP address
  --mask IPV4_MASK      set Subnet mask address
  --dns IPV4_DNS        set DNS IP address
  -v {0,1,2,3,4,5}, --verbose {0,1,2,3,4,5}
                        Enable verbose logging 0=critical, 1=error, 2=warning, 3=info, 4=debug, 5=trace.
  --log-file LOG_FILENAME
                        Create output log file with chosen filename.
  --reboot              Preform a reboot of the device.

macOS / Linux example:

  • ./flash-shelly.py -la this will list all available shelly devices and report the current firmware version that is available.
  • ./flash-shelly.py -am keep this will update all available shelly devices on the current firmware type (Stock or HomeKit) to latest version.
  • ./flash-shelly.py hostname this will update the device hostname to current firmware version that is available.
  • ./flash-shelly.py -m revert hostname this will revert the device hostname to latest stock firmware version that is available (this can also be used with -a ./flash-shelly.py -am revert to revert all devices on the network).
  • ./flash-shelly.py --local-file=SHSW-1.zip hostname to flash a local file to the device, you can use hostname or IP of the device.

Windows example:

  • python3 flash-shelly.py -la this will list all available shelly devices and report the current firmware version that is available.
  • python3 flash-shelly.py -am keep this will update all available shelly devices on the current firmware type (Stock or HomeKit) to latest version.
  • python3 flash-shelly.py hostname this will update the device hostname to current firmware version that is available.
  • python3 flash-shelly.py -m revert hostname this will revert the device hostname to latest stock firmware version that is available (this can also be used with -a python3 flash-shelly.py -am revert to revert all devices on the network).

Script Fails to run

If the script fails to run because of 'Failed to lookup online version information' and you are running on macOS try the following:

  • In the finder navigate to Applications/Python 3.x (x being the full python version you have installed i.e. Python 3.9)
  • If you see a icon named "Install Certificates.command", double click on it.
  • now try script again.