From c11fff073a117afd2db1e9de276f65bb53641c11 Mon Sep 17 00:00:00 2001 From: Michael Ingraham <34340210+meingraham@users.noreply.github.com> Date: Thu, 12 Sep 2019 09:31:35 -0400 Subject: [PATCH] Updated Sonoff DIY (markdown) --- Sonoff-DIY.md | 82 +++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/Sonoff-DIY.md b/Sonoff-DIY.md index 46d93b03..159272b3 100644 --- a/Sonoff-DIY.md +++ b/Sonoff-DIY.md @@ -45,17 +45,17 @@ As Sonoff DIY is enabled by connecting GPIO16 to GND it may well be possible tha This procedure is recommended for MacOS, but also works for Linux. ### Requirements - eWelink firmware updated to at least 3.1 -- OS with `curl` and `mDNS` (MacOS)/`avahi-browse` (Linux) discovery tool -- `sonoffDiy` SSID on your local network. Use a router/access point or configure your laptop/smartphone as hotspot with the proper SSID and password. +- OS with `curl` and a network services discovery tool (e.g., `mDNS` for MacOS or `avahi-browse` for Linux) +- `sonoffDiy` SSID on your local network. Use a router/access point or configure your laptop/smartphone as a hotspot with the proper SSID and password. +- A `` available on the same local network. Very simple web servers like `SimpleHTTPServer` will not work. - A Tasmota binary (e.g., [`sonoff-basic.bin`](http://thehackbox.org/tasmota/020300/sonoff-basic.bin)) or your own self-compiled binary. It must fit in the available free program space. You can use the 2.3.0 Core for this initial flash since it has the smallest program memory footprint. _**Do NOT use the sonoff-minimal pre-compiled binary**_ as it does not allow you to change any settings. >You may wish to [compile your own firmware](https://github.com/arendst/Sonoff-Tasmota/wiki/Compiling-Tasmota-on-Gitpod) with all the features you require and disabling the features you do not. This will usually result in a "full" binary that is under 500k. You can use the resulting firmware file instead of the pre-compiled `sonoff-basic.bin`. This way you will not have to perform the secondary OTA firmware update. _**Nevertheless, it is still recommended that you perform a `Reset 5` immediately after the Sonoff DIY flash completes.**_ -- 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 - - Very simple webservers (like python SimpleHTTPServer) will not work. + + Upload the firmware file to the `` available on the same local network. +- SHA256 `` of firmware binary file + > `$ shasum -a 256 sonoff-basic.bin` + + **_`1da0e89be4c01df033fa6da9d0c1db58c3deea354d7ad194f607d1f518db48f9`_** ### Verify and/or update eWelink firmware version - Open the device and remove the jumper labeled OTA if present @@ -68,56 +68,56 @@ This procedure is recommended for MacOS, but also works for Linux. - SSID: `sonoffDiy` (_**case sensitive!**_) - Password: `20170618sn` - 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` (MacOS) or `avahi-browse` (Linux) command, search for the Zeroconf details. In this example, the device ID is **_1000988699_** -~~~~ - $ dns-sd -B _ewelink._tcp +- Obtain the `` address (search on the router or perform an IP scan) +- Discover the Zeroconf details. + In this example, the `` is **_1000988699_** + + _MacOS_ + > `$ 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 -~~~~ + ``` -~~~~ - $ avahi-browse -t _ewelink._tcp --resolve + _Linux_ + > `$ avahi-browse -t _ewelink._tcp --resolve` + ``` + wlp3s0 IPv4 eWeLink_1000988699 _ewelink._tcp local = wlp3s0 IPv4 eWeLink_1000988699 _ewelink._tcp local hostname = [eWeLink_1000988699.local] address = [192.168.1.109] port = [8081] txt = ["data1={"switch":"off","startup":"off","pulse":"off","pulseWidth":500,"rssi":-47}" "seq=1" "apivers=1" "type=diy_plug" "id=1000988699" "txtvers=1"] -~~~~ - + ``` ### 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://_\_:8081/zeroconf/ota_unlock -XPOST --data '{"deviceid":"1000988699","data":{} }' - > - >_**{"seq":2,"error":0}**_ -- Flash firmware at /zeroconf/ota_flash - >$ curl http://_\_:8081/zeroconf/ota_flash -XPOST --data '{"deviceid":"1000988699","data":{"downloadUrl": "http://_\_/sonoff-basic.bin", "sha256sum": "1da0e89be4c01df033fa6da9d0c1db58c3deea354d7ad194f607d1f518db48f9"} }' - > - >_**{"seq":2,"error":0}**_ +- Test with `/zeroconf/info` POST + > `$ curl http://:8081/zeroconf/info -XPOST --data '{"deviceid":"","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://:8081/zeroconf/ota_unlock -XPOST --data '{"deviceid":"","data":{} }'` + + **_`{"seq":2,"error":0}`_** +- Flash firmware at `/zeroconf/ota_flash` + > `$ curl http://:8081/zeroconf/ota_flash -XPOST --data '{"deviceid":"","data":{"downloadUrl": "http:///sonoff-basic.bin", "sha256sum": ""} }'` + + **_`{"seq":2,"error":0}`_** - Ping the device for about 30 seconds until it has rebooted ## Post Installation -Once the firmware upload completes and the device restarts, the usual "sonoff-xxxx" SSID should now be available. +Once the firmware upload completes and the device restarts, the usual `sonoff-xxxx` SSID should now be available. 1. Set up Wi-Fi to connect your device to your network 2. **_Perform a `Reset 5` to wipe any flash remnants BEFORE attempting a Tasmota OTA flash for the first time_** >**_Some users have reported that upgrading via OTA from sonoff-basic.bin to another binary has resulted in an unresponsive device which has required a wired flash to recover. A suggested, but untested, workaround is to perform a `Reset 5` to wipe any flash remnants BEFORE attempting a Tasmota OTA flash for the first time._** +3. It is recommend that you upgrade to the firmware and Core variant that is needed for your device and use case (e.g., `sonoff.bin`). +4. Once the desired firmware is on the device, continue the regular Tasmota setup process. Use the [Sonoff Mini template](https://blakadder.github.io/templates/sonoff_mini.html) to assign the device components to the GPIO pins. -It is recommend that you upgrade to the firmware and Core variant that is 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. Use the [Sonoff Mini template](https://blakadder.github.io/templates/sonoff_mini.html) to assign the device components to the GPIO pins. - -
GPIO | Tasmota
Component | Device
Function ---: | :--: | :--: -0 | Button1 (17) | Button -4 | Switch1 (9) | S1/S2 -12 | Relay1 (21) | L Out -13 | LED1 (56) | Link/Power Indicator +
GPIO | Tasmota
Component | Device
Function + --: | :--: | :--: + 0 | Button1 (17) | Button + 4 | Switch1 (9) | S1/S2 + 12 | Relay1 (21) | L Out + 13 | LED1 (56) | Link/Power Indicator ### Video tutorials - [Andreas Spiess](https://youtu.be/fzEDFmB0UYU?t=239)