KS-602f 3-way switch

I was curious if anyone flashed ESPhome onto a KS-602f WiFi 3-way switch. I’m going to be installing one probably tomorrow. I found a yaml file for the Moes one, hopefully they are the same.

3 Way Smart Wi-Fi Light Switch Plus, Single Pole/3 Way Switch, Works With Amazon Alexa Google Assistant & IFTTT,Remote Control, Timing Function No Hub Required(1-Pack) https://www.amazon.com/dp/B078ZP8KK2/ref=cm_sw_r_cp_api_i_gXOlDbKXVGQ8S

I finally got around to trying to flash this guy. Tuya Convert didn’t work.l, but there was a header for all the needed pins. Turns out everything is controlled by the MCU and the esp is just for communication. I flashed Tasmota and used the Tuya Dimmer base. I can control the light and get current state from Power1.

Is it in fact a dimmer?

No, just an on/off 3-way switch. All controls are handled in the mcu with serial commands. I chose the Tuya Dimmer base because it communicates to the mcu through the Tuya Rx/Tx. It worked so I didn’t spend any more time on it trying to figure out the codes.

1 Like

Hey there - do you have an article of how to communicate with the MCU? I’ve written my own firmware for the esp8266ex however since it talks to the MCU I’m at a bit of a loss of how the hardware serial was working - that being said, is there places to get the default bin files for a bin walk of any kind? The MCU has no marking whatsoever so I have no idea what pinouts are - and the TX/RX on the board for the MCU doesn’t seem to do anything either. Looks like only GPIO0 is connected and the rest of them from the 8266ex are not connected to anything - Or, can you help me duplicate your efforts in some way?

I’d be looking at the tasmota source.

Nick is right, look at the Tasmota source. I’m of no help when it comes to how the code works. From the esp, it uses the regular GPIO 1 for tx and GPIO 3 for rx. I’d love to hear if you can figure it out because ideally I’d like to switch this over to ESPhome since that is what everything else I have is.

Do you happen to have documentation of how to do that part? I’ve never done that Tuya flashing or tasmota? Losing my mind over this one. don’t know how to make the wifi talk to the mcu as I know nothing about hardware serial

Unfortunately I have no idea how it communicates.

Yes but Tasmota does and their code is open source. So look at the code and look at the config and translate it to esphome.

Or don’t, and be happy with tasmota.

How did you get the chip into flash mode. I cannot seem to get tasmota to flash to it. I used the header in the top right have not had any success.

1 Like

I didn’t have an issue with getting it to flash. Just make sure GPIO0 is pulled low when it boots up.

Did you have it wired up to the usb to serial adapter like this? Did you solder in wires or just push Dupont connectors in the holes?KS-602F_wiring

1 Like

Yeah, that’s how I wired it. I use a NodeMCU with EN pulled to ground for flashing, but it’s the same as the usb to serial adapter. I didn’t solder, I just push the wires in place and hold at an angle to make contact. I think I got it to flash on the first try.

Did any of you get the KS-602F working with ESPHome? I successfully used Tuya Convert to get custom flash on it no problem, but having trouble finding an ESPHome yaml config that lets me actually operate the switch. https://esphome.io/components/light/tuya.html Isn’t too much help as the GPIOs and such in the example aren’t necessarily for this particular model of switch.

Ok, just kidding. I got the right UART pins and it’s working now. Here is the config I used in case anybody else happens along this thread looking for info. (My .common.yaml includes all the other config you need (api, wifi creds, etc.))

ESPHome makes you define a dimmer ‘datapoint’ even though this is not a dimmer, just a 3-way switch. It seems to work fine as it is and I just used the example value form the ESPHome docs.

I don’t see any way to control the LEDs or interface with the button or relay directly, which is a real bummer as I change the normal LED pattern on my other switches to be off when the light is off. The default for this switch is green when off and red when on. I would also love to access double-press or long-press functionality, but not seeing a way here… :frowning_face:

substitutions:
  device_name: kitchencounters       # hostname & entity_id
  friendly_name: Kitchen Counters    # Displayed in HA frontend

logger:
  baud_rate: 0
  
<<: !include .common.yaml

esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp01_1m

uart:
  rx_pin: GPIO3
  tx_pin: GPIO1
  baud_rate: 9600

# Register the Tuya MCU connection
tuya:

# Create a light using the dimmer
light:
  - platform: "tuya"
    name: "${friendly_name}"
    dimmer_datapoint: 3
    switch_datapoint: 1

Have you seen that when flashing this light or if WiFi disconnects and reconnects the switch toggles?

I haven’t actually noticed what mine specifically does yet (I just got it installed), but one of the (imo very few) advantages of the separate MCU model is that you can flash the chip all day and it won’t affect the basic switch functionality or state of the switch since that is all controlled separately. So, neither event should affect the light unless you ESP code was actually altering the state on boot or something like that.

I was thinking state on boot, just cant find a setting to get it not to toggle.

Was a bigger issues when i had the router restarting on Saturdays at 4am and being woken up by the light turning on! :smiley:

@latic What’s your full YAML? Maybe it has to do with the default restore_mode: setting for a light:?