logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

Identify Mini smart switch WiFi Relay Module with ln882hki Chip

Lesnoi 14742 35
Best answers

What chip is inside this unknown Wi‑Fi relay module?

It is an LN882H/LN882HKI-based module, with UART boot logs showing "LN882H SDK" and "LN882H WiFi Lib" from CozyLife firmware [#20839581][#20911009] One reply also matched it to a Cozylife 16A mini switch with product ID `iy9fT1`, confirming the same LN882H platform [#20911009] For further work, an LN882H SDK is available and OpenLN882H test firmware/flash tooling exists for this chip family [#20815901][#20911009]
ADVERTISEMENT
  • #31 21524408
    Ogurezzz
    Level 5  
    Posts: 10
    Rate: 2
    Here is stock firmware, dumped with Python LN882Loader script:
    [Attach deleted because flash was accidentally done before dump]

    Hope I did everything right :)
  • ADVERTISEMENT
  • #32 21524518
    divadiow
    Level 38  
    Posts: 5089
    Help: 441
    Rate: 900
    the backup is of OpenBeken, after you've flashed device. It is not the original firmware :)
  • ADVERTISEMENT
  • #33 21524782
    Ogurezzz
    Level 5  
    Posts: 10
    Rate: 2
    >>21524518
    My bad... Looks like my Win10 try was successful :)
    I will delete the file...
  • ADVERTISEMENT
  • ltchiptool rejects OpenLN882H firmware file

    #34 21691762
    badboy3004
    Level 6  
    Posts: 19
    Rate: 4
    Hello @All,

    I try to flash a smart socket with the LN882HKI chip on the PCB.
    Thanks to this forum and super how to's here. I managed to disassemble and connect it with an UART device.
    So I downloaded this file (OpenLN882H_1.18.175).
    If I try to flash it now with the ltchiptool flasher the program shows me "file is unrecognized".

    What I'm doing wrong or can you recommend me another flashing tool?
    Thanks for your support so far.

    Identify Mini smart switch WiFi Relay Module with ln882hki Chip
  • ADVERTISEMENT
  • #36 21692035
    badboy3004
    Level 6  
    Posts: 19
    Rate: 4
    Hello @divadiow,
    thank you very much.

Topic summary

✨ The discussion identifies a mini smart switch relay module based on the LN882H chip, commonly found in devices such as the Cozylife 16A mini switch (model LN-02). The LN882H chip runs firmware built on the LN882H SDK, with versions ranging from 1.8 to 2.1_rc1. Users have successfully interfaced with the device via UART, capturing boot logs and firmware details. The device firmware is not compatible with ESPHome, but OpenLN882H firmware from the OpenBeken project supports it, allowing flashing and customization. The device communicates over TCP with a cloud server on port 8899 using a proprietary protocol, and also listens on TCP port 5555 with an unknown protocol. MQTT support required buffer size adjustments for stable operation. Pin mappings and device templates are maintained in the OpenBeken IoT devices list. Firmware version display issues exist due to CMake integration challenges. Attempts to reverse engineer the communication protocol suggest it is non-HTTP and may require TCP MITM proxy tools for further analysis. Firmware backup and flashing tools such as LN882Loader are used for firmware extraction and updates. Community development is ongoing with calls for more contributors and suggestions for real-time collaboration platforms like Discord.

FAQ

TL;DR: If you have a CozyLife mini switch from AliExpress, 2 strong identifiers are the LN882H/LN882HKI marking and the UART banner; one expert reply says, "OpenLN882H official flasher" is the right tool when ltchiptool rejects the file. This FAQ helps owners identify the chip, back up stock firmware, and avoid common flashing mistakes on LN882H-based relays. [#21691770]

Why it matters: LN882H-based relays look similar to BK7231 devices, but the thread shows they need different tooling, templates, and recovery steps.

Option Works for LN882H thread cases Main use Limitation shown in thread
OpenLN882H official flasher Yes Flashing OpenLN882H_1.18.175 Must back up first
ltchiptool flasher No, file reported unrecognized General flashing attempt Rejected LN882H firmware file
ESPHome with bk72xx generic board No Tried as alternative firmware User reported it simply did not work
OpenBeken/OpenLN882H web template import Partial Apply pins/flags Does not store template metadata on device

Key insight: Treat LN882H as its own platform. The safest path in this thread is: identify the chip by marking or boot log, dump stock firmware first, then flash with the dedicated OpenLN882H tool and configure pins manually if template import is incomplete.

Quick Facts

  • Factory UART captures showed 3.3 V wiring during serial work, 115200 baud as the suggested capture speed, and repeated wifi_mcu_basic_example when the full app log did not appear. [#20974623]
  • Two stock firmware examples in the thread used Product Id iy9fT1, with Firmware Version 1.0.1 built Sep 9 2023 and Firmware Version 1.0.2 built Nov 28 2023. [#20911009]
  • One captured device entered provisioning SoftAP with IP 192.168.4.1/24, while another normal boot obtained a station IP on 192.168.2.x and logged Wi-Fi connection details. [#20911009]
  • Reported network endpoints for unflashed CozyLife behavior were outbound TCP 139.162.135.94:8899 and inbound TCP/5555, with neither protocol identified as HTTP. [#21315355]

How can I identify whether my mini smart switch uses the LN882H or LN882HKI chip before flashing it?

Check the chip marking on the PCB first, then confirm with UART boot output. The thread identifies boards marked LN882H or LN882HKI, and factory logs explicitly print LN882H SDK Ver during boot. If your relay came from AliExpress and shows CozyLife firmware plus that UART banner, treat it as an LN882H-family device before flashing. [#21691762]

What flashing tool should I use for an LN882H smart switch if ltchiptool says the firmware file is unrecognized?

Use the OpenLN882H official flasher instead of ltchiptool. A user reported OpenLN882H_1.18.175 as "file is unrecognized" in ltchiptool, and the reply pointed to the dedicated BK7231GUIFlashTool release for LN882H. Back up the original firmware before writing anything new. [#21691770]

How do I back up the original firmware from a CozyLife LN882H mini switch before installing OpenLN882H or OpenBeken?

Back it up over UART before your first flash. 1. Disassemble the switch and connect UART. 2. Read and save the stock image with an LN882H-compatible loader or flasher. 3. Verify the dump is from stock firmware, not from OpenBeken after flashing. One user accidentally dumped OpenBeken after flashing and had to discard the file. [#21524518]

Why does an LN882H relay sometimes only show repeated "wifi_mcu_basic_example" on UART instead of the full CozyLife boot log?

Because the device may reset into a basic example banner without fully reaching the CozyLife application boot. One report showed repeated ------ wifi_mcu_basic_example ------, but a full log appeared only once while the 3.3 V lead was being connected. That makes power-up timing and boot state a real edge case on these relays. [#20839581]

Which UART baud rate and BOOT pin state should I use to capture the factory boot log from a CozyLife LN882H switch?

Use 115200 baud and leave the BOOT pin ungrounded for normal factory boot output. The thread answer says the posted logs came from factory firmware, not flash mode, and BOOT should not be tied to ground for that capture. That setup is the practical starting point for CozyLife LN882H serial logging. [#20974623]

Where can I find the pin mapping or device template for the Elivco CozyLife 16A Mini Switch RMW002 with LN882H?

Use the OpenBeken devices list entry for the Elivco CozyLife 16A Mini Switch RMW002. The thread says this exact switch was already listed there when a user asked for the pin mapping after flashing. That is the reference point for recovering the correct pins. [#20943170]

How do I apply an OpenBeken template on LN882H when the import only updates pin settings and not fields like vendor, model, or name?

Apply the template for pins and flags only, then edit metadata outside the device. The thread explains that import strips fields like vendor, name, model, chip, board, and keywords, and only applies pins and flags. Those metadata fields belong to the template text for forum submission and device-list curation, not to on-device storage. [#20975378]

Why does OpenLN882H show "LN882H_Test" instead of the real firmware version in the web interface, and how is USER_SW_VER involved?

It shows LN882H_Test because the build used the default software-version string instead of a forwarded custom version. The maintainer said USER_SW_VER needs to be defined in the Makefile, otherwise a default value is used. Later replies added that the CMake-to-#define wiring was still unfinished. [#20999123]

What is MQTT Discovery in OpenBeken/OpenLN882H, and why can it fail on LN882H builds?

"MQTT Discovery" is an integration feature that publishes device details to an MQTT broker, enabling automatic entity setup in home-automation software. In this thread, it failed on LN882H because buffer sizes were too small. A fix increased MQTT_OUTPUT_RINGBUF_SIZE, MQTT_VAR_HEADER_BUFFER_LEN, and MQTT_REQ_MAX_IN_FLIGHT, but the author had not yet tested it personally. [#20953098]

What does SoftAP mode mean on an LN882H smart switch, and how is it used during Wi-Fi provisioning?

"SoftAP" is an access-point mode that makes the switch broadcast its own Wi-Fi network for setup, instead of joining your router first. The captured LN882H log showed SoftAP_Startup, wifi_start_config, and a network interface at 192.168.4.1 with mask 255.255.255.0. In this thread, SoftAP appears during provisioning when the device cannot complete normal station setup. [#20911009]

ESPHome vs OpenLN882H/OpenBeken for LN882H switches — which platform is actually supported and practical to use?

OpenLN882H or OpenBeken is the practical choice from this thread. One user tried ESPHome with bk72xx and generic-bk7231n-qfn32-tuya, and reported it simply did not work on the LN882H switch. The maintainer then stated that ESPHome does not support many such devices and pointed users to OpenBK/OpenLN tooling instead. [#21350030]

How can I help with LN882H or OpenBeken development if I own one of these AliExpress relay modules?

You can help by testing tools, porting support, or donating. The maintainer explicitly suggested testing the LN882H flash tool, trying an OBK port to the LN882H platform, or providing financial support. If you own a real AliExpress module, hardware testing is especially valuable because the maintainer said he did not have that chip on hand. [#20820592]

What protocol does the CozyLife app use to control LN882H switches over Wi-Fi if MITM proxy traffic does not show HTTP commands?

The thread does not identify an HTTP protocol, and the available evidence points to another TCP-based method. A later reply states the cloud connection is not HTTP or HTTPS, and local TCP/5555 also gave no banner or clear response. That means a normal HTTP MITM capture can miss the actual control channel. [#21315355]

Why does the LN882H device open TCP connections to 139.162.135.94:8899 and listen on TCP port 5555, and how could I inspect that traffic?

The thread suggests 139.162.135.94:8899 is used for cloud control, while TCP port 5555 is a local listener with an unknown protocol. One researcher saw no prompt, banner, or useful reply on either endpoint. He suggested inspecting it with mitmproxy in Generic TCP mode or with a Wireshark capture, because HTTP tooling alone is insufficient here. [#21315355]

What causes the "FAILED! Invalid command 'lfs_format // clear LFS'" error on LN882 firmware, and what manual configuration steps should I use instead?

It happens because the import and LittleFS flow was not set up for LN882 firmware in that build. The thread reply says the lfs_format path fails on LN882H, so the workaround is manual module configuration instead of one-click clearing and script import. Use the template as a pin reference, then set the pins manually in the web interface. [#20974623]
ADVERTISEMENT