logo elektroda
logo elektroda
X
logo elektroda

How to flash LN882H with open source Tasmota/Esphome style firmware - backup procedure included

p.kaczmarek2 42666 297
ADVERTISEMENT
  • #61 20979060
    voodoopt
    Level 9  
    I flashed two units and they had the same mac address. The problem is that when I change the address I can no longer access the devices.
  • ADVERTISEMENT
  • #62 20992867
    yoker77
    Level 4  
    I cannot change the IP address from DHCP to static. The entries are ignored. Am I doing something wrong or is the feature not yet supported?
  • #63 20996036
    Advian1
    Level 6  
    voodoopt wrote:
    >>20958708
    Work on c:
    the problem is correct baud 115200 ;)


    Hi, Having same issue here.
    tried the following:
    1. disabled antivirus
    2. ran cmd as admin
    3. tried from E drive
    4. tried different baud rates
    5. tried short cables
    6. ch340 adapter

    getting "Fail. Error downloading file."
    dump was successful I think.

    Anything else I should try?
  • #64 20996330
    yoker77
    Level 4  
    Have you changed the baud rate in the command line?
    Should look like this: LN882H_CMD_Tool.exe COM7 download flash 115200 0x0 flashimage.bin
  • #65 20996463
    Advian1
    Level 6  
    yoker77 wrote:
    Have you changed the baud rate in the command line?
    Should look like this: LN882H_CMD_Tool.exe COM7 download flash 115200 0x0 flashimage.bin


    That's baud rate? of course it didn't work for me before, My adapter doesn't even support 2M baud rate.

    Setting it to 115200 immediately worked.

    Thanks a ton!

    and of course thatnks to pkaczmarek2 for supporting all these chipsets!

    Added after 4 [hours] 1 [minutes]:

    Hi, Device is getting too hot.
    Screenshot of an IoT device interface showing an OFF state with a red Toggle 0 command and internal temperature of 65.6°C.

    Powersave is not available?
    Screenshot of a command line tool with information about power saving.

    Added after 2 [minutes]:

    voodoopt wrote:
    I flashed two units and they had the same mac address. The problem is that when I change the address I can no longer access the devices.


    I was able to change the MAC without any issue at all.
    Make sure the MAC is valid.
    Also the device IP will likely be changed. So look for the new IP in the router before you attempt to connect.
  • #66 20997075
    yoker77
    Level 4  
    Does assigning a fixed IP address work for you?
  • ADVERTISEMENT
  • #67 20997185
    p.kaczmarek2
    Moderator Smart Home
    Static IP address is currently unimplemented.
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/hal/ln882h/hal_wifi_ln882h.c
    This function needs to be updated:
    Code: C / C++
    Log in, to see the code


    Added after 5 [minutes]:

    @Advian1 I can try to add powersave command tomorrow
    Helpful post? Buy me a coffee.
  • #68 20997209
    yoker77
    Level 4  
    Does this mean that I have to compile flash.bin myself? Or how should the command be executed? There is no terminal access.
  • #69 20997368
    Advian1
    Level 6  
    yoker77 wrote:
    Does assigning a fixed IP address work for you?


    I do that from router.
    Because then I can manage all devices in one place, rather than setting it up in individual devices.
    With different MAC addresses that isn't a n issue.

    Added after 2 [minutes]:

    p.kaczmarek2 wrote:

    @Advian1 I can try to add powersave command tomorrow


    Thanks 😍.

    I don't think these devices will last much longer with that kind of temp even at no load.
    So powersave option will be helpful.
  • #70 21007524
    p.kaczmarek2
    Moderator Smart Home
    I've added powersave command, usage:
    
    PowerSave 1
    

    in short startup command will enable powersave, and similiarly:
    
    PowerSave 0
    

    will disable it.

    Keep in mind to execute PowerSave in startup command so it is enabled on every boot.

    Can anyone check if its working correctly?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #71 21007589
    Advian1
    Level 6  
    p.kaczmarek2 wrote:
    Can anyone check if its working correctly?


    Thanks a lot. ❤️
    I'll test.

    Added after 1 [hours] 10 [minutes]:

    >>21007524
    not sure if it worked very well.

    power consumption of the device from the wall is 0.6W while off and 1.1W when On. (220v)
    Same after enabling PowerSave.
    Temparature is vey high as well 74C at on state, no load connected.
    Interface of the Smart_Switch_2 tool showing a command panel with the PowerSave 1 command selected.
  • #72 21007792
    divadiow
    Level 34  
    I'm using the Atorch S1 to measure an LN882H RMW002 mini switch, no load attached. Starting with 1 hour of powersave 0 then will do powersave 1. Will post HA history after. Hopefully the value factors are all correct

    Screenshot of measurement data from the Atorch S1 device, showing current, frequency, voltage, and temperature values.

    Atorch S1 meter display showing various electrical measurements.

    Hopefully the S1 is sensitive enough to give meaningful results
  • #73 21007824
    p.kaczmarek2
    Moderator Smart Home
    Just make sure that your command is actually executed. Short startup command is run only at startup, so you need to reboot after setting..
    Helpful post? Buy me a coffee.
  • #74 21007837
    divadiow
    Level 34  
    Yes. Set in autoexec and mqtt broadcast to every 10s

    Added after 1 [hours] 3 [minutes]:

    which measurements are of most interest? just noticed kwh has not come through for the last hour.

    This is powersave 0 for 1 hour

    WATTS
    Line chart showing power changes over time from 3:00 PM to 4:00 PM.

    AMPS
    Graph showing current measurement in amperes, with regular fluctuations on the timeline from 3:00 PM to 4:00 PM.

    Added after 43 [minutes]:

    divadiow wrote:
    Yes. Set in autoexec and mqtt broadcast to every 10s


    I of course didn't mean autoexec because there's no LFS in LN. but yes start-up command

    Screenshot of the OpenBK_LN882H_Mini_16A_noPM interface with a startup command field.

    The Atorch has mqtt_broadcastInterval 10
  • #75 21010486
    Advian1
    Level 6  
    >>21007792
    these readings are close to what I'm getting.
    Did you get the chance to test with powersave 1 ?

    Also what's your internal temp?
    I'm afraid to put this inside the switch box. the internal temp shows over70C at no load while it's outside.
    No idea what's gonna happen if I put inside the switch box where there's no airflow at all.
  • #76 21010488
    divadiow
    Level 34  
    negative. I need to nail HASS and be sure I'm doing it right
  • ADVERTISEMENT
  • Helpful post
    #77 21013678
    charleswill2014
    Level 1  
    I used the baud rate from the tutorial but it didn't work for recording only to extract the original system, when using the 115200 it worked perfectly, my mini switch rmw002 has the following configuration:
    A0-DINPUT_N 1
    A1-REL 1
    B3-LEN_N 1
    B8-BTN 1
    Close-up of an electronic module with LN-G2 chip held in a hand.
    Photo of a mini smart switch with a visible technical label and connected wires.
    OpenLN882H system interface with status information.
    Screenshot of a Windows command prompt window showing attempts to transfer a file via serial port.
  • #78 21014435
    p.kaczmarek2
    Moderator Smart Home
    @charleswill2014 good job and welcome to forum! So, it's the same device as the one already on our list?
    A screenshot showing a device list filtered by keyword rmw002 with one device displayed.

    @divadiow any news on power save test?
    Helpful post? Buy me a coffee.
  • #79 21014606
    divadiow
    Level 34  
    p.kaczmarek2 wrote:
    @divadiow any news on power save test?
    I'm really sorry, I lost confidence and moved onto something else. It's probably really basic. I'll do it asap.
  • #80 21015687
    divadiow
    Level 34  
    so this is a night of Powersave 0 with relay CLOSED (switch on). Are the intervals close enough? is it granular enough? I did set mqtt_broadcastInterval 10 and flag 2, but measurements are still coming through to HA every minute, that or HA is only logging every minute.

    Is there anything I should change before redoing for Powersave 1?

    On the Atorch the measurements do change a lot more frequently, so that one snapshot of the readings every minute doesn't seem like it will give a good feel of the devices real usage



  • #81 21015700
    p.kaczmarek2
    Moderator Smart Home
    I would suggest just doing PowerSave 1 test now and then we can decide whether we need to adjust the measurement method or not.
    Helpful post? Buy me a coffee.
  • #82 21016110
    divadiow
    Level 34  
    OK. so here is Powersave 1 over a different length of time. Powersave 1 set in startup command and device rebooted twice before measurement started. As before, relay closed.

    I asked ChatGPT4 to analyse, normalise, adjust for differing lengths of measurement and it gave me this. I know it could be wrong. At the moment I'm not sure what to make of it.

    Code: Text
    Log in, to see the code
  • #83 21016408
    p.kaczmarek2
    Moderator Smart Home
    Maybe we need a more precise method of measurement. Like a simple multimeter checking the current consumption on the 3.3V rail.
    Helpful post? Buy me a coffee.
  • #84 21016423
    max4elektroda
    Level 20  
    >>21007524
    If you would like some other input: What could I do to test?

    Sorry to say, but at least in my first test I can't see any difference, but that might be my very simple "testing setup".
    I'm testing on a module soldered out, so its just the plain module and I'm measuring the current with a cheap multimeter.
    I can see no difference in the used current (about 90 mA when WiFi started) with "PowerSave" set to 0 or 1.
    Also temperature is very similar (around 35°C)

    Or do I have to wait for some time, to see an effect?
    Do I need some other settings to test?
  • #85 21016605
    p.kaczmarek2
    Moderator Smart Home
    Well, we were testing powersave on BL602 in the past here:



    and effect was noticeable.
    Here is the LN882H call:
    Screenshot of a code snippet related to power-saving update on the LN882H platform.
    Maybe the call is incomplete. It seems to lead only to:
    https://github.com/openshwprojects/OpenLN882H...3526/components/utils/system_parameter.c#L408
    Code: C / C++
    Log in, to see the code

    Maybe I should also call:
    Code: C / C++
    Log in, to see the code

    to apply the change in realtime, not just to save it in LN KV.
    The source code of wifi_sta_set_powersave is not visible anywhere, but let's give it a try...
    I've added the change here:
    https://github.com/openshwprojects/OpenBK7231...mmit/83d53cf82c58b61a02cdfb7e6661aa37176f7a8c
    Can you @divadiow retry with PowerSave 1 on 1.17.516?
    Helpful post? Buy me a coffee.
  • #86 21016739
    max4elektroda
    Level 20  
    For me 1.17.516 sadly doesn't seem to change the current - toggling between 88 and 89mA - regardless if PowerSave is 0 or 1 :-(.


    BTW - since the version reports "LN882H_Test":

    I added
    
    add_definitions( -DUSER_SW_VER="LN882H_$(APP_VERSION)" )
    

    to
    sdk/OpenLN882H/project/OpenBeken/CMakeLists.txt


    giving me Screenshot of the OpenLN882H interface with diagnostic information, configuration buttons, and software version details.
    Will this include the "official" version on a release build?!?
    At least you should be able to adjust it that way ...

    Thanks!
  • #87 21017627
    divadiow
    Level 34  
    Oooh @max4elektroda hopefully a real release will come with proper build version!
  • #88 21018533
    divadiow
    Level 34  
    I was just poking around the Lightning Semi Gitee to see if there were any interesting commits to the code on any branches since it was all discovered and used to create LN OBK. I also checked LN_Customer ftp sites logins to see if there was anything new but the sites are down for me at the moment.

    Screenshot showing two computer icons next to email addresses: LN_Customer@sh.lightningsemi.cn and LN_Customer02@sh.lightningsemi.cn.

    any of these commits of interest?

    List of code commits on Gitee for the Lightning Semi project.

    https://gitee.com/lightningsemi/ln882h/compare/master...frozen_mode

    Screenshot showing code changes made on Gitee by Chao_Ju, related to the ln_pm.c file.
    https://gitee.com/lightningsemi/ln882h/commit/6121af45a6a423c53fcc1adbb261b3d7d6bc1985

    Screenshot of a commit list on Gitee for a project named ln882h.
    https://gitee.com/lightningsemi/ln882h/compare/master...custom-imou

    Screenshot showing the Gitee comparison interface for the Lightning Semi repository.
    https://gitee.com/lightningsemi/ln882h/compare/master...LN_IMOU

    there are more

    https://gitee.com/lightningsemi/ln882h
  • #89 21018569
    max4elektroda
    Level 20  
    That really looks promising: Fixes in power save, implementation of littlefs, ...
  • #90 21018608
    p.kaczmarek2
    Moderator Smart Home
    Maybe we just need another call. Let's consider the app base:
    https://github.com/openshwprojects/OpenLN882H/blob/master/project/OpenBeken/usr_app.c
    This call looks interesting:
    C code snippet with a function setting sleep mode.
    This header seems related:
    https://github.com/openshwprojects/OpenLN882H...aster/components/utils/power_mgmt/ln_pm.h#L52
    Maybe we should try using:
    Code: C / C++
    Log in, to see the code

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

    I can try to plug it into PowerSave call in separate PR in a hour or two.
    Helpful post? Buy me a coffee.

Topic summary

The discussion focuses on flashing the LN882H module with open-source firmware such as Tasmota or ESPHome, detailing the necessary hardware setup, including the use of a USB to UART converter and a reliable 3.3V power supply. Users share experiences with various programming tools, troubleshooting flashing errors, and the importance of using the correct baud rate (115200) for successful firmware uploads. The conversation also touches on issues related to power consumption, the implementation of power-saving modes, and the challenges faced when trying to reset configurations or passwords in the firmware. Additionally, there are mentions of specific devices using the LN882H chip and the need for community support in resolving technical issues.
Summary generated by the language model.
ADVERTISEMENT