KS-602f 3-way switch

substitutions:
  # https://esphome.io/guides/configuration-types.html#substitutions
  device_name: bedroomlight
  friendly_name: Bedroom Light
  icon: "mdi:lightbulb"
  
esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "****"
  password: "****"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Bedroomlight Fallback Hotspot"
    password: "AQBamb13afiL"

captive_portal:

# Enable logging
logger:
  baud_rate: 0
  level: none

# Enable Home Assistant API
api:

ota:

web_server:
  port: "80"


# My dimmer used the hardware serial port on the alternate pins
uart:
  rx_pin: GPIO3
  tx_pin: GPIO1
  baud_rate: 9600

# Register the Tuya MCU connection
tuya:

light:
  - platform: "tuya"
    name: "Bedroom Light"
    dimmer_datapoint: 2
    switch_datapoint: 1
    restore_mode: ALWAYS_OFF

This is what I’m trying right now.

Before hand I didnt have the restore_mode set and dimmer_datapoint was 3

on_boot is not the same as the wifi disconnecting and reconnecting.

@nickrout sounds like you are saying the toggle is happening at wifi connect. That’d make sense as when flashing the device it does restart and would need to connect wifi.

You did give me an idea that I could use onboot to narrow down the point the light is turning on.

When i have the light on and configure:

    priority: 200.1
    then:
    - light.turn_off: bedroomlight

The light will first go off and a second or so later come back on.

Even using:

on_boot:
    priority: -1000.1

light comes back on

Did you manage to identify the GPIO’s for the KS-602F 3 way switch?

@SrGeek, yes. If you scroll up to my previous comment you will see my code that includes the necessary GOIPs.

Has anyone noticed with this switch that if it is ON and you click ON it will go off. If I continue to click ON the switch toggles ON to OFF to ON. It appears that the MCU just toggles whether it gets an ON or OFF.

Hello I have tried to flash using the above diagram. My device does not seem to go into boot mode. I have IO0 sharing the ground pin from my FTDI232 serial to usb. Was there an indicator when you flashed it?

Does anyone know how this should be configured (Tasmota 8.2.0)? Using the standard Tuya MCU module selection, I can integrate with HA and hear the switch flip when clicking the HA button (led doesn’t change). When I push in the physical button on the device, I get no change in HA to reflect the button press.

Ideas?