-
Notifications
You must be signed in to change notification settings - Fork 638
OTA flashing of virgin Itead Sonoff devices
This method is experimental. If it doesn't work, you will have to use standard flashing method
You just got your Sonoff device and would like to flash it using ESPurna, but would like to avoid opening device, and even soldering?
Clever folks at SonOTA and Espressif2Arduino have found a way to intercept iTead Sonoff OTA protocol and allow us to load any firmware built using Arduino framework, which includes ESPurna.
This method is compatible only to Itead Sonoff devices, and only those running firmware up until 1.60. If your device arrived with newer firmware, process will not work, so you might need to downgrade using eWeLink. This method will also not (and never) work on non Itead Sonoff devices or Itead Sonoff devices that don't have "pairing" mode.
Tested devices:
Device | Reported by | Reported on |
---|---|---|
Itead Sonoff Dual | lobradov | 2018-Feb-05 |
Itead Sonoff 4CH | lobradov | 2018-Feb-05 |
Itead Sonoff Basic | jkohrman | 2018-Feb-08 |
Itead Sonoff POW | mimbamonkeyhouse | 2018-Feb-20 |
Itead Sonoff TH10 | mimbamonkeyhouse | 2018-Feb-20 |
Itead Sonoff TH16 | mimbamonkeyhouse | 2018-Feb-20 |
Itead Sonoff S20 | sanka32 | 2018-May-10 |
If you test/verify any other device, please update the table above.
You'd need python3
and pip
installed. If you don't have them, google is your best friend.
$ mkdir -p ~/src/
$ cd ~/src/
$ git clone https://github.com/mirko/SonOTA.git
Cloning into 'SonOTA'...
remote: Counting objects: 284, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 284 (delta 2), reused 0 (delta 0), pack-reused 278
Receiving objects: 100% (284/284), 1.29 MiB | 1.63 MiB/s, done.
Resolving deltas: 100% (160/160), done.
$ cd SonOTA
$ pip3 install -r requirements.txt
Downloading httplib2-0.10.3.tar.gz (204kB)
100% |████████████████████████████████| 204kB 2.4MB/s
Collecting netifaces>=0.10.6 (from -r requirements.txt (line 2))
Downloading netifaces-0.10.6.tar.gz
Collecting tornado>=4.5.1 (from -r requirements.txt (line 3))
Downloading tornado-4.5.3.tar.gz (484kB)
100% |████████████████████████████████| 491kB 1.8MB/s
Building wheels for collected packages: httplib2, netifaces, tornado
Running setup.py bdist_wheel for httplib2 ... done
[...]
This will get you SonOTA, fake SSL certificates and stage 1 and 2 Espressif2Arduino images.
$ cd ~/src/SonOTA/static
$ curl -fsSL https://github.com/xoseperez/espurna/releases/download/1.12.3/espurna-1.12.3-espurna-core.bin -o image_arduino.bin
$ cd ~/src/SonOTA/
$ ./sonota.py --wifi-ssid my-home-wifi-ssid --wifi-password super-secret-password --serving-host your-IP-on-home-network
Current IPs: ['10.0.2.15']
Using the following configuration:
Server IP Address: 10.0.2.15
WiFi SSID: my-home-wifi-ssid
WiFi Password: *********************
Platform: linux
** Now connect via WiFi to your Sonoff device.
** Please change into the ITEAD WiFi network (ITEAD-100001XXXX). The default password is 12345678.
To reset the Sonoff to defaults, press the button for 7 seconds and the light will start flashing rapidly.
** This application should be kept running and will wait until connected to the Sonoff...
.......
[...]
Of course, replace "my-home-wifi-ssid", "super-secret-password" and "your-IP-on-home-network" with your actual parameters.
At this stage, script is ready to intercept Itead OTA requests, which happen in the first few seconds of powering up Sonoff devices.
You should power-on a Sonoff device, and press the first button for around 5s (this is the button documented in original Sonoff firmware as "pairing" button). This will create ITEAD-100001XXXX
Wifi network.
While keeping the script running, you should switch to newly created ITEAD-100001XXXX
network, so that script can continue:
[...]
<< {
"error": 0
}
~~ Provisioning completed
** The IP address of <serve_host> (192.168.1.10) is not assigned to any interface on this machine.
** Please change WiFi network to $ESSID and make sure %s is being assigned to your WiFi interface.
** This application can be kept running.
................
[...]
That's it :) You are just running ESPurna on your new device.
With above instructions, you'll be loading "espurna-core" on your device, which is a minimal image including only necessary functionality to actually connect to device. You probably need device/functionality specific image, which now you can load using inbuilt OTA.
You can let the script running, switch back to your home Wifi and flash another device.
If you're looking for support:
- Issues: this is the most dynamic channel at the moment, you might find an answer to your question by searching open or closed issues.
- Wiki pages: might not be as up-to-date as we all would like (hey, you can also contribute in the documentation!).
- Gitter channel: you have better chances to get fast answers from project contributors or other ESPurna users. (also available with any Matrix client!)
- Issue a question: as a last resort, you can open new question issue on GitHub. Just remember: the more info you provide the more chances you'll have to get an accurate answer.
- Backup the stock firmware
- Flash a pre-built binary image
- Flash a virgin Itead Sonoff device without opening
- Flash TUYA-based device without opening
- Flash Shelly device without opening
- Using PlatformIO
- from Visual Studio Code
- Using Arduino IDE
- Build the Web Interface
- Over-the-air updates
- Two-step updates
- ESPurna OTA Manager
- NoFUSS
- Troubleshooting
- MQTT
- REST API
- Domoticz
- Home Assistant
- InfluxDB
- Prometheus metrics
- Thingspeak
- Alexa
- Google Home
- Architecture
- 3rd Party Plugins
- Coding style
- Pull Requests