logo elektroda
logo elektroda
X
logo elektroda

SmartPlugs BL602/BK7231N reboot on HTTP call after update to v1.18.158, Low Heap Warning

blacksun2 54 9
ADVERTISEMENT
  • #1 21642627
    blacksun2
    Level 8  
    Hello,

    After updating from version 1.18.156 to version 1.18.158 on some SmartPlugs, I noticed that the devices reboot as soon as I access http://x.x.x.x/app? via a browser.
    I experience this behavior on both BL602 and BK7231N devices.

    What I noticed in the log is the line
    Error:MAIN:Low heap warning!


    But I can't say what it means or whether this warning has anything to do with the problem.

    I am using this autoexec.bat:

    //clearIO
    PowerSave 0
    Flags 134743044
    startDriver NTP
    ntp_setServer 192.168.1.103
    ntp_timeZoneOfs 2
    waitFor NTPState 1
    SetupEnergyStats 1 60 1440 1
    //startDriver TuyaMCU
    //startDriver tmSensor
    mqtt_broadcastInterval 30
    mqtt_broadcastItemsPerSec 30
    waitFor MQTTState 1
    //tuyaMcu_defWiFiState 4
    //tuyaMcu_sendQueryState
    
    delay_s 5
    setPinRole 6 BL0937CF
    setPinChannel 6 0
    setPinRole 7 BL0937CF1
    setPinChannel 7 0
    setPinRole 8 Rel
    setPinChannel 8 1
    setPinRole 23 WifiLED_n
    setPinChannel 23 0
    setPinRole 24 Btn
    setPinChannel 24 1
    setPinRole 26 BL0937SEL
    setPinChannel 26 0
    setStartValue 0 1
    setStartValue 1 1
    
    delay_s 5
    DeviceName "OpenBKsteckdoseTVwohn"
    DeviceShortName "OpenBKsteckdoseTVwohn"
    MqttHost 192.168.1.97
    MqttPort 1883
    MqttUser MQTT
    //MqttPassword 
    MqttClient OpenBKsteckdoseTVwohn
    MqttGroup bekens_n
    WiFiSsid MySSID
    //WiFiPass DeinWlanPasswort
    
    delay_s 5
    setChannelLabel 1 SchalterOBKtvWohn
    delay_s 5
    scheduleHADiscovery
    
  • ADVERTISEMENT
  • #2 21642633
    p.kaczmarek2
    Moderator Smart Home
    1.18.158 adds:
    https://github.com/openshwprojects/OpenBK7231...mmit/e6dbea6007e414a9eb9ba7607cf71bde3691c752
    1.18.157 adds:
    https://github.com/openshwprojects/OpenBK7231...mmit/4d42d8bf43e7d4befc5e94c9bf991fcb4c290d77
    Well that sure doesn't look like something that can eat up RAM on those platforms? Are you sure it was those versions?
    @divadiow @insmod ?

    I will try in a moment...

    Added after 8 [minutes]:

    OpenBK7238 Built on Aug 22 2025 07:09:18 version 1.18.158 - heap stable
    SmartPlugs BL602/BK7231N reboot on HTTP call after update to v1.18.158, Low Heap Warning

    OpenBK7231T:
    SmartPlugs BL602/BK7231N reboot on HTTP call after update to v1.18.158, Low Heap Warning
    Heap stable?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21642651
    blacksun2
    Level 8  
    p.kaczmarek2 wrote:
    Well that sure doesn't look like something that can eat up RAM on those platforms? Are you sure it was those versions?


    yes, I only noticed it after updating from v 1.18.156 to v 1.18.158

    When device is starting up and you dont wait several minutes and when you call /index and /app? in Browser at the same time, the reboot occours


    Info:MAIN:Time 25318, idle 185169/s, free 26816, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 25319, idle 176038/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25320, idle 183777/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25321, idle 175819/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Error:MAIN:Low heap warning!
    Info:MAIN:Time 25322, idle 183607/s, free 12032, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 4/38 
    Info:MAIN:Time 25323, idle 189313/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25324, idle 189869/s, free 35120, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25325, idle 178307/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25326, idle 187379/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25327, idle 196400/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25328, idle 179092/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25329, idle 172832/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25330, idle 187437/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25331, idle 188551/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25332, idle 191664/s, free 35424, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 25333, idle 201529/s, free 35208, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    


    //EDIT:
    it is possible that the instability on a BL602 occuored in some versions before 1.18.156, something with 1.18.15x
  • #4 21642654
    p.kaczmarek2
    Moderator Smart Home
    Unable to reproduce, what may I be doing wrong?




    Added after 1 [minutes]:

    also tried just after reboot, but it seems the same?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 21642660
    blacksun2
    Level 8  
    p.kaczmarek2 wrote:
    Unable to reproduce, what may I be doing wrong?


    I noticed the problems only on smartplugs which are pin-only-devices.
    This is also the case with this:
    https://www.elektroda.com/rtvforum/topic4133644.html

    The problem doesn't appear on TuyaMCU-Devices and Battery-Devices.


    //EDIT:
    just from another Plug with BK7231N:

    Info:MAIN:Time 21428, idle 202010/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21337, socks 2/38 
    Info:MAIN:Time 21429, idle 181465/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21338, socks 2/38 
    Info:MAIN:Time 21430, idle 189230/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21339, socks 2/38 
    Info:MAIN:Time 21431, idle 187168/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21340, socks 2/38 
    Info:MAIN:Time 21432, idle 185502/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21341, socks 2/38 
    Info:MAIN:Time 21433, idle 192615/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21342, socks 2/38 
    Info:MAIN:Time 21434, idle 192738/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21343, socks 2/38 
    Error:MAIN:Low heap warning!
    Info:MAIN:Time 21435, idle 200789/s, free 22896, MQTT 1(7), bWifi 1, secondsWithNoPing 21344, socks 3/38 
    Info:MAIN:Time 21436, idle 193725/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21345, socks 2/38 
    Info:MAIN:Time 21437, idle 208575/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21346, socks 2/38 
    Info:MAIN:Time 21438, idle 177436/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21347, socks 2/38 
    Info:MAIN:Time 21439, idle 180154/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21348, socks 2/38 
    Info:MAIN:Time 21440, idle 187591/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21349, socks 2/38 
    Info:MAIN:Time 21441, idle 179683/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21350, socks 2/38 
    Info:MAIN:Time 21442, idle 194094/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21351, socks 2/38 
    Info:MAIN:Time 21443, idle 180239/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21352, socks 2/38 
    Info:MAIN:Time 21444, idle 188603/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21353, socks 2/38 
    Info:MAIN:Time 21445, idle 184568/s, free 34600, MQTT 1(7), bWifi 1, secondsWithNoPing 21354, socks 2/38 
    


    So it should be reproducable.

    I think you cannot locate the problem within simulator.
    You have to use a real plug device, a real plug with BL0937 metering.
    And you have to use my autoexec.bat, which is setting the whole config (web, PINs, TuyaMCU, etc.) each time it starts up.

    I suppose when you disable all "delay_s 5" in the autoexec.bat, the problem will occour much faster. I suppose the device / OBK is overwhelmed.
  • ADVERTISEMENT
  • #7 21642687
    blacksun2
    Level 8  
    p.kaczmarek2 wrote:

    
    mqtt_broadcastItemsPerSec 30
    

    30 items? Do you need that many?


    I found this line in various autoexec.bat suggestions for various devices here in the forum.
    Autoexec.bat suggestions are usually posted for TuyaMCU devices.
    I never questioned what the line meant or whether it was necessary. I adopted it because it appeared in various autoexec.bat suggestions.

    When is the line needed?
    Or is the value too high or too low?
  • #8 21642690
    insmod
    Level 26  
    I flashed a BK7231N BL0937 plug with latest firmware. Don't see any problems yet.
    backlog startDriver NTP; PowerSave 1; mqtt_broadcastInterval 60; ntp_setServer 192.168.1.1

    
    Info:MAIN:Time 331, idle 104083/s, free 73560, MQTT 1(1), bWifi 1, secondsWithNoPing 226, socks 2/38 
    Info:MAIN:Time 332, idle 168011/s, free 73360, MQTT 1(1), bWifi 1, secondsWithNoPing 227, socks 3/38 
    Info:MQTT:Publishing val 1.50 to OPENBK_PLUG_BW/power/get retain=0
    Info:MQTT:Publishing val 0.05 to OPENBK_PLUG_BW/power_factor/get retain=0
    Info:MAIN:Time 333, idle 156342/s, free 73560, MQTT 1(1), bWifi 1, secondsWithNoPing 228, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic OPENBK_PLUG_BW/power/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic OPENBK_PLUG_BW/power_factor/get
    Info:MAIN:Time 334, idle 169144/s, free 73560, MQTT 1(1), bWifi 1, secondsWithNoPing 229, socks 2/38 
    Info:MAIN:Time 335, idle 151454/s, free 73560, MQTT 1(1), bWifi 1, secondsWithNoPing 230, socks 2/38 
    Info:MQTT:Publishing val 250.7 to OPENBK_PLUG_BW/voltage/get retain=0
    Info:MQTT:Publishing val 0.118 to OPENBK_PLUG_BW/current/get retain=0
    Info:MQTT:Publishing val 29.73 to OPENBK_PLUG_BW/power_apparent/get retain=0
    Info:MQTT:Publishing val 29.73 to OPENBK_PLUG_BW/power_reactive/get retain=0
    Info:MAIN:Time 336, idle 167485/s, free 73560, MQTT 1(1), bWifi 1, secondsWithNoPing 231, socks 2/38 
  • #9 21642694
    blacksun2
    Level 8  
    insmod wrote:
    I flashed a BK7231N BL0937 plug with latest firmware. Don't see any problems yet.


    Please take my autoexec.bat and adapt the entries to your needs.
    Leave all the entries as I have them, including the order.

    I think you'll have problems with your devices as well.
  • #10 21642698
    p.kaczmarek2
    Moderator Smart Home
    Also those parts are strange:
    
    
    setPinRole 6 BL0937CF
    setPinChannel 6 0
    setPinRole 7 BL0937CF1
    setPinChannel 7 0
    setPinRole 8 Rel
    setPinChannel 8 1
    setPinRole 23 WifiLED_n
    setPinChannel 23 0
    setPinRole 24 Btn
    setPinChannel 24 1
    setPinRole 26 BL0937SEL
    setPinChannel 26 0
    setStartValue 0 1
    setStartValue 1 1
    
    delay_s 5
    DeviceName "OpenBKsteckdoseTVwohn"
    DeviceShortName "OpenBKsteckdoseTVwohn"
    MqttHost 192.168.1.97
    MqttPort 1883
    MqttUser MQTT
    //MqttPassword 
    MqttClient OpenBKsteckdoseTVwohn
    MqttGroup bekens_n
    WiFiSsid MySSID
    //WiFiPass DeinWlanPasswort
    

    Why do you do it in autoexec.bat? Usually... we do it once at configuration time and then dont execute it again.
    Helpful post? Buy me a coffee.

Topic summary

After updating SmartPlugs from firmware version 1.18.156 to 1.18.158, devices based on BL602 and BK7231N platforms reboot immediately upon accessing the HTTP interface (e.g., /app?) via a browser. Logs show repeated "Error:MAIN:Low heap warning!" messages, indicating potential memory issues. The problem occurs primarily on pin-only devices (such as certain smart plugs) and not on TuyaMCU or battery-powered devices. The reboot is triggered when HTTP requests are made shortly after device startup, especially if multiple pages (/index and /app?) are accessed simultaneously. The autoexec.bat configuration includes a high mqtt_broadcastItemsPerSec value (30), which may contribute to memory pressure, though this setting is commonly used in TuyaMCU device configurations. Some responders could not reproduce the issue, suggesting it may depend on device type or configuration. It is also noted that setting device parameters like pin roles and MQTT credentials in autoexec.bat, which runs on every boot, might be unconventional and could affect stability. Overall, the issue appears related to memory management changes in firmware 1.18.158 affecting pin-only SmartPlugs under certain HTTP access patterns and configuration settings.
Summary generated by the language model.
ADVERTISEMENT