Search our partners

Find the latest content on electronic components. Datasheets.com

Tasmota replacement for BL602, programming, pairing with Home Assistant.

p.kaczmarek2 8424 125
This content has been translated flag-pl » flag-en View the original version here.
  • winux22
    Level 2  
    Hello i flashed OpenBL602_1.12.8.bin on a Sonoff MiniR3 as described above.
    Flash was successful but the device does not boot after opening the boot-3,3V connection and power cycling.
    When i try to log in DevCube i get an error. Do i need a different Partition Table or Params?
    The Chip is a BL602L20.
    Some Pics and flash logs are in the attachment.
    Cheers Winux
  • winux22
    Level 2  
    Sorry totally my bad :D
    I had the same problem as bartek666666. I kinda missed that page of the thread.
    The problem was i downloaded the devcube programmer from the buffalos website. It's a different version.
    The one in your repo worked first try. I thought about deleting the post above, but i will leave it there for the pictures. Maybe it helps someone.
    Tasmota replacement for BL602, programming, pairing with Home Assistant.

    Added after 3 [hours] 30 [minutes]:

    Here are some more infos for the Sonoff MiniR3
    Wifi LED: 1
    Button: 5
    Relais: 22

    I would have sent a pull request but i don't have my credentintials with me at the moment.
    So for the sake of completeness feel free to add the following to the code:
    // DeviceName: Sonoff MiniR3
    // ShortDeviceName: minir3
    // https://sonoff.tech/product/minir3
    void Setup_Device_Sonoff_MiniR3() {

       PIN_SetPinRoleForPinIndex(1, IOR_LED_WIFI);
       PIN_SetPinChannelForPinIndex(1, 0);
       PIN_SetPinRoleForPinIndex(5, IOR_Button);
       PIN_SetPinChannelForPinIndex(5, 1);

       PIN_SetPinRoleForPinIndex(22, IOR_Relay);
       PIN_SetPinChannelForPinIndex(22, 1);


    void Setup_Device_Sonoff_MiniR3();

    { Setup_Device_Sonoff_MiniR3, "Sonoff MiniR3"},

    Generate Openhab Things Entry
    // Sonoff MiniR3
    Thing topic minir3_1 "Sonoff MiniR3 1" {
            Type switch : PowerSwitch  [stateTopic="minir3/1/get", commandTopic="minir3/1/set", on="1", off="0"]

    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    That's it. Thx, it's working quite nicely.
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
  • p.kaczmarek2
    Level 26  
    Thanks, I will look into it when I have more time, same goes for LED driver update.

    I have BL602 bulb at hand, the one with I2C LED controller (SM2135), I will also try to get it running. Or it should already run, as the SM2135 driver is only using digital pins IO and OBK has it already working and tested for BK7231
  • theugster
    Level 1  

    First off, thanks so much for your work on this project! I accidentally bought a pack of Sonoff S40 smart plugs with power monitoring and figured I'd try to cut my losses and see if I could harvest the switch boards from these. Took *way* too long to get the correct wiring layout (the board has two sets of rx/tx pads for some reason) but I was eventually able to flash the latest firmware. Unfortunately it appears to be in a bootloop now, and never gets to a point where it's broadcasting a WiFi AP.

    The error(s) it appears to throw in the console are:
    [0m: bl_romfs.c: 146] romfs magic is NOT correct

    [ 39][INFO : hal_gpio.c: 115] [gpio1] status = disable
    [ 39][ERROR
    : hal_gpio.c: 216] gpio1: unvalid GPIO config
    [ 40][ERROR
    : hal_gpio.c: 130] gpio2: unvalid GPIO config button
    [ 40][ERROR
    : hal_gpio.c: 216] gpio2: unvalid GPIO config
    [ 41][INFO : hal_gpio.c: 106] gpio3 NOT found

    I've attached some logs and a screenshot of the Dev Cube app. Happy to provide some pictures of the board itself as well, this seems to be a fairly new one.

    Thanks again!
  • p.kaczmarek2
    Level 26  
    That's a strange error, I have never seen it before.

    At first, can you try downloading compiled GPIO demo from their SDK, here:
    and checking if at least it works on your device? It has an UART console to control pins. Try commands from the first post from this topic, gpio-func, gpio-set, etc...

    Also, good job with finding the wiring. Can you please photos of boards and the wiring to help other users with flashing Sonoff S40?
  • winux22
    Level 2  
    I sent a pull request on github for the Sonoff MiniR3 from above.

    I compiled the code and realised i'm not able to update via wifi ^^, so i had to get the device out of the garden and solder again to update the firmware. An update solution for the BL602 devices would be real nice.

    Things that could be improved:

    - Possibility to update the BL602 Devices via wifi.

    - Quick configs should also store device name as well as device short name. Device short name could be also used for the Hostname.

    - Timers
    As seen in Tasmota:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    It's neat to have them running on the device, especially for pumps or automated lights.
    Another neat idea would be an override for the timer via mqtt if available.
    Let's say the device turns a pump on every day to water plants or grass via local timer on the device. The smarthome software detects rain for a given day and sets an mqtt topic to 0. The Timer checks that topic as soon as a trigger happens and ignores watering for that day.

    That's all i'm missing so far. The Update solution would be top prio.
    Have a great day.