logo elektroda
logo elektroda
X
logo elektroda

Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

p.kaczmarek2 91422 372
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #151 20582128
    Dark Man
    Level 13  
    Have you noticed that in the screenshot from extracting the configuration from the batch, the "BL0937 SEL" pin is not pulled out on the left?
    I doubt he was needed :)

    Yesterday I downloaded the latest Flasher release but these options were not there yet.
  • ADVERTISEMENT
  • #152 20585022
    p.kaczmarek2
    Moderator Smart Home
    Good point! I haven't seen it myself. It's hard to test everything thoroughly as a larger project develops, which is why your feedback/testing is very valuable.

    @piratee @DarkMan1 soon I'm uploading a flasher with an IP scanner capable of making a mass backup of device configuration on the network. i.e. automatically takes a snapshot to the folder of all CFG obk sectors on the span. Will you be able to test? How many devices do you have?
    It's just that it will require an OBK update (to what is now on Github)
    Helpful post? Buy me a coffee.
  • #153 20585058
    Dark Man
    Level 13  
    I currently have about 7 devices connected to the network on the Beken chip. Apart from them, a few unused light bulbs and 2 unprogrammed LSPA9 sockets (unfortunately, there is no possibility to use Cloudcutter, because the lack of an appropriate profile means that I don't have time to deal with them now - unless you could make a Cloudcutter profile from the uploaded dunks 😁 ).
    P.S
    I have 37 devices on ESP with Tasmota in Tasmota integration, and 35 devices on MQTT integration :)

    Let me know when Flasher and the appropriate firmware will be ready so that I can start the process of updating for testing.

    Have you thought about trying to stabilize the results from the BL0937 chip?
  • #154 20585072
    p.kaczmarek2
    Moderator Smart Home
    Programmatic filtering of results is waiting in the queue, I have to think about how to do it at all, there are probably ready-made ways for it. This is a bit less of a priority as I have quite a few BL0937 users including contributor Valek (author of the LWIP update, MQTT throughput and OBK power stats improvements) and no one has reported it significantly distorting the measurements.

    So far, yesterday with an assistant we did a tutorial of extracting GPIO from any device via Web App, thanks to which you don't have to manually guess which pin the Relay is on, etc. It will be uploaded to YT in a few days.

    We also started working on infographics, the assistant made a template.

    Flasher also detects Tasmota devices and also allows you to more or less control them (just for testing and fun), but I have trouble with making a backup of the Tasmota template because something doesn't want to return the correct template.
    @DarkMan1, since you have so many devices with Tasmota, tell me, what about you returns such a request from the browser to Tasmota?
    
    http://192.168.0.159/cm?cmnd=Template
    

    Change your IP of course...
    For me, Tasmots keep returning:
    
    {"NAME":"Generic","GPIO":[1,1,1,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":18}
    

    which is quite unexpected for me, I was hoping that they would return their actual template to me, but I probably don't know about something.

    Ultimately, I would like my mini tool in Flasher to be able to backup both OBK and Tasmot from our LAN.

    Added after 58 [seconds]:

    Oh, give me these 2MB batches and I'll arrange a profile for remote flashing, just please sign it specifically (I don't know, in zip?) and attach photos so that we know what these batches are for.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #155 20585167
    Dark Man
    Level 13  
    p.kaczmarek2 wrote:
    @DarkMan1, since you have so many devices with Tasmota, tell me, what about you returns such a request from the browser to Tasmota?
    Code: text Expand Select all Copy to clipboard
    http://192.168.0.159/cm?cmnd=Template

    Tasmot 12.4
    {"NAME":"Sonoff T1","GPIO":[32,1,1,0,0,0,0,0,225,256,0,0,0,0],"FLAG":0,"BASE": 28}
    Tasmot 10.1
    {"NAME":"LSC E14 RGBCW","GPIO":[0,0,0,0,32,0,0,0,4064,0,4032,0,0,0],"FLAG":0 "BASE":18}
    Tasmot 10.1
    {"NAME":"Minitiger1Gang","GPIO":[32,0,0,1312,0,0,0,0,224,544,0,0,0,0],"FLAG":0,"BASE":18 }
    Tasmot 11.1
    {"NAME":"GB155 no meter","GPIO":[0,1312,0,0,576,224,0,0,0,32,0,0,0,5729,0],"FLAG":0,"BASE" :18}

    I have authorization on all devices from Tasmot (it would also be useful in OpenBeken) and calling the link without logging in first, spits out this:
    {"WARNING":"Need user=&password="}

    It has never happened to me that any of the tested ones returned what you showed (Generic 1 1 1 1 ...)
    p.kaczmarek2 wrote:
    Added after 58 [seconds]:
    Oh, give me these 2MB batches and I'll arrange a profile for remote flashing, just please sign it specifically (I don't know, in zip?) and attach photos so that we know what these batches are for.

    I have already attached the batches earlier as I wrote that Flasher is not able to extract PINs from one batch.
    Both inputs are made of clones of LSPA9 sockets without any prints, so you can't even tell them apart. There was no model on the package.
    The photo will be up shortly.

    Added after 3 [minutes]:

    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    Such a curiosity that the Chinese sell these sockets also supposedly with a 20A relay, and in fact there is a 16A relay, except that they burned the print on the relay housing itself so that its power could not be seen 😂
  • #156 20585417
    p.kaczmarek2
    Moderator Smart Home
    Dark Man wrote:

    
    http://192.168.0.159/cm?cmnd=Template
    Tasmota 12.4
    {"NAME":"Sonoff T1","GPIO":[32,1,1,0,0,0,0,0,225,256,0,0,0,0],"FLAG":0,"BASE":28}
    Tasmota 10.1
    {"NAME":"LSC E14 RGBCW","GPIO":[0,0,0,0,32,0,0,0,4064,0,4032,0,0,0],"FLAG":0,"BASE":18}
    Tasmota 10.1
    {"NAME":"Minitiger1Gang","GPIO":[32,0,0,1312,0,0,0,0,224,544,0,0,0,0],"FLAG":0,"BASE":18}
    Tasmota 11.1
    {"NAME":"GB155 no meter","GPIO":[0,1312,0,0,576,224,0,0,0,32,0,0,5729,0],"FLAG":0,"BASE":18}
    


    Very helpful, thanks, so I know that I have to look for a reason at home, maybe I'm setting the configuration differently.

    Dark Man wrote:

    I have authorization on all devices from Tasmot (it would also be useful in OpenBeken) and calling the link without logging in first, spits out this:
    {"WARNING":"Need user=&password="}

    Very good point, I didn't remember about it, I'll add it to the scanner and also think about the OBK.



    Dark Man wrote:

    earlier, as I wrote that Flasher is not able to extract PINs from one batch.

    I don't understand one thing here - we just found out that he pulls PINS from both batches, only in one he loses the SELECT pin from BL0937, and that's something else. It's with losing SELECT that I know why it is, it will be fixed soon. That's what you mean? Does yours seriously not read one of the dunks at all?


    Dark Man wrote:

    Both inputs are made of clones of LSPA9 sockets without any prints, so you can't even tell them apart. There was no model on the package.

    Someone, possibly from you, provided a link to Aliexpress for LSPA9 for $3 and when I ordered it, I got it from ESP. I will probably also post something about it on YT electrodes soon, but we'll see.
    Helpful post? Buy me a coffee.
  • #157 20585804
    Dark Man
    Level 13  
    p.kaczmarek2 wrote:
    Dark Man wrote:
    earlier, as I wrote that Flasher is not able to extract PINs from one batch.

    I don't understand one thing here - we just found out that he pulls PINS from both batches, only in one he loses the SELECT pin from BL0937, and that's something else. It's with losing SELECT that I know why it is, it will be fixed soon. That's what you mean? Does yours seriously not read one of the dunks at all?

    In post #149
    https://www.elektroda.pl/rtvforum/topic3887748-120.html#20581708
    I loaded dunks from two noname sockets - LSPA9 clones.
    I wrote earlier that it would be nice to make profiles for Cloudcutter from these batches.
    It was me who gave these links to Aliexpress Choice, because then I also bought this socket from CB2S.
    Then I also found the same cheap sockets again in Aliexpress Choice and ordered 1pc. (the same as the previous ones, although I had to desolder the flashing system) and 2 more pcs. (I haven't opened these yet)
  • ADVERTISEMENT
  • #158 20585831
    p.kaczmarek2
    Moderator Smart Home
    Dark Man wrote:
    I loaded dunks from two noname sockets - LSPA9 clones.

    Ok that's all clear, I just pointed out that basically pulling out the pins works on them, only in the case of one it loses the SEL and I will correct it.

    Cloudcutter profiles will be, I'll let you know.

    Hmm, so we ordered LSPA9 from the same auction and you got CB2S and I got the ESP8285 version.

    The devices page has been updated:
    https://openbekeniot.github.io/webapp/devicesList.html
    We added a list of Cloudcutter profiles:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    After selecting the list mode, press "Apply filtering" to refresh the page.
    Helpful post? Buy me a coffee.
  • #159 20586394
    p.kaczmarek2
    Moderator Smart Home
    @dark Man, I have bad news . Both of your 2MB screenshots of newer LSPA9 are already patched, they are versions 1.1.12 and 1.1.15 respectively. It is not possible to flash them over WiFi.

    For the sake of clarity, here is a list of patched versions of Tuya that are not susceptible to firmware over the network:
    BK7231T - none
    BK7231N:
    - 1.1.2 oem_bk7231n_garage_door (Tuya Generic QS-WIFI-C03 Gate Opener Switch)
    - 1.1.12 oem_bk7231n_plug (Nous A1, Tuya Generic LSPA9 Smart Plugs)
    - 1.1.15 oem_bk7231n_plug (various smart plugs)
    - 1.3.3 oem_bk7231n_dctrl_switch (HomeMate 4 Node Smart Switch)
    - 1.3.8 oem_bk7231n_control_switch (ColoRock CR-MINI-V2 Mini Smart Relay)
    - 1.3.10 oem_bk7231n_control_switch (OXT_SWT10 240V 150W 5A Dry Contact Relay)
    - 1.5.10 oem_bk7231n_light_ty (Tuya Generic Light, TuyaOS 3.3.2)
    - 2.0.15 oem_bk7231n_strip_ty (Anko Sunset Light)
    Nothing can be done about it. You have to open the case and solder.
    Helpful post? Buy me a coffee.
  • #160 20595091
    piratee
    Level 13  
    Hello
    What does such an entry read from the configuration (mini Smart Switch) mean?

    Device configuration, as extracted from Tuya:
    - Pair/Toggle All Pin on P11
  • #161 20595099
    p.kaczmarek2
    Moderator Smart Home
    Looks like I used the wrong word. This is what happens when you write a project as fast as possible... of course it's about:
    
    - Pair/Toggle All Button on P11
    

    I've added a fix to the code and will release it later.

    For clarity - this is the pairing button, the small one from the housing, it also serves as a toggle all (switch of all channels).
    Helpful post? Buy me a coffee.
  • #163 20595115
    p.kaczmarek2
    Moderator Smart Home
    Btn or even better Btn_Tgl_All. Why are you asking how we define it? After all, after the copy paste of this JSON from the first field to the Web App in OpenBEken, the Import tab, everything will set itself.

    Or you can paste here:
    https://openbekeniot.github.io/webapp/templateImporter.html
    It will also work in most situations and will create a template by itself. You probably don't need to manually translate this into pin role names.
    Helpful post? Buy me a coffee.
  • #164 20595623
    xenonscrinium
    Level 5  
    I have problem with tuya smart socket 16. When power consumption goes above ~1.5KW the socket turns off/on randomly, I don't hear relay click sound.
    Any body has problem with smart sockets at max power consumption?

    openbk version 1.17.54
    Code: JSON
    Log in, to see the code



  • #165 20595646
    p.kaczmarek2
    Moderator Smart Home
    That's quite a lot of power, are you sure that this device is rated for such a high power?
    Anyway, try using PowerSave 1 in OBK short startup command (reboot after adding it), this will run OBK in low-power mode and may help if the relay click is caused by a power supply issue. Maybe with such a high power consumption voltage drop is so high that BK doesn't get enough power.
    Helpful post? Buy me a coffee.
  • #166 20595659
    xenonscrinium
    Level 5  
    p.kaczmarek2 wrote:
    That's quite a lot of power, are you sure that this device is rated for such a high power?
    Anyway, try using PowerSave 1 in OBK short startup command (reboot after adding it), this will run OBK in low-power mode and may help if the relay click is caused by a power supply issue. Maybe with such a high power consumption voltage drop is so high that BK doesn't get enough power.


    It is noted in specs for this device:
    Max. power
    2200W for 220V ,1100W for 110V
    I'm running it on 220v
  • #167 20595676
    p.kaczmarek2
    Moderator Smart Home
    Well, try PowerSave method and let us know if it helped.

    Also, does OBK reboot when relay clicks?
    Helpful post? Buy me a coffee.
  • #168 20595693
    xenonscrinium
    Level 5  
    p.kaczmarek2 wrote:

    Well, try PowerSave method and let us know if it helped.
    Also, does OBK reboot when relay clicks?


    is this command should be put it here?

    {
    "vendor": "Tuya",
    "bDetailed": "0",
    "name": "Full Device Name Here",
    "model": "enter short model name here",
    "chip": "BK7231N",
    "board": "TODO",
    "flags": "1024",
    "keywords": [
    "TODO",
    "TODO",
    "TODO"
    ],
    "pins": {
    "6": "BL0937CF1;0",
    "7": "BL0937CF;0",
    "8": "Rel;0",
    "10": "WifiLED;1",
    "11": "BL0937SEL;0",
    "24": "Btn;0"
    },
    "command": "PowerSave 1",
    "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
    "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }

    If so, this didn't help


    There are no relay clicks and no reboots,
    I hear strange noises from the socket when this happening


  • #169 20595696
    p.kaczmarek2
    Moderator Smart Home
    You should put it here, save, and reboot:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    Added after 6 [minutes]:

    BUT if there are no relay clicks... and you still lose the power.... then it sounds very bad, like a hardware issue, something must be disconnecting, I would really, really suggest you to lower the load or buy better quality relay... maybe 3300W one...
    Helpful post? Buy me a coffee.
  • #170 20595705
    xenonscrinium
    Level 5  
    p.kaczmarek2 wrote:
    You should put it here, save, and reboot:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    I put PowerSave 1 in startup command and rebooted, still nothing. It works ~1min, then turns off.
    It seems current overload protection, so there is nothing can be done I think
    Anyway thanks.
  • #171 20615660
    piratee
    Level 13  
    Hello
    At my friend's socket with BK7231T I have a problem with setting the relay to turn on after restart (I have the latest soft socket)
    in startup config i have
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    In the logs I have:
    nfo:MAIN:Module reboot in 1...
    8 POWERSAVE
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MQTT:mqtt_connection_cb: Successfully connected
    Info:MQTT:mqtt_subscribed to G2_Mastercook/+/set
    Info:MQTT:mqtt_subscribed to bekens/+/set
    Info:MQTT:mqtt_subscribed to cmnd/G2_Mastercook/+
    Info:MQTT:mqtt_subscribed to cmnd/bekens/+
    Info:MQTT:mqtt_subscribed to G2_Mastercook/+/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic G2_Mastercook/1/set
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 0 for ch 1
    Info:GEN:No change in channel 1 (still set to 0) - ignoring


    As if he couldn't properly set the flag to 1 in memory.
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 0 for ch 1
    Info:GEN:No change in channel 1 (still set to 0) - ignoring

    How to verify it

    Regards
  • #172 20616608
    p.kaczmarek2
    Moderator Smart Home
    It's pretty much always worked and hasn't been changed recently. Does it only work on this device?

    Or maybe in short startup command type e.g. setChannel 1 1 and see if it works? This should also set the channel 1 to 1 on startup, just in a different way.
    Helpful post? Buy me a coffee.
  • #173 20618040
    piratee
    Level 13  
    this worked by typing into Change Startup Command text
  • ADVERTISEMENT
  • #174 20618042
    p.kaczmarek2
    Moderator Smart Home
    Okay, but the normal way doesn't work? Is it broken in general on all devices, or is something wrong with this one?
    Helpful post? Buy me a coffee.
  • #175 20618051
    piratee
    Level 13  
    it does not work only with a friend on this 1 socket.
  • #176 20618091
    p.kaczmarek2
    Moderator Smart Home
    Maybe something wrong with the configuration? Or are you setting for the wrong channel?
    Helpful post? Buy me a coffee.
  • #177 20626385
    Dark Man
    Level 13  
    Today I flashed another 3 sockets with BK7232N, of which 2 are noname and 1 is Aubess (there was about a dollar and a half yeast from these nonames - I bought them at a different time than these nonames in the Choice option on AliExpress).
    In appearance, the housing looks identical. On the other hand, on the Aubess socket there are prints about the current, although it is false because it is supposed to be 20A max and inside there is a 16A relay. There are larger 20A relays in noname sockets.
    Who was copying whom? 😂
    Some comparison photos below.
    Two Aubess smart sockets with blue PCBs mounted on a clamp. Two Aubess smart sockets with blue PCBs and relays on a workbench. Two PCBs of different colors attached to a device. Two blue Aubess smart socket PCBs.

    The Aubess socket has only one LED (nonames have 2 blue ones, although sometimes older sockets used to have one red).
    How can it be used to show the status of wifi connectivity and the state of the relay after connecting to WiFi?

    Where did the Tools tab in the Web App Gui go? It has not been there for at least a dozen or so versions, and there was a nice menu for current calibration :(
    Now I had to do the same commands :/
    Also from at least a dozen or so versions, the preview of logs on the phone is terribly broken - i.e. buttons and squares for birds with descriptions enter the log window instead of being underneath.
  • #178 20626408
    p.kaczmarek2
    Moderator Smart Home
    The hybrid LED role is in the plans to be done, although it could be scripted and, for example, set the role of the pin to WiFi LED with a script, and when changing the MQTT state to 1, change it to a regular LED.

    Don't have the tools tab? What browsers did you check on?
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    And in the source of the page, in HTML, it is not there either?
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Helpful post? Buy me a coffee.
  • #179 20627397
    Dark Man
    Level 13  
    I'm using Chrome for Android.
    I checked that there are only a few tabs in portrait mode (the rest don't show, swiping won't do anything). The Logs tab as you can see is terribly messed up, but the others (the ones visible) display fine
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    However, in landscape mode, the other cards are shown but the cards
    Logs - mixed
    Config, Tools - texts on the left side are truncated
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    The WLED software for ESP8266 has a nice solution for matching the page to mobile browsers - what is visible in the columns on the computer is adjusted in the form of one column on the phone.
  • #180 20628705
    rakalexei
    Level 8  
    @p.kaczmarek2 Hey, how can we add these to HA? At least the timer is nice to have.

    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

Topic summary

The discussion centers on the Tuya LSPA9 smart socket teardown and the process of flashing OpenBeken firmware on devices based on the CB2S (BK7231N) module with BL0942 or BL0937 energy metering chips. Detailed guides cover hardware disassembly, UART programming, pin configurations, and calibration commands for accurate voltage, current, and power measurements. Users report variations in internal components, such as different pinouts and energy metering chips (BL0942 vs. BL0937), requiring tailored firmware settings. The OpenBeken firmware supports features like automatic calibration data saving, MQTT integration with Home Assistant discovery, and configurable precision for telemetry data. Issues discussed include OTA update behavior, negative power measurement spikes, device stability problems with CB2S, and DNS resolution in MQTT. Solutions involve firmware updates, command-line calibration, and community-shared device templates. The project supports multiple chip platforms (BK7231T/N, W600/W601, W800/W801, BL602, XR809) and aims to provide cloud-free, customizable IoT device firmware. Users also share experiences with alternative devices like Aubess and Arlec smart plugs, including pin mappings and flashing tips. The community actively contributes to device template databases and firmware improvements.
Summary generated by the language model.
ADVERTISEMENT