logo elektroda
logo elektroda
X
logo elektroda

[RTL8710CF] How to Reflash Firmware on Kasa HS200 WiFi Smart Switch (US)

Jerther 3984 44
ADVERTISEMENT
  • #31 21606026
    Jerther
    Level 5  
    Yes, there are two LEDs that make 3 colors for WiFi state. This is the best I could come up with.
  • ADVERTISEMENT
  • Helpful post
    #32 21616306
    madlac1971
    Level 6  
    [postid:5cf6093b1a][/postid:5cf6093b1a]
    new HS200 off Amazon
    Printed circuit board with electronic components and a glowing green LED
  • #33 21617958
    Jerther
    Level 5  
    I have annotated the picture with the relevant pads for flashing
    PCB with annotated GPIO0, RX, TX, and 5V pads for flashing
  • ADVERTISEMENT
  • #34 21622345
    madlac1971
    Level 6  
    >>21617958 Managed to flash it finally, thx for the info.
    Before I start experimenting and reinventing the wheel, anyone has the template for this new board? Toggle from the GUI turns on the white LED but nothing else works.

    Added after 3 [hours] 57 [minutes]:

    >>21622345 Well, had some time on my hand and figured it out (mostly): red-on, green-off w/ flashing white when searching for wifi. 19 is the reset button, not sure what to do with it. Restart button works w/o mapping it.
    "pins": {
    "2": "LED_n;0",
    "3": "LED;0",
    "4": "WifiLED;0",
    "17": "Btn_n;0",
    "18": "Rel;0",
    "19": "Btn_n;1"
    },
  • ADVERTISEMENT
  • #35 21622833
    p.kaczmarek2
    Moderator Smart Home
    Probably restart button is connected to CEN.
    Helpful post? Buy me a coffee.
  • #36 21623063
    Jerther
    Level 5  
    p.kaczmarek2 wrote:
    Probably restart button is connected to CEN.

    It is.

    The reset button is just another GPIO.

    I thought the template was complete for this device?
  • ADVERTISEMENT
  • #37 21623141
    madlac1971
    Level 6  
    >>21623063 As you can see, the pin-out is (almost) completely different than the original version...
    Original (yours):
    "4": "LED_n;0",
    "7": "LED_n;1",
    "8": "Rel;0",
    "9": "LED_n;1",
    "12": "Btn;0",
    "19": "Btn;1"

    New model:
    "2": "LED_n;0",
    "3": "LED;0",
    "4": "WifiLED;0",
    "17": "Btn_n;0",
    "18": "Rel;0",
    "19": "Btn_n;1"
    The red/green LED is 2pin bicolor, depending on the voltage polarity it seems.

    Two-color LED connected between two GPIO pins via a 330-ohm resistor

    Could someone add this to the database?
  • #38 21623235
    Jerther
    Level 5  
    The "original" template has been updated recently. Check earlier in this thread, I made a pull request on GitHub with the updated template which includes a script for the reset button.

    IIRC that PR was merged.
  • Helpful post
    #42 21767614
    sabertooth13
    Level 4  
    I updated the template for the new variant.

    - Set the button time to 0ms for instant switching.
    - Fixed the reset button to actually put into safe mode (press and hold 5sec).
    - Green LED: Always OFF
    - Red LED: Used as Wifi status LED (when connected to WiFi it stays OFF)
    - White LED: turns off when Relay is ON; LED is ON when Relay is OFF

    Code: JSON
    Log in, to see the code
  • #43 21796087
    sabertooth13
    Level 4  
    >>21767614 I updated pin 17 to be Btn instead of Btn_n in the above template. I had the same issue as >>20756665, where I had to double press the button to turn on the light and the log was noisy with Button_OnLongPressHold.
  • #44 21796153
    p.kaczmarek2
    Moderator Smart Home
    So Btn works good for you?

    Btn is for an active-low button. It's a button on GPIO that has a pull up (default high state) and the button itself shorts it to ground when pressed. It's the most common approach used in Tuya products. The pull up resistor is built-in in Beken MCU. I have never seen yet a device that requires Btn_n.
    Helpful post? Buy me a coffee.
  • #45 21796863
    sabertooth13
    Level 4  
    >>21796153 Yes, Btn works for me. With Btn_n, I was having to press the button twice to initially toggle the switch (same issue as mentioned in this thread: >>20756665)

    In hindsight, it makes sense since pin 19 in the original template from earlier in this thread was also set to Btn_n. It was causing the switch to boot loop into safe mode.

Topic summary

The discussion focuses on reflashing the firmware of the TP-Link Kasa HS200 WiFi Smart Single Pole Light Switch using the RTL8710CF microcontroller. The device's PCB is accessible by prying open the case, revealing clearly labeled pads for serial connection. Bootloader mode is enabled by shorting GPIO0 to 3.3V and restarting the MCU. A partial firmware template was shared, enabling relay and main LED control, with mapping for the reset switch and tri-color WiFi LED. Users explored LED behavior customization, noting the WiFi LED uses pins P7 and P9 to produce green, red, and amber colors, but replicating the original LED patterns proved challenging. Suggestions included scripting pin roles dynamically based on WiFi state. Firmware versions supporting RTL8710C were discussed, highlighting improvements in WiFi reconnection and OTA update capabilities. OTA updates are not implemented in early versions (e.g., 1.18.12) but are available via the Web App in later releases. Issues with WiFi reconnection after outages were reported, with some devices requiring manual restart. Contributions included a pull request to enable the reset button to trigger safe mode. Newer switch batches with different board layouts but the same MCU were mentioned, with test points remaining accessible for reflashing.
Summary generated by the language model.
ADVERTISEMENT