logo elektroda
logo elektroda
X
logo elektroda

FS-05R Mini Dimmer Firmware Replacement Issue with I/O Configuration

lbelleboni 6777 52
ADVERTISEMENT
  • #31 20983335
    p.kaczmarek2
    Moderator Smart Home
    next capture, few pressess
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 20984417
    p.kaczmarek2
    Moderator Smart Home
    Baud settings:
    Settings window for UART transmission configuration with options such as RX, TX, baud rate, data bits, and parity.
    Many presses:
    FS-05R-man...resses.zip Download (2.66 kB)
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #33 20984424
    p.kaczmarek2
    Moderator Smart Home
    JSON:
    Code: JSON
    Log in, to see the code

    backup; https://github.com/openshwprojects/FlashDumps/commit/e1e5a3e588cde2f995921d5deaa0a16896d0a011

    Added after 34 [minutes]:

    Hello world:



    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    
    again:
    delay_s 1
    uartSendHex 55AA0030000300000638
    delay_s 1
    uartSendHex 55AA0030000300000032
    goto again
    


    Added after 25 [minutes]:

    Added wrapper:
    https://github.com/openshwprojects/OpenBK7231...mmit/7a9d3df40d4c20cee56ed9bfe4d9927ce44c20c1
    Script now:
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    
    again:
    delay_s 1
    tuyaMcu_sendCmd 0x30 000000
    delay_s 1
    tuyaMcu_sendCmd 0x30 0001FF
    goto again
    

    Effect:


    Helpful post? Buy me a coffee.
  • #34 20984660
    adolfonovo
    Level 7  
    Did you get it?

    YOU’RE the best!!!
  • #35 20984666
    p.kaczmarek2
    Moderator Smart Home
    I can send the control data manually but I still need to update the firmware so we have something more automatic.

    Still, you can update OBK and try the script I posted. It should work as on my video.
    Helpful post? Buy me a coffee.
  • #36 20984669
    adolfonovo
    Level 7  
    Ok. I’ll give a chance this weekend on the other device

    Thanks
  • ADVERTISEMENT
  • #37 20985892
    p.kaczmarek2
    Moderator Smart Home
    Here is almost final script, but it requires OBK update:
    
    
    // this is not really tuyaMCU but we will treat it as such
    startDriver TuyaMCU
    // set baud rate
    tuyaMcu_setBaudRate 115200
    
    // create a toggle and a dimmer
    setChannelType 1 toggle
    setChannelType 2 dimmer256
    
    
    // invoke refresh on change
    addEventHandler OnChannelChange 1 startScript autoexec.bat refresh
    addEventHandler OnChannelChange 2 startScript autoexec.bat refresh
    
    
    refresh:
    // channel 5 is temporary variable, from 0 to 255*3, multiplied also by toggle value
    setChannel 5 $CH2*3*$CH1
    // split into two bytes
    setChannel 3 $CH5/256
    setChannel 4 $CH5%256
    // send the two bytes
    tuyaMcu_sendCmd 0x30 00$CH3$$CH4$
    


    Screenshot of OBK script editor with autoexec.bat
    Result:
    OpenBK7231N dimmer control panel.
    Helpful post? Buy me a coffee.
  • #38 20986831
    adolfonovo
    Level 7  

    Hi! I tested right now and works!!! Thank you so much for your job.
    Only I noticed that the dimmable slider acts well from 0 to around 100, and reaches the highest brightness. Maybe the LED bulb I'm using hasn’t dimmable capabilities. I need to try with other type.

    Thanks a lot again
  • #40 20986852
    adolfonovo
    Level 7  

    Hi. It is that kind of led with the shape of halogen. Those to insert in the ceiling.... Do you know which ones?
  • #41 20986960
    p.kaczmarek2
    Moderator Smart Home
    Those kinds of bulbs are usually not dimmable under explicitly specified. You need to consult the information on the box/label to be sure.
    Helpful post? Buy me a coffee.
  • #42 20989028
    lbelleboni
    Level 3  

    Ciao

    Thanks for your wonderful job! Congratulations.

    But... I need your help.

    I need to use the dimmer as a normal switch, so I modify the autoexec.bat file in order to:
    - Accept the toggle signal from the external electrical switch
    - Accept the on/off command from Alexa (Wemo simulation)
    - Use an automatic delay off of 2hr

    I run it but:
    - The switch runs all the time I reset the system; it seems that does not look to last state (SetStartValue 1 -1) or force power off (SetStartValue 1 0).
    - Sometimes the system starts without reason
    - The lamps start to blink (they are not dimmable) without reason

    Maybe the two subroutines can't run together?
    Thanks in advance.
    Luca

    This is my Autoexec:
    //P0 = Switch extern
    //P7 = Switch intern (fix to CH 0 so, not used)
    //P8 = LED (Wifi_N)
    //P24 = DIM- (NOT Used)
    //P26 = DIM+ (NOT Used)
    //CH10 = timer for poweroff
    // this is not really tuyaMCU but we will treat it as such
    startDriver TuyaMCU
    // set baud rate
    tuyaMcu_setBaudRate 115200
    //Activate driver for wifi
    startDriver SSDP
    //Activate driver to simulate WEMO
    startDriver WEMO
    //Add powersave
    //PowerSave 1
    // display seconds timer
    setChannelType 10 TimerSeconds
    // set start values as "remember in flash" 
    // 0= POWER OFF   1= Remember last state
    SetStartValue 1 -1
    // 0= timer to zero   
    SetStartValue 10 60
    //Check if timer expired
    alias do_check if $CH10==0 then setChannel 1 0
    alias do_tick backlog addChannel 10 -1; do_check
    // create a toggle and a dimmer
    setChannelType 1 toggle
    //Dimmer slider Not used
    //setChannelType 2 dimmer256
    // invoke refresh on change
    addEventHandler OnChannelChange 1 startScript autoexec.bat refresh
    //addEventHandler OnChannelChange 2 startScript autoexec.bat refresh
    refresh:
    //Start timer or reset timer (7200 = 2h)
    if $CH1==1 then setChannel 10 7200
    if $CH1==0 then setChannel 10 0
    // channel 5 is a temporary variable, from 0 to 255*3, multiplied also by toggle value
    //setChannel 5 $CH2*3*$CH1
    // split into two bytes
    //setChannel 3 $CH5/256
    //setChannel 4 $CH5%256
    //FIX always the max value (ON) or zero (OFF)
    setChannel 3 1*$CH1
    setChannel 4 256*$CH1
    // send the two bytes 
    tuyaMcu_sendCmd 0x30 00$CH3$$CH4$
    again:
    if $CH10!=0 then do_tick
    delay_s 1
    goto again

  • ADVERTISEMENT
  • #43 20990100
    p.kaczmarek2
    Moderator Smart Home
    Why are you counting time that way:
    
    alias do_check if $CH10==0 then setChannel 1 0
    alias do_tick backlog addChannel 10 -1; do_check
    (....)
    again:
    if $CH10!=0 then do_tick
    delay_s 1
    goto again
    

    You can do it more easily with addRepeatingEvent or addRepeatingEventID. You can also cancel previous event by the ID.
    Helpful post? Buy me a coffee.
  • #44 20991224
    lbelleboni
    Level 3  

    Ciao p.kaczmarek2.

    I think that there is still something wrong. The device this night become crazy powering on/off random,
    I updated the OBK firmware to latest version (493), then replaced the autoexec.bat with yours version (so, just 1 driver active) and set PowerSave to 1. It is always HOT also removing physically the lamp.

    Then, the web page report an internal temperature very low (8.3 °C and less)

    Screenshot of a device user interface displaying status information and configuration options.

    And without reason, after more or less an hour, stop to work with web page but still react to physical switch.

    Your device do the same? What can I check?

    Thanks,
    Luca

    Note: the device seems to reboot automatically... Sometime I can see the web pages and the Online time has got short time.
  • #45 20991848
    p.kaczmarek2
    Moderator Smart Home
    To be sure, can you check with our script disabled? With empty autoexec.bat?
    Helpful post? Buy me a coffee.
  • #46 20992265
    lbelleboni
    Level 3  

    Ciao.

    I delete the autoexec.bat, left the device without lamp connected (as previously done) and the temperature is less respect before. The web page is still not available at the moment. This evening, when I'll be back I'll check again both, temperature, web and if it still working with the physical switch.
    Thanks again.
    Luca

    Update:
    Web page active at the moment:
    Device interface screen with buttons and status information.

    Temperature on screen 8.8°C (I don't know if for you this value has sense)
    the row with --> Online for 2' 55" meaning that the device reboot?
  • #47 20992281
    p.kaczmarek2
    Moderator Smart Home
    The 2 minutes online time means it rebooted. So it reboots even without my script?

    Okay, let's check, I will run my device now and we will see if my one is rebooting.
    User interface of OpenBK7231N system with buttons and device status information.
    I will let you know..

    Added after 1 [hours] 48 [minutes]:

    After more than hour, it's still working:
    Control panel of device OpenBK7231N_E1D4D361 showing status and configuration information.
    Helpful post? Buy me a coffee.
  • #48 20992513
    lbelleboni
    Level 3  

    Ciao.

    Can you tell me why I have the temperature and you not? I'm quite sure that I powered off the device after deleting the autoexec.bat file. For sure I forced the reboot.

    Is there a method to clean the "memory" like after the first firmware upgrade?

    This is my actual config
    Code: JSON
    Log in, to see the code

  • #49 20992588
    p.kaczmarek2
    Moderator Smart Home
    I think the temperature counter will not show if you had more than 1 boot failure. I was playing around the device so it didn't show for me. I will reboot later and check, but first I want to keep it online to see if it will break.

    3 hours uptime and counting, dimmer still works:
    A smartphone displaying an online control panel next to a lit bulb connected by wires to an electronic setup on a wooden table.
    And now 4h:
    Screenshot of the control panel for OpenBK7231N_E1D4D361 with active channel 2 set to 161.

    Added after 6 [hours] 32 [minutes]:

    Almost 11 hours online and counting, but it seems I will have to settle for this now as I need to go to sleep soon.
    No restarts so far, light is working
    Screenshot of the OpenBK7231N user interface displaying device status information.
    Helpful post? Buy me a coffee.
  • #50 20993174
    lbelleboni
    Level 3  

    My device continues to reboot.

    How can I "clean" the device by restarting from the beginning? I would like to start with your same situation.

    Thanks,
    Luca
  • #51 20993279
    p.kaczmarek2
    Moderator Smart Home
    If you have removed autoexec.bat there is not much to break things.

    I'd even rather suspect that you didn't use PowerSave from the beginning and now you have power supply issue:
    https://www.elektroda.pl/rtvforum/topic3898805.html
    This happens on low quality devices often.

    If you really, really, want to start from scratch, then see our commands list:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    You can find a clearAll command there..
    Helpful post? Buy me a coffee.
  • #52 20993803
    lbelleboni
    Level 3  
    After the command "clearall" (and still without autoexec.bat file) the device does not reboot anymore.

    Looking to the log there are a lot of message referred to TuyaMCU (the fake one) that seems to be ignored. Do you have the same?
    Regards,
    Luca

    Log extract:

    Info:TuyaMCU:Skipped data (part) BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB
    Info:TuyaMCU:Consumed 512 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB
    Info:TuyaMCU:Consumed 512 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB
    Info:TuyaMCU:Consumed 512 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB
    Info:TuyaMCU:Consumed 512 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB
    Info:TuyaMCU:Consumed 512 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB AA 3B BB AA 3B BB AA 3B BB AA 3C BB
    Info:MAIN:Time 41649, idle 50928/s, free 71856, MQTT 0(2603), bWifi 1, secondsWithNoPing 41579, socks 2/38 POWERSAVE
    Info:MAIN:Time 41650, idle 772/s, free 71944, MQTT 0(2603), bWifi 1, secondsWithNoPing 41580, socks 3/38 POWERSAVE
    Info:GEN:dhcp=0 ip=192.168.1.229 gate=192.168.1.254 mask=255.255.255.0 mac=xx:xx:xx:xx:xx:xx
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-75,ssid=InfostradaWiFi--CXXXXX,bssid=80:cc:9c:f9:7e:2a,channel=13,cipher_type:CCMP
    Info:MAIN:Time 41651, idle 64880/s, free 72176, MQTT 0(2603), bWifi 1, secondsWithNoPing 41581, socks 2/38 POWERSAVE
    Info:TuyaMCU:Consumed 8 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) 3B BB AA 3B BB AA 3B BB 
    Info:MAIN:Time 41652, idle 138467/s, free 72176, MQTT 0(2603), bWifi 1, secondsWithNoPing 41582, socks 2/38 POWERSAVE
  • #53 20994022
    p.kaczmarek2
    Moderator Smart Home
    This is normal. The dimmer sends some strange data to the WiFi module on UART which doesn't seem to be necessary for the system to work.
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around issues faced while replacing the firmware of the FS-05R smart dimmer, which lacks a clear brand identification. The user, Luca, successfully removed the CB2S module to attempt the firmware update but encountered problems with I/O configuration and device functionality. Various participants suggested that the device might not be a TuyaMCU and proposed using UART for communication. They discussed the need for galvanic isolation during UART captures to prevent damage to connected devices. Luca shared logs and configurations, seeking assistance in setting up the dimmer to function correctly with external switches and voice commands. The conversation included troubleshooting steps, firmware configurations, and the importance of capturing UART traffic to understand the communication protocol. Ultimately, Luca managed to flash the device but faced issues with random reboots and temperature readings, prompting further investigation into the device's stability and configuration.
Summary generated by the language model.
ADVERTISEMENT