Flash Sonoff MiniR2(firmware 3.6.0) with ESPHome Over the Air

Tags: #<Tag:0x00007fc40506b9d8> #<Tag:0x00007fc40506b910>

I hope this instruction on how you can flash the Sonoff MiniR2 with with firmware 3.6.0(without the jumper) using a ESPHome .bin created from the ESPHome integration and Sonoffs DIY tool.

WARNING i don’t know if its possible to reverse the part where you unlock OTA in step 7.

All credit goes to Chad on YouTube How to flash Tasmota on a Sonoff MINIR2 with firmware 3.6.0. There is no jumper on this version - YouTube and this is mostly a write up of that video.

  1. Setup a 2.4GHz WiFi access point with;

SSID: sonoffDiy
Security Mode: WPA-Personal
Wireless password: 20170618sn

  1. Connect the Sonoff Mini R2 to power, wait for it to flash the blue LED in pulses of three, hold the button the Sonoff for approximately 5 seconds and it should start to single flash fast. After a short time it should come up as an “ITEAD-something” access point in your available networks

  2. Connect to the ITEAD-access point using
    Wireless password: 12345678

You should now have been given an IP-address of by the ITEAD-access point

  1. Open a web browser and enter the ITEAD-access points IP-address as url

You should now be presented with an overly zoomed in web page like this

  1. Click on “WIFI SETTING”

You should now be presented with

  1. Enter the following and then click “Save”

Network name(SSID): sonoffDiy
Network password: 20170618sn

The Sonoff should now connect to the SSID you set up at step one.

If you need to, look up the IP-address the Sonoff got by for example checking your routers DHCP leases, i had my DHCP pool for this network set so i got need to replace this with your Sonoffs IP-address. In my case i was doing ten of these i had to delete/clear the DHCP lease for each Sonoff as i progressed i cant tell why but if i didn’t i had to start over from step two(2) after i cleared the lease.

  1. Here i used the RESTer plugin for Chrome (RESTer - Chrome Web Store). And added the following as shown in the screenshots.

Choose Method “POST”

Enter URL:
Click “BODY”
Enter: {“data”: {}}

Click “SEND”

It should return some information like in the screenshot

To enable Over the Air (WARNING, i don’t know if its possible to set this back to false) updates edit the URL to

Click “SEND”

It should return some new information and “error”: 0

The last step here is just if you want to check that “otaUnlock” should be set to ‘true’.
Enter URL:

Click “SEND”

And you should hopefully get a result like this

  1. Open up the DIY tool (i used tool_01DIY85(3.3.0 from here Sonoff_Devices_DIY_Tools/tool at master · itead/Sonoff_Devices_DIY_Tools · GitHub).exe)

The Sonoff should be visible, you can try toggling the relay to be sure that the one listed is the one we are working with.

Click “Firmware flash”

In the dialog that opens, select your ESPHome .bin file you created for it(Chad flashes it using a Tasmota .bin so i guess any compatible firmware should work but i haven’t tried).

Now you are at the point of no return so double check everything.

Click “Flash device list” even if there is a device listed

Now you are even closer the point of no return so double check everything again.

Click OK to start the flash process

That should be all, momentarily you ESPHome flashed Sonoff should be discovered by the integration.

Here’s my config for these if it is any use to someone, its frankensteined from this forum and other sources

  device_name: sonoff_mini_r2_template

  name: ${device_name}
  platform: ESP8266
  board: esp8285

  - ssid: the_ssid
    password: the_password
    hidden: true
  domain: .localdomain

  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "${device_name}_Hotspot"
    password: "the_fallback_password"


# Enable logging

# Enable Web server
  port: 80

# Enable Home Assistant API
#  password: "api_password"

# Enable Over The Air update
#  password: "ota_password"

  - platform: homeassistant
    id: homeassistant_time

# Extra sensor to keep track of plug uptime
  - platform: uptime
    name: ${device_name}_Uptime Sensor
      - lambda: return x / 3600;
    unit_of_measurement: "hours"
    accuracy_decimals: 2

# Extra sensor for WiFi signal
  - platform: wifi_signal
    name: ${device_name}_WiFi Sensor
    update_interval: 60s

    number: GPIO13
    inverted: true

  - platform: gpio
    id: relay_1
    pin: GPIO12

  - platform: binary
    id: light_1
    name: ${device_name}_Lights
    output: relay_1    

  - platform: gpio
    pin: GPIO00
    id: reset
    internal: true
      - invert:
      - delayed_off: 10ms
      - light.toggle: 
          id: light_1

  - platform: gpio
    name: ${device_name}_Lights
    pin: GPIO04
    id: switch_1
#        - switch.turn_on:
        - light.toggle: 
            id: light_1
#        - switch.turn_off:
        - light.toggle: 
            id: light_1