Elektroda.com
Elektroda.com
X
Elektroda.com

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

p.kaczmarek2 6645 16
This content has been translated flag-pl » flag-en View the original version here.
  • Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Hello. I would like to present here a short teardown and OpenBeken configuration guide for LSPA9 power measurement socket. LSPA9 comes in various versions, but in this case it's based on CB2S (BK7231N) module and BL0942 energy metering chip with UART interface. I will show here step by step how to flash OpenBeken to LSPA9 and I will also explain step by step how the communication with BL0942 works. The BL0942 protocol section of this article will be dedicated to programmers and people who want to dig deeper into technical details, and can be skipped if you want to just flash OpenBeken and get readouts in Home Assistant.

    Related Topics
    General topics about my firmware for BK7231:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    WB2S/BK7231 Tutorial - writing custom firmware - UDP/TCP/HTTP/MQTT
    Topics about uploading OpenBK to other products:
    LED WiFi RGBCW Tuya - teardown, BK7231N, programming with my Tasmota replacement
    Garden Tuya CCWFIO232PK Double Relay - BK7231T - Programming
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    My firmware repository:
    https://github.com/openshwprojects/OpenBK7231T_App

    Purchase of the LSPA9 EU socket
    You can find the socket by searching for something like LSPA9 EU Smart Plug WiFi Smart Outlet Socket Voice Control Works for Alexa , I paid about $17 ($14 product + VAT tax and shipping):
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    The socket works normally with the Tuya application, but I have already tested it in other topics in this section:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    This time there was no shipment from the Czech Republic and the transport took a really long time. More than a month, I guess. Fortunately, no additional payments were required.
    The package was sent like from Wiazowna (FASTPRO), but it is obviously just a reshipper.
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    There is only a sticker with the product model (LSPA9) on the package, otherwise it would not be known what socket model it is:
    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
    The set includes a socket and instructions:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942Tuya 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


    The teardown of the LSPA9 EU
    I skipped any tests with the manufacturer's application. This has already been discussed in other topics.
    It is hard to get inside, I broke the casing a bit.
    Need to pry from the top edge:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    The CB2S module emerges:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    CB2S - a WiFi module based on BK7231N. Already supported by OpenB7231N.
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    In addition, you can see the energy measurement chip - BL0942, nearby there is a LDO 3.3V AMS1117-3.3 (because the power supply supply provides 12V to control the relay, and the WiFi module requires 3.3V), J3Y transistors (to switch the relay on):
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    And here is the power supply itself (transformerless!) Is based on the BP2525. This is not the first time I encounter this chip in a smart device.
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    This big resistor is probably a fusible resistor. I can't see any more protection circuitry here. No varistor?
    The relay is on the bottom side of the PCB:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    A brief analysis of the PCB with the multilimeter already tells us what is going on here.
    This is a standard smart socket, with BL0942 connected via UART to the CB2S. BL0942 also offers SPI mode, but it is not used here. It's a pity, because the same UART port from CB2S is used for firmware update - will there be a problem with that?
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942


    Uploading your own firmware - OpenBK7231N - part 1
    Same as in the previous topics in the series:
    LED WiFi RGBCW Tuya - teardown, BK7231N, programming with my Tasmota replacement
    Garden Tuya CCWFIO232PK Double Relay - BK7231T - Programming
    Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    Soldering cables to RX / TX and CEN (aka RESET):
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Soldering the cables before the LDO (so that 5V from USB is given at the AMS1117 input):
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    But at this stage I stopped, because first I wanted to see the CB2S communication with BL0942 with my UART converter.


    Communication with BL0942
    Datasheet of BL0942 shows that baud rate 4200 is used.
    Let's see what UART packets I was able to intercept.
    Sent by CB2S:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Sent by BL0942:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    So the host sends two bytes, always the same (even without CRC?), In the form of a request for measurements and BL0942 responds with the measurement results.
    I think of the header 0x55 as TuyaMCU, but it's not the TuyaMCU protocol.
    One might guess its content here, but we do have a catalog note.
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    The annotation {0,1,0,1,1,0, A2, A1} proves that the system supports the connection of several sensors (four, that many addresses are allowed by two address bits) to one UART bus. The way this works is that all four devices listen for the call, and only the one whose address is in that call responds to it.
    There is a single chip in our socket, however, so no problem.
    The measurement results in the packet are broken down into separate bytes. Each of them is a three-byte number. Among others, RMS values, frequency, power.
    There is also a one-byte checksum, used to detect possible transmission errors. The checksum is calculated from the remaining bytes of the packet, its value is placed at the end of the packet when it is sent. If, upon receipt, we count the value of the checksum and it is different than the one placed at the end of the packet by the sender, we know that the content of such packet has changed (disturbed) and should be discarded.
    In order to verify the formula for the checksum, I wrote a program:
    Code: c
    Log in, to see the code

    Running it on Windows allowed me to quickly verify that the calculations are performed correctly.
    I did the rest of the implementation in my OpenBK:
    https://github.com/openshwprojects/OpenBK7231T_App/
    I have already prepared a UART system with a receiving circular buffer which discussed here (PL only so far) .
    Sending a measurement request is simple:
    Code: c
    Log in, to see the code

    It works very much like a simpler version TuyaMCU. I regularly check that the number of bytes in the circular buffer is not less than the length of the expected packet. Additionally, I know that the packet header is always 0x55, so when there is the first other byte, I skip it.
    Code: c
    Log in, to see the code

    Then I know that the whole packet has been received, so I check its checksum.
    Code: c
    Log in, to see the code

    If the checksum is not correct then the packet is discarded - UART_ConsumeBytes (BL0942_PACKET_LEN) .
    Now it's time to get the measurements out of it. We need to combine separate bytes into a four byte integer (there are three bytes here, but on this platform the integer is 4 bytes). NOTE: the obtained number will still have to be processed, more on that later.
    Code: c
    Log in, to see the code

    Operator << is a bitwise shift and | is a logical sum.
    That will result in an integer like 3569180, which is far from 230V (the voltage we have in Poland at mains).
    This integer will have to be divided by a certain constant, which is also used for the calibration.
    This constant is calibrated at production time by Tuya, but sadly, when flashing new firmware we have no access to calibration data.
    We will have to figure out that constant itself in order to calibrate socket.
    How to get that constant?
    Well, this is very simple - just measure the voltage with a reliable voltage meter and then take raw_unscaled_voltage sent by plug and divide it by measured voltage.
    For me, the constants turned out to be:
    Code: c
    Log in, to see the code

    And finally, this is how you get result voltage, power and current measurements (in V, A and W).
    Code: c
    Log in, to see the code


    How the calibration API is implemented in OpenBK
    Of course no one wants to do calibration by hand. That's why I prepared a handy set of functions that will do everything for users. User only inputs the measured value (real voltage, current and power) and the function calculates the calibration constant - BL0942_PREF, BL0942_UREF, BL0942_IREF.
    Code: c
    Log in, to see the code

    The same approach is used for voltage and power.


    Flashing the firmware by UART - OpenBK7231N - part2
    At first I decided to desolder the BL0942, but do not worry - it turned out to be not necessary. I will just leave the photos here for the reference.
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    By the way, the Tuya firmware noticed the BL0942 missing right of the bat.
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    And here is my flashing setup:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Flashing:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    For rebooting the chip, I used the CEN method. It is tricky because you have to connect to CEN to ground for a very short while. That sometimes confuses beginners.
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Then I soldered BL0942 and checked flashing again - it still worked. Most likely the baud rate difference and/or the specific packet expected by BL0942 to send reply was enough to ensure that it will stay silent during flashing.
    All next software updates were made by OTA (remotely by WiFi), which is already supported by my firwmare for BK7231N and BK7321T.
    Of course then you have to setup WiFi SSID, passphrase, etc, but I assume you already know how to do that (if not, see other OpenBeken topics from the series).
    Pin roles:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942


    So how to calibrate BL0942 in OpenBeken?
    This section is for all users. You must do that. Otherwise you will get unreliable measurements!
    The calibration is very much like in Tasmota, even the command names are the same.
    At this point, I assume you already have OpenBeken flashed.
    First, run the BL0942 driver. Command:
    Code:

    startDriver BL0942

    Remember that you can enter commands at the Javascript frontend app of OpenBeken:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    After that, the main page should start showing measurements:
    Measurements with no load, before calibration:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    That voltage value is way too high! This is not acceptable. We need to calibrate.
    The measurements of 60W bulb without calibration:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Again, those are wrong.
    So, let's calibrate. Take a reliable power meter and measure how much in reality current and power the bulb consumes. Also write down the voltage in the socket. You will need that values later.
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Now, move the plug to the OpenBeken socket and enable it (OpenBeken must be measuring the very same bulb when you do the calibration, the bulb must be on!).
    Now, in the command line, type commends: VoltageSet [correntVoltageVal], CurrentSet [correntCurrentVal] i PowerSet [correntPowerVal], and write down the system replies (the correct calibration constants for your very device)
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    System replies:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    So, write down that VREF = 15987.125000
    PREF = -683.023987
    IREF = 272302.687500
    Refresh the page:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    You can also recheck with resistor load:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Resistive load is good for doing double-check because you can easily calculate power for that (the cos phi is 1 while for inductive/capacitive load it is not).
    Anyway, without delving too much into theory, it's time to prepare the config commands set with the calculated calibration constants:
    Code:

    startDriver BL0942
    VREF 15987.125000
    PREF -683.023987
    IREF 272302.687500

    Those commands are required to initialize BL0942 driver and set the calibration.
    Of course, it would be tedious to type them by hand on each device reboot.
    That is why we have a LittleFS file system and "autoexec.bat" system in OpenBK.
    So, on your PC, create a file called autoexec.bat and enter those commands.
    Then, take that file and drag over the file creation button on OpenBeken Web App Panel:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    This is how you save the file on LittleFS system of OpenBK.
    Then you can also use buttons to list the files, view them, etc.
    WARNING: Any OTA update will wipe the commands. This is because they occupy the same region as OTA. Always backup your autoexec.bat on your local machine.
    NOTE: The is also a short alternative to LittleFS autoexec.bat. You can use the "short startup command" field configured in options. Remember to enter commands there with "backlog" notation, like that:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    Also note that both autoexec.bat and short startup commands are not executed in "safe mode", i.e. when device fails to fully boot and run for a 30 seconds after booting for several times. The same method can be used to reset device - just power on and power off it three times and never let it run for more than 30 seconds. In safe mode, the device returns to Open Access Point mode and ignores its config (IO pins are disabled, etc).


    Configuration YAML foor Home Assistant
    Now it's time to send our measurement results to Home Assistant by MQTT.
    First, the MQTT needs to be configured in Config->MQTT, just like with any other device.
    Then, peek to Config->Generate Home Assistant Config to get short device name, something like obk0696FB33.
    You can also copy the configuration from there, but it will work only for relay mode.
    Extra manual configuration is required for power metering.
    Here is an example:
    Code:

    sensor:
      - platform: mqtt
        name: "BL0942 Voltage"
        state_topic: "obk0696FB33/voltage/get"
        unit_of_measurement: "V"
      - platform: mqtt
        name: "BL0942 Current"
        state_topic: "obk0696FB33/current/get"
        unit_of_measurement: "A"
      - platform: mqtt
        name: "BL0942 Power"
        state_topic: "obk0696FB33/power/get"
        unit_of_measurement: "W"
     

    Replace my device short name with your device names.
    After changing configuration.yaml, restart the Home Assistant. Then you should already get measurement results visible on HA charts:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Let's play around a bit. This is power consumption by my notebook in normal power mode:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Will "Power saving mode" from Windows change power consumption?
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    As you can see, not much. What about "High performance" mode?
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Some more measurements, after a certain time:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    Voltage:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    I have rechecked it with my Brymen BM857s and indeed, the voltage has changed over time.

    Summary
    This is how you pair Beken power metering socket with Home Assistant without replacing WB2S/CB2S chip. In future it might be even eaesier, because it might be also possible to flash the LSPA9 remotely with tuya-cloudcutter without even opening the case. The only issue would be that LSPA9 is made in different versions (CB2S + BL0942 or WB2S + BL0937), so it might be hard to determine which version is your socket.
    Still, I think the results are worth the effort. My LSPA9 is cloud-free now!
    Do not even try to skip the calibration step - the measurements are way off without it.
    Also, remember to save your BL0942 init and calibration constant setting commands in LittleFS or startup command - otherwise the BL0942 will forget calibration with next reboot!
    Do you like my work?
    Please support me at:
    https://www.paypal.com/paypalme/openshwprojects
    I really need to get more test devices and I plan to support BL0937 and other chips as well soon, so it's crucial to get funds.
    Also feel free to register here on Elektroda, I will do my best to help you setup OpenBeken.
    PS: I already have BL0937 socket donated to me by other user, so the work is already in progress!

    Cool? Ranking DIY
    About Author
    p.kaczmarek2
    Level 27  
    Offline 
    p.kaczmarek2 wrote 2159 posts with rating 3937, helped 94 times. Been with us since 2014 year.
  • #2
    khoam
    Level 41  
    p.kaczmarek2 wrote:
    Any OTA clears the filesystem - that's because the filesystem uses the same flash section as the OTA.

    I don't understand that. There are one or two partitions in flash for the OTA in ESP. For example, LittleFS can be placed in separate partitions. Updating after OTA has no right to destroy data stored in file systems.
  • #3
    p.kaczmarek2
    Level 27  
    LittleFS happens to be a contribution from one of the Github users, but the general idea is that we save Flash as much as we can. This allows us to have more than 512KB of file space and if someone wanted to, he could put html files or js there (they are not yet connected to the server, but it could).

    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/littlefs/our_lfs.c
  • #5
    p.kaczmarek2
    Level 27  
    A small update (I also put it in the first post).

    OpenBeken also supports "short startup command line", to be set in the options, that is, a field of 512 bytes for commands that are executed at startup. This OTA does not overwrite this. There, too, you can set the configuration of BL0942 and other things. There is a "backlog" to send multiple commands as in Tasmota.

    For example, for a socket from topic:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
    I know that this is a weaker solution, but the main structure of the configuration does not take up much and on the sectors where I put it (and on Xr809 and on the beken) there is just space for 512 bytes additional.

    In addition, I optimized the code from the repository and now I only send an update after MQTT if the measurement changes by a given (target) value by the user. For example, it makes no sense to send updates every 2 seconds when the voltage changes by 0.1V ...
  • #6
    error105
    Level 13  
    p.kaczmarek2 wrote:
    In turn, the power supply itself (transformerless!) Is based on the BP2525. This is not the first time I encounter this chip in a smart device.

    Hey, do you know where to get these chips from us in the country?
    Or are there other ones to build a transformerless power supply that gives 3.3V?
  • #7
    p.kaczmarek2
    Level 27  
    Unfortunately, I was not even more interested in it, and I can see that Alie now has 10 BP2525 for PLN 50, which in my opinion is a very high price.
    I only have to point out - BP2525 does not give 3.3V there and I have not seen such a structure in IoT devices. There, first the power supply gives 5V or 12V, and then additionally there is AMS1117-3.3V or an equivalent.
  • #8
    khoam
    Level 41  
    p.kaczmarek2 wrote:
    Thanks to this, we can have more than 512KB of file space and if someone wanted, he could put html files or js there (they are not yet connected to the server, but he could).

    It follows that the user will have to restore the contents of the file system after an OTA update every time.

    Besides, you could consider sending only compressed delta of the new program version via OTA. An example of such a project for ESP32: Link
  • #9
    jony4t
    Level 4  
    @p.kaczmarek2 have you managed to configure BL0937.Thanks
  • #10
    p.kaczmarek2
    Level 27  
    Basic BL0937 implementation is working already, altough I will be improving it in the future.

    For BL0937 configuration, please set appropriate pins in the pins config. The driver should start automatically.

    For calibration, follow the BL0942 steps, the commands are the same.

    Remember that your pinout might be different.
    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
  • #11
    jony4t
    Level 4  
    Hi. for my wifi plug this is the configuration. thanks for your help. Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    p.kaczmarek2 wrote:
    Basic BL0937 implementation is working already, altough I will be improving it in the future.

    For BL0937 configuration, please set appropriate pins in the pins config. The driver should start automatically.

    For calibration, follow the BL0942 steps, the commands are the same.

    Remember that your pinout might be different.
    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
  • #12
    p.kaczmarek2
    Level 27  
    Thank you, can you just tell us which exact plug model you have (name + photos) so other users can benefit from your config? Thanks.
  • #13
    skylineh44
    Level 3  
    Just thought I'd share my device details of an Australian single plug with power monitoring. The make/model is Brilliant Smart/20925 Series II
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 [img-1] Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    I've been replacing a bunch of newer devices with ESP based chips but came upon this project and decided to have a go. A fairly steep learning curve but I made it and now have the plug (with power monitoring) working in Home Assistant.

    The config is:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    I de-soldered the chip to program it and also to accurately trace to ensure which pins the BL0937 chip was connected to. It took a while and I cocked up my mirroring/tracing which too a couple of hours to untangle. Whoda thunk it would take so long to trace 3 lines - maybe because it was past midnight!! :not:

    After that I had difficulty setting the calibrations for the BL0937, I tried to use the "VoltageSet" command in the web interface but it did not work. It did work in the /app interface though.

    Anyway it's working so I'll say thanks to all who have contributed and all hail :please: to their computing prowess
  • #14
    jony4t
    Level 4  
    Has anyone had the problem with this type of socket with CB2S with BL0937 The socket stops working after 2-3 hours. In home assistant it says "stopped working". I try to search for the plug in the internal network and it does not appear either. I have to restart every time.. Thanks for your help.
  • #15
    p.kaczmarek2
    Level 27  
    I think the same CB2S issue has been reported on this thread: https://www.elektroda.com/rtvforum/topic3874289.html it seems to be something specific to N platform. It's under investigation. Can you provide full log?
  • #16
    TheAussieMaker
    Level 1  
    skylineh44 wrote:
    Just thought I'd share my device details of an Australian single plug with power monitoring. The make/model is Brilliant Smart/20925 Series II
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 [img-1] Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942 Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    I've been replacing a bunch of newer devices with ESP based chips but came upon this project and decided to have a go. A fairly steep learning curve but I made it and now have the plug (with power monitoring) working in Home Assistant.

    The config is:
    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942

    I de-soldered the chip to program it and also to accurately trace to ensure which pins the BL0937 chip was connected to. It took a while and I cocked up my mirroring/tracing which too a couple of hours to untangle. Whoda thunk it would take so long to trace 3 lines - maybe because it was past midnight!! :not:

    After that I had difficulty setting the calibrations for the BL0937, I tried to use the "VoltageSet" command in the web interface but it did not work. It did work in the /app interface though.

    Anyway it's working so I'll say thanks to all who have contributed and all hail :please: to their computing prowess


    Arlec Grid Connect Smart Plug (PC191HA)

    Chip = WB2S
    Power Chip = BL0937

    Work well also, had to remove the WB2S to flash as the button is attached to the RX line.

    These work out cheaper in the 4 pack @ $65.00 and the button is better located on the top

    https://www.bunnings.com.au/arlec-grid-connec...g-in-socket-with-energy-meter-4-pack_p0273368

    Tuya LSPA9 smart socket - teardown, OpenBeken flashing guide for CB2S, BL0942
  • #17
    p.kaczmarek2
    Level 27  
    Thanks for information. If you have some free time, please submit a pull request to our online Templates Database, here:
    https://github.com/OpenBekenIOT/webapp/commits/gh-pages/devices.json