Zemismart KS-811 working with ESPHome!

Hi everyone.

Still pretty new here, but i got myself a zemismart 2 way switch, and decided to trace it out and get ESPHome to work on it.
I wanted to share it here, so other people might find it? I only bought the 2 switch one, but traced it as best i could for all of them… Works so good! will be buying more for sure!

image

I couldnt be bothered drawing this up in Altium as i dont have all the right footprints handy, but here is a hand drawn schematic (as best i could figure out anyway)

Pinouts:
Inputs;
[edit] i have all 3 switches now, and these were the pinouts i found;
1 way - GPIO0
2 way GPIO16 top, GPIO5 bottom
3 way GPIO16 top, GPIO5 middle, GPIO4 bottom

Outputs;
Status LED GPIO2
Load 1 GPIO13
Load 2 GPIO12
Load 3 GPIO14

8 Likes

Wow they have an AU/NZ switch. Order time…

2 Likes

Example someone asked for of my 2 switch code

esphome:
  name: ds_bathroom_2way
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "SSID"
  password: "PASS"

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

# for pinout/schematic 
# https://community.home-assistant.io/t/zemismart-ks-811-working-with-esphome/

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO16
      mode: INPUT
      inverted: True
    name: "Top"
    on_press:
      - switch.toggle: load1
  - platform: gpio
    pin:
      number: GPIO5
      mode: INPUT
      inverted: True
    name: "Bottom"
    on_press:
      - switch.toggle: load2

switch:
  - platform: gpio
    name: "DS Bathroom Top"
    pin: GPIO13
    id: load1
  - platform: gpio
    name: "DS Bathroom Bottom"
    pin: GPIO12
    id: load2

status_led:
  pin:
    number: GPIO2
    inverted: yes

sensor:
  - platform: wifi_signal
    name: "DS Bathroom WiFi signal"
    update_interval: 60s

  - platform: uptime
    name: "DS Bathroom uptime"

text_sensor:
  - platform: version
    name: "DS Bathroom ESPHome version"
1 Like

@neilvangeffen

I have found this guide very helpful, thank you for taking the time to map the GPIOs and also to publish them!

1 Like

No problem! im glad someone found them helpful :slight_smile:

I really did. I 3D printed a backbox and ran a cable and plug out of it to plug in behind the sofa. I have set the three buttons up as binary sensors with the “on” action being to call a script that sets the lights and some other stuff (sort of enhanced scenes) that I can use when I sit down to watch TV or when I stand up again afterwards. I am trying to not walk around with my mobile so much (fighting the battle for less screentime) so having these buttons is very useful.

How have people actually flashed these things so far?

Soldered to tx/rx on the pcb?

Is there some OTA way to do it like tuya-convert or sonota?

A mind meld?

I tried Tuya convert but gave up after an hour, it is possible that the one I had has a later version of the firmware that doesn’t work.

I ended up removing 4 screws to discover TX,RX,3.3V,GND and IO0 pins exposed (no soldering required) for a serial flash. Took me 5 mins after that! All very easy and totally non-destructive.

1 Like

Same, i used serial as well to flash the first time. Then just OTA as per usual

1 Like

How did you put it into boot mode?

Short io0 pad to ground while you turn it on :slight_smile: that puts it into bootloader mode

Brillant… Thank you.

I have a single gang version of this switch.

I just cant seem to get the correct GPIO for the physical switch.

Not sure if this helps but here is an image of the board.

And this is my current code. I have tried a combination of most GPIO’s but I just cant seem to crack it. I just hope my YAML is not incorrect.

esphome:
name: office_switch
platform: ESP8266
board: esp01_1m

wifi:
  ssid: "###############" 
  password: "###############"

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

# for pinout/schematic 
# https://community.home-assistant.io/t/zemismart-ks-811-working-with-esphome/

## Top Switch
#Checking for GPIO Pins
#Possibilities are:
#1
#02 NO
#3 no
#4 no
#5 no
#6 no - Breaks
#7 no - breaks
#8 breaks
#9 breaks
#10 breaks
#11 breaks
#12 No
#13 no
#14 no
#15 no
#16 no

#Fining the Binary
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO16 #looking for this GPIO?????
      mode: INPUT
      inverted: True
    name: "Top"
    on_press:
      - switch.toggle: load1
#PASSED      
switch:
  - platform: gpio
    name: "Office Switch"
    pin: GPIO12  #This works as a virtual switch on Hassio. 
    id: load1

#PASSED
status_led:
  pin:
    number: GPIO2 #LED light also works
    inverted: yes

Should be GPIO5?

Nope, just tried 5 (and on a second device) and no luck.

Just tried 16 again and nothing. @neilvangeffen is there a method you used to determine the GPO’s?

Hi @Hans_van_der_Drift
I unfortunately have a different model than you do. Mine is version 1.3 and yours is 1.2
They look very similar but not the same.

It looks like you have a 0R jumper on R23, and mine is on R19, so your switch actually goes to GPIO0.
So as long as you make sure you dont press the button down as the power comes on, you’ll be fine!

So try that :slight_smile: guessing thats the only one you hadnt tried yet??

Brilliant. That was it. Hiding in plain sight as sometimes obvious solutions do.

no problem, glad you got it working!

Some one knows if a EU version of this one or other esphome compatible wifi switches with wall mount and real physical (push) buttons exist? This touch things are just pain in a real life scenario…