logo elektroda
logo elektroda
X
logo elektroda

[BL602/BL0937] Yet another Smart Socket 20A (but 16A)

flobuljeedom 13734 116
ADVERTISEMENT
  • #31 20924028
    p.kaczmarek2
    Moderator Smart Home
    @miegapele do you have any drivers running, etc? PowerSave? Anything?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 20925348
    miegapele
    Level 15  
    It's standard bl602 socket with bl0937 driver and mqtt, PowerSave was not enabled, nothing else. Added/removed logging for OTA/delaysat various places, did not make a difference, still update is inconsistent.
  • ADVERTISEMENT
  • #33 20925372
    p.kaczmarek2
    Moderator Smart Home
    If you are willing to investigate the issue futher, I would suggest getting version from the January 2023 and checking if it also works in unreliable manner:
    Screenshot of commit history in a repository, showing changes made on February 2 and January 22, 2023.
    I introduced BL602 in January 2023 and as far as I remember it worked well. So, I would suggest you to flash the Feb 2023 build and try to narrow down when it began to break.... but take care, keep your UART ready, if you are not sure, then don't do it, I don't want you to brick your device or something.

    EDIT:wait, that BL0937 driver does a lot of interrupts, have you tried to OTA without BL0937??
    Helpful post? Buy me a coffee.
  • #34 20926491
    miegapele
    Level 15  
    I will try to test that over the weekend
  • #35 20932072
    miegapele
    Level 15  
    Older version maybe helps with flashing, but still not bullet proof. I tried 15.455 and then installing 17.419, worked better, but still sometimes failed. And 15.455 was even bigger than now. I'll try to implement ota_progress functions, maybe that will help.
  • #36 20932561
    p.kaczmarek2
    Moderator Smart Home
    So what has changed? There isn't much that can affect OTA, is there?

    Are we doing some more calculations in the background that I am not aware of? Or did we change something related to WiFi?

    Here is our SDK repo, btw:
    https://github.com/openshwprojects/OpenBL602
    Not much changes here either...

    I've got one BL602 (or LF?) strip from @divadiow some time ago, I will do some testing on my side once I get some time
    Helpful post? Buy me a coffee.
  • #37 20944817
    flobuljeedom
    Level 7  
    Something strange happens when I set "SetupEnergyStats".
    The outlet does not respond at all after the time set in SetupEnergyStat: Mqtt disconnected, no ip ping, and the button doesn't work at all.
    If I set "SetupEnergyStats 1 60 60", it freeze after 59 seconds.
    If I set "SetupEnergyStats 1 70 60", it freeze after 69 seconds...

    Here is the last log before it freezes:
    Code: Text
    Log in, to see the code
  • #38 20944841
    miegapele
    Level 15  
    Made a fix for OTA issues. It was slow erase which caused issues for http connection, once I changed so that it erases in chunks, it now works very well. see here.
  • ADVERTISEMENT
  • #39 20945523
    p.kaczmarek2
    Moderator Smart Home
    @flobuljeedom does it happen every time? Maybe it's a flash vars problem?

    @miegapele very good job, I am unable to test it on my side at the moment but I think I will just merge it anyway, the fix makes sense
    Helpful post? Buy me a coffee.
  • #40 20946008
    flobuljeedom
    Level 7  
    @p.kaczmarek2
    I placed the command setupenergystart on startup commandfield, so each time it boots, the device freezes after the delay. And I have to unplug it.
    If I remove setupenergystart from startup command, the device doesn’t freeze.
    If I enter a unique command setupenergystart 1 60 60, then the device freezes 59 seconds later.
    What could I do with flash vars to help out?
  • ADVERTISEMENT
  • #41 20963204
    flobuljeedom
    Level 7  
    This socket stopped working after some time: no ping, no AP, no MQTT, and the side button refuses to work either.

    I have 5 sockets freshly flashed plugged and working fine for a few days.
    And then today, I had to unplug them and re-plug them to make them work again.
    Anyone else noticed the same issue?
  • #42 20963640
    miegapele
    Level 15  
    All 5 crashed at the same time? Could it be that something was sent via matt which was not handled well?
  • #43 20964147
    flobuljeedom
    Level 7  
    They freezed on different hours the same day.
    From 9AM to 2PM the same day.
    Each uptime when they stoped working: 39940, 42000, 155780, 122800)
  • #44 20964450
    miegapele
    Level 15  
    I have not seen such issues but I only have one socket and experimented a lot. So I don't know what to tell.
  • #45 20964462
    p.kaczmarek2
    Moderator Smart Home
    I would suggest to first start observing the heap size.

    Futhermore, we may need to enable watchdog on BL602 in the same manner as we did on BK7231.
    Helpful post? Buy me a coffee.
  • #46 20972269
    flobuljeedom
    Level 7  
    Devices worked fine for days, until today, one just gets unresponsive.
    This is the last values it send in Mqtt:
    - uptime 488104
    - freeheap 105400
    - Build on Feb 9 2024 16:36:16 version 1.17.457
  • #47 20973554
    flobuljeedom
    Level 7  
    >>20964462
    If I'm correct, enabling watchdog allows the device to reconnect to wifi when connection is lost.
    The side button (to activate the relay) should work either way.

    But that is not the case here, I think.
    The device is completely inoperative: the side button doesn't work at all.
    If the LED/relay was active, the relay/LED stays active.
  • #48 20974305
    miegapele
    Level 15  
    Watchdog is intended to restart device if it crashes. So it seems it should help your case. But it's not implemented yet.
  • #49 20974528
    p.kaczmarek2
    Moderator Smart Home
    I was referring to the MCU watchdog, hardware one. There is also an OBK mechanism called "IP Ping watchdog" but it's something else totally.

    We need to look into BL602 watchdog.

    Added after 2 [hours] 10 [minutes]:

    Some related search results:
    https://github.com/search?q=repo%3Aopenshwprojects%2FOpenBL602%20WATCHDOG&type=code

    I can see a function - WDT_Disable - but where is enable?

    Hm:
    Code: C / C++
    Log in, to see the code

    https://github.com/openshwprojects/OpenBL602/...components/joylink_adapter/example/test.c#L44
    Helpful post? Buy me a coffee.
  • #50 21004198
    Raufaser
    Level 10  
    I think i got the same socket:
    White smart plug with power button on a white wall. Image of a smart plug packaging and device with a voltage range of 100-250V.

    I have some high res pics of the internals:
    Close-up of a circuit board with electronic components. Close-up of a circuit board labeled SM-028_V1.3, showing electronic components. Close-up of a printed circuit board of an electronic device.

    I took the pin configuration as described in the first post. It works until now.

    This device is not in the device list when filtering for BL602. Maybe something is missing?
  • #51 21014474
    p.kaczmarek2
    Moderator Smart Home
    Why do you think it's missing? How to replicate the problem?
    This thread is listed in devices.json:
    A JSON code snippet with information about the Smart Socket 20A device.
    Or are you referring to other model?
    Screenshot of an IoT device list featuring a highlighted Tuya smart socket.
    See: https://openbekeniot.github.io/webapp/devicesList.html
    Helpful post? Buy me a coffee.
  • #52 21025349
    zdzihu123
    Level 11  
    I have similar BL602/BL0937 (module: SM-028_V1.3) RMC021 20A smart socket and also am facing freezing issue. It stops responding after some time (sometimes 15 min, sometimes 2-3h). When it's frozen I cannot access web gui, no ping, button not working.

    Build on Mar 28 2024 15:26:36 version 1.17.523
    Short name: RMC021, Chipset BL602

    I am going to test it with BL0937 driver disabled. Please point me to next troubleshooting steps.
  • #53 21025367
    miegapele
    Level 15  
    What drivers do you have. I had it running for few weeks without issue, with bl0937 and mqtt. Maybe it receives a lot of mqtt traffic from something? There is reports rhat crashes bl602 bulbs.
    I can look to add watchdog.
  • #54 21025378
    zdzihu123
    Level 11  
    I didn't mess with configs to avoid issues, so it's pretty vanilla (pretty much flashed the firmware and set gpios):

    Drivers: startDriver BL0937; startDriver NTP; startDriver SSDP

    {
      "vendor": "eWeLink",
      "bDetailed": "0",
      "name": "eWeLink Smart WiFi Socket 20A",
      "model": "RMC021",
      "chip": "BL602",
      "board": "SM-028_V1.3",
      "flags": "1024",
      "keywords": [
        "BL602",
        "socket",
        "BL0937"
      ],
      "pins": {
        "2": "Rel;1",
        "3": "BL0937CF1;0",
        "14": "BL0937CF;0",
        "20": "LED_n;1",
        "21": "BL0937SEL;0",
        "22": "Btn;1"
      },
      "image": "https://obrazki.elektroda.pl/8095216400_1711786208.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic4020634.html"
    }


    It's not connected to HA, no mqqt traffic in network (for now I have only 1 or 2 standalone smart plugs connected to wifi, no HA connected to this wifi network).

    Electronic module of a smart WiFi socket with discrete components on a red circuit board. Close-up of the internal electronic components of an eWeLink smart plug on a red PCB with the designation SM-028_V1.3. Close-up of a red circuit board interior with various electronic components.
  • #55 21025388
    miegapele
    Level 15  
    Could you try without ssdp driver? ssdp generates quite a lot of traffic, might be some problems with that part.
  • #56 21025394
    p.kaczmarek2
    Moderator Smart Home
    I think the first thing we need is Watchdog. It will solve all consequences of the potential freeze.
    https://github.com/search?q=repo%3Aopenshwprojects%2FOpenBL602%20watchdog&type=code
    We already have reboot reason on BL602:
    Screenshot from Visual Studio showing source code for the BL602 platform.
    It seems the most promising WDT code is here:
    https://github.com/openshwprojects/OpenBL602/...a28/components/hal_drv/bl602_hal/bl_wdt.c#L35
    Code: C / C++
    Log in, to see the code

    Max timer is (65535/16) - about 4095
    So basically, first call:
    
    bl_wdt_init(1000);
    

    In the:
    and then, in driver quick tick (I guess?) call:
    
    bl_wdt_feed();
    
    Helpful post? Buy me a coffee.
  • #57 21025413
    miegapele
    Level 15  
    Yes, we could add watchdog driver, looks very simple to do
  • #58 21025426
    p.kaczmarek2
    Moderator Smart Home
    @miegapele shall I create a PR to build binaries for testing or would you like to do that?
    Helpful post? Buy me a coffee.
  • #59 21025430
    miegapele
    Level 15  
    Please do, I can only do that in the evening
  • #60 21025444
    p.kaczmarek2
    Moderator Smart Home
    Sure, here is my first attempt, let's see if it builds, I guess I will need to add header:
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1158
    Please review it @miegapele , how do we even test that? Is there someone with UART flasher hooked up to BL602? This may be risky for your device if not working correctly.
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around the BL602/BL0937 smart socket, specifically a model identified as SM-028_V1.3. Users share experiences related to flashing firmware, troubleshooting connectivity issues, and implementing features like energy monitoring. Key challenges include OTA (Over-The-Air) update reliability, GPIO pin configuration, and device freezing after extended use. Solutions discussed include the implementation of a watchdog timer to prevent device freezes, adjustments to the BL0937 driver, and various methods to retain relay states during reboots. Users also explore the physical disassembly of the socket for flashing and the differences between Zigbee and WiFi models.
Summary generated by the language model.
ADVERTISEMENT