I’ve just finished configuring the Gosund KS1/SW5, Model KS-602S, Date Code 12/2020 (motherboard identifier SW5-V1.2).
It is this item on Amazon, “Smart Light Switch, Gosund 2.4Ghz Wifi Light Switch Works with Alexa, Google Assistant, Remote Control/Voice Control and Schedule, Neutral Wire Required, Single-Pole, No Hub Required” currently: https://www.amazon.com/gp/product/B07DQDNBZ2
There was very little information about this latest version (date code 12/2020) that I could find so I’m posting to help others in case you’ve bought one of these and want to use it with ESPHome/HomeAssistant.
First: Tuya-Convert does not work with this. It has a newer ROM which requires serial flashing.
** be sure this is not connected to AC when working on it **
Open the case by removing the four T6 screws. The board will come out easily. Detach the WiFi antenna.
The serial pads are VERY TINY and along the side of the board. I found probe grabbers worked best for this connection. Set the serial port to 115200 bps and be sure you are providing 3.3V of power from your USB TTL.
You must connect ground from the TTL to both the “GND” pad and the “IO0” pad, the GPIO0 must be low to put it in flash mode. Connect the power only once you have your flash tool connected to the serial port and ready to go. Remove the connection from the “IO0” pad in order to get the device to boot normally.
Note that the red and green LED are in exactly the same place, so if you turn them both on at the same time you get a sort of yellow color, although it’s mostly green.
The ESPHome config below will expose to HomeAssistant:
- On/Off of the connected lights
- On/Off control of the Red LED
- Dimmable control of the Green LED
- Various WiFi Sensors, Reboot button, etc.
esphome:
name: family_room_lights
platform: ESP8266
board: esp01_1m
wifi:
ssid: "yourssidhere"
password: "yourpasswordhere"
domain: ".home.yourdomain.com"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Family Rm ESP Fallback"
password: "APFallBackPasswordHere"
captive_portal:
prometheus:
# Disable logging
logger:
# ESP8266 only - disable serial port logging, as the HeatPump component
# needs the sole hardware UART on the ESP8266
baud_rate: 0
# level: VERBOSE
# Enable Home Assistant API
api:
password: "APIPasswordHere"
reboot_timeout:
hours: 1
ota:
password: "OTAPasswordHere"
#https://templates.blakadder.com/gosund_KS-602S.html
#status_led:
# pin:
# number: GPIO16
web_server:
port: 80
time:
- platform: homeassistant
id: homeassistant_time
timezone: America/New_York
# Text sensors with general information.
text_sensor:
# Expose ESPHome version as sensor.
- platform: version
name: "Family Rm Lights ESPHome Version"
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: "Family Rm Lights IP"
ssid:
name: "Family Rm Lights SSID"
bssid:
name: "Family Rm Lights BSSID"
# Sensors with general information.
sensor:
# Uptime sensor.
- platform: uptime
name: "Family Rm Lights Uptime"
internal: true
# WiFi Signal sensor.
- platform: wifi_signal
name: "Family Rm Lights WiFi 2.4GHz Signal Strength"
update_interval: 60s
# GPIO00 Button1
# GPIO02 Led2i (On/Off state?)
# GPIO14 Relay1
# GPIO16 LedLinki (Device status, e.g. wifi broke)
# Source: https://templates.blakadder.com/gosund_KS-602S.html
binary_sensor:
- platform: gpio
name: "Sensor for Button Presses"
internal: True
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
id: switch_button_1
on_press:
then:
- switch.toggle: relay_14
output:
- platform: esp8266_pwm
id: green_led2_pwm
pin:
number: GPIO2
inverted: True
light:
- platform: monochromatic
output: green_led2_pwm
id: led2
name: "Family Rm Green LED"
restore_mode: RESTORE_DEFAULT_OFF
switch:
- platform: restart
name: "Family Rm Lights ESP Restart"
#LED 16 is Red, inverted output
- platform: gpio
name: "Family Rm Red LED"
id: "led16"
pin:
number: GPIO16
inverted: True
icon: "mdi:led-on"
restore_mode: RESTORE_DEFAULT_OFF
- platform: gpio
name: "Relay controlling the actual lights"
pin: GPIO14
id: relay_14
restore_mode: RESTORE_DEFAULT_OFF
internal: True
- platform: template
name: "Family Rm Lights"
internal: False
id: family_rm_lights
icon: "mdi:light-switch"
lambda: |-
if (id(relay_14).state) {
return true;
} else {
return false;
}
turn_on_action:
- if:
condition:
- switch.is_off: relay_14
then:
- switch.toggle: relay_14
turn_off_action:
- if:
condition:
- switch.is_on: relay_14
then:
- switch.toggle: relay_14