SonoffDIY
Follow the instructions at sonoff.tech/diy-developer/ to put the sonoff into DIY mode.
The device will show it's successfully connected to your network with it's LED. On my Sonoff MiniR2 it was just visible through the hole for the button and was flashing twice followed by a pause.
Find the new device's IP in your router's client status page (usually the device a name like ESP-mmmmmmm or with the shortest connection time).
Use curl or postman to POST to: http://<sonoff-ip>:8081/zeroconf/info
with body: {"deviceid":"","data":{}}If successful you'll see a json response body where one of the parameters is "otaUnlock":false
Post to: http://<sonoff-ip>:8081/zeroconf/ota_unlock
It should respond with "error":0, and sending the info post again should show "otaUnlock":true
If you have your own internal web server,
add MppDevice.bin to your server
post to: http://<sonoff-ip>:8081/zeroconf/ota_flash
with body:
{ "deviceid": "","data": { "downloadUrl": "http://<path to your server>/MppDevice.bin","sha256sum": "bcd844eadde2394b1f886f2f2ab985f13feda6afa72cef9a27a7d0563821d5c2" } }
OR if you don't have your own web server you need to go through tasmota:
post to: http://<sonoff-ip>:8081/zeroconf/ota_flash
with body:
{ "deviceid": "","data": { "downloadUrl": "http://sonoff-ota.aelius.com/tasmota-latest-lite.bin","sha256sum": "5c1aecd2a19a49ae1bec0c863f69b83ef40812145c8392eebe5fd2677a6250cc" } }connect to the tasmota hotspot then open 192.168.4.1 to (re)configure your wifi
use tasmota or connect your browser to the tasmota interface to upload the MppDevice binary of your choice.
Connect MppDevice to your wifi (see Downloads)
Install the MPP binary of your choice: MppRelay for AM only, MppMaker or MppRelays if you're using the switch.
Pins for MppRelay/MppMaker configuration
Button GPIO0
Switch: GPIO4
Relay: GPIO12
LED: GPIO13