diff --git a/Sonoff-DIY.md b/Sonoff-DIY.md index 8746b893..ab32eddf 100644 --- a/Sonoff-DIY.md +++ b/Sonoff-DIY.md @@ -1,6 +1,6 @@ -Some new Sonoff devices support the new [Itead DIY architecture](https://www.youtube.com/watch?v=fRS-ukCgD_I) which allows OTA firmware upload. With [Sonoff DIY](https://github.com/itead/Sonoff_Devices_DIY_Tools), a user has more control over the hardware features of the device and also allows for upgrading the firmware without additional hardware. +Some new Sonoff devices support the new [Itead DIY architecture](https://www.youtube.com/watch?v=fRS-ukCgD_I) which allows OTA firmware upload. With [Sonoff DIY](https://github.com/itead/Sonoff_Devices_DIY_Tools), a user has more control over the hardware features of the device and also allows for upgrading the firmware without additional hardware. The following procedure upgrades Sonoff eWelink firmware to Tasmota. -## Compatible devices +# Compatible devices Currently the following devices officially support Sonoff DIY: - Sonoff Basic R3 - Sonoff RF R3 @@ -8,22 +8,21 @@ Currently the following devices officially support Sonoff DIY: As Sonoff DIY is enabled by connecting GPIO16 to GND it may well be possible that other Sonoff devices running eWelink 3.1 or higher will also support it. -## Flash procedure -The following procedure upgrades Sonoff eWelink software to Tasmota using a Windows laptop. +# Flash procedure +## Using the Itead DIY tool ### Verify and/or update eWelink firmware version -- Open the device and remove the jumper labeled OTA if present -- Power on device and connect to eWelink -- Update eWelink firmware to at least 3.1 (mine came with 3.0) +* Open the device and remove the jumper labeled OTA if present +* Power on device and connect to eWelink +* Update eWelink firmware to at least 3.1 ### Flash Tasmota - Download the [Sonoff DIY `tool_01DIY85`](https://github.com/itead/Sonoff_Devices_DIY_Tools) from Github: - `./tool` `.exe` (Microsoft Windows) - - `./code` `.py` (not yet tested) + - `./code` `.py` (_not yet tested_) - Power off the Sonoff DIY device and install the DIY OTA jumper - Modify your PC configuration to provide a Mobile hotspot: - SSID: `sonoffDiy` (_**case sensitive!**_) - Password: `20170618sn` - - + - Power on the Sonoff device and verify that it shows up on the Mobile hotspot Settings page - Start the `tool_01DIY85` utility - The utility should discover the device @@ -35,80 +34,60 @@ The following procedure upgrades Sonoff eWelink software to Tasmota using a Wind If the firmware update gets stuck at 0%, the Sonoff device could not reach the manufacturer server because your mobile hotspot does not share the Internet connection. If this happens, use the DIY tool to set the SSID and password of your Wi-Fi network on the sonoff device. The device will connect to your network. Disable the hotspot and use your Wi-Fi for DIY tool laptop as well. Now start `Brush machine` again, flash Tasmota. Then continue with this guide. -Once the firmware upload completes and the device restarts, it is recommend that you load the firmware variant needed for your device and use case (e.g., `sonoff.bin`). Once the desired firmware is on the device, continue the regular Tasmota setup process. - ### Clean up - Quit DIY mode tool - Stop mobile hotspot - Power off the device and remove DIY jumper as it is no longer needed and might interfere with future Tasmota features that use GPIO16 -# Manual Flash / MacOSx - -After trying to get the python script to work, it seemed easier to do this manually using curl and the dns-sd process in MacOS - -## Requirements +## Manual Flash +This procedure is recommended for MacOS. +### Requirements - Sonoff DIY (firmware 3.1+) -- OS with curl and mDNS discovery tool -- `sonoffDiy` SSID on your router -- Copy of firmware (e.g. [`sonoff-basic.bin`]) on a local webserver. It must be _smaller than 500k_. _**Do NOT use the sonoff-minimal pre-compiled binary**_ as it does not allow you to change any settings. -- SHA256 sum of above firmware +- OS with `curl` and `mDNS` discovery tool +- `sonoffDiy` SSID on your local network +- Copy of firmware (e.g. [`sonoff-basic.bin`]). It must be _smaller than 500k_. _**Do NOT use the sonoff-minimal pre-compiled binary**_ as it does not allow you to change any settings. +- SHA256 sum of firmware binary file + >$ shasum -a 256 sonoff-basic.bin + **_1da0e89be4c01df033fa6da9d0c1db58c3deea354d7ad194f607d1f518db48f9_** +- Local web server + Upload the firmware file to a web server available on the same local network ### Verify and/or update eWelink firmware version - Open the device and remove the jumper labeled OTA if present - Power on device and connect to eWelink -- Update eWelink firmware to at least 3.1 (mine came with 3.0) +- Update eWelink firmware to at least 3.1 -### Discover the unit ID: +### Discover the device ID - Power off the Sonoff DIY device and install the DIY OTA jumper - Create a new SSID on your router: - SSID: `sonoffDiy` (_**case sensitive!**_) - Password: `20170618sn` -- Wait for the Sonoff to connect -- Using `dns-sd` search for the mDNS details: +- Wait for the Sonoff device to connect +- Obtain the device IP address (search on the router or perform an IP scan) +- Using the `dns-sd` command, search for the mDNS details. In this example, the device ID is **_1000988699_** ~~~~ -$ dns-sd -B _ewelink._tcp - Browsing for _ewelink._tcp - DATE: ---Mon 12 Aug 2019--- - 20:19:31.956 ...STARTING... - Timestamp A/R Flags if Domain Service Type Instance Name - 20:19:31.957 Add 2 5 local. _ewelink._tcp. eWeLink_1000988699 + $ dns-sd -B _ewelink._tcp + Browsing for _ewelink._tcp + DATE: ---Mon 12 Aug 2019--- + 20:19:31.956 ...STARTING... + Timestamp A/R Flags if Domain Service Type Instance Name + 20:19:31.957 Add 2 5 local. _ewelink._tcp. eWeLink_1000988699 ~~~~ -We've found here our ID is **1000988699** - -### Upload firmware -- Upload firmware to a webserver available on the SSID create above -- Verify sha256 sum of the firmware file: - -~~~~ -$ shasum -a 256 sonoff-basic.bin - 1da0e89be4c01df033fa6da9d0c1db58c3deea354d7ad194f607d1f518db48f9 -~~~~ -Our SHA256 sum is **1da0e89be4c01df033fa6da9d0c1db58c3deea354d7ad194f607d1f518db48f9** - - -### Flash and confirm -- Test with /zeroconf/info POST: -~~~~ -$ curl http://192.168.1.164:8081/zeroconf/info -XPOST --data '{"deviceid":"1000988699","data":{} }' - {"seq":2,"error":0,"data":"{\"switch\":\"off\",\"startup\":\"off\",\"pulse\":\"off\",\"pulseWidth\":500,\"ssid\":\"sonoffDiy\",\"otaUnlock\":false}"} -~~~~ +### Flash the firmware and confirm +- Test with /zeroconf/info POST: + >$ curl http://_\_:8081/zeroconf/info -XPOST --data '{"deviceid":"1000988699","data":{} }' + {"seq":2,"error":0,"data":"{\"switch\":\"off\",\"startup\":\"off\",\"pulse\":\"off\",\"pulseWidth\":500,\"ssid\":\"sonoffDiy\",\"otaUnlock\":false}"} - Unlock OTA updates at /zeroconf/ota_unlock -~~~~ -$ curl http://192.168.1.164:8081/zeroconf/ota_unlock -XPOST --data '{"deviceid":"1000988699","data":{} }' - {"seq":2,"error":0} -~~~~ + >$ curl http://_\_:8081/zeroconf/ota_unlock -XPOST --data '{"deviceid":"1000988699","data":{} }' + {"seq":2,"error":0} - Flash firmware at /zeroconf/ota_flash -~~~~ -$ curl http://192.168.1.164:8081/zeroconf/ota_flash -XPOST --data '{"deviceid":"1000988699","data":{"downloadUrl": "http://192.168.1.80/sonoff-basic.bin", "sha256sum": "1da0e89be4c01df033fa6da9d0c1db58c3deea354d7ad194f607d1f518db48f9"} }' - {"seq":2,"error":0} -~~~~ + >$ curl http://_\_:8081/zeroconf/ota_flash -XPOST --data '{"deviceid":"1000988699","data":{"downloadUrl": "http://_\_/sonoff-basic.bin", "sha256sum": "1da0e89be4c01df033fa6da9d0c1db58c3deea354d7ad194f607d1f518db48f9"} }' + {"seq":2,"error":0} +- Ping the device for about 30 seconds until it has rebooted -### Post Steps - -I carried on pinging 192.168.1.164 for about 30 seconds until the Sonoff rebooted. The normal "sonoff-XXXX" SSID was now available and ready for configuration. - -Carry on setup as usual +## Post Installation +Once the firmware upload completes and the device restarts, the usual "sonoff-xxxx" SSID should now be available. It is recommend that you load the firmware variant needed for your device and use case (e.g., `sonoff.bin`). Once the desired firmware is on the device, continue the regular Tasmota setup process. ### Video tutorials - [Andreas Spiess](https://youtu.be/fzEDFmB0UYU?t=239)