King Q4 with ESPHOME

I flashed with ESPHOME which seems cool and functional, however something is wrong, the physical buttons work but in HA the buttons on the cover do not work and I only get a wifi LED on and off… I leave the code here but my capabilities can’t give more… if someone can help, thank you

esphome:
  name: estore_quarto
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "xxxx"
  password: "xxxx"
  
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.82
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.254
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0  

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO9
      mode: INPUT_PULLUP
      inverted: True
    name: "Abrir"
  - platform: gpio
    pin:
      number: GPIO5
      mode: INPUT_PULLUP
      inverted: True
    name: "Stop"
  - platform: gpio
    pin:
      number: GPIO4
      mode: INPUT_PULLUP
      inverted: True
    name: "Fechar"
  - platform: status
    name: "Estado"



switch:
- platform: gpio
  name: "Open"
  pin: GPIO9
  interlock: &interlock [open_cover, close_cover]
  id: open_cover
- platform: gpio
  name: "stop"
  pin: GPIO5
  interlock: *interlock
  id: stop_cover
- platform: gpio
  name: "Close"
  pin: GPIO4
  interlock: *interlock
  id: close_cover  

cover:
- platform: time_based
  name: "Cover"
  id: my_cover
  open_action:
    - switch.turn_on: open_cover
  open_duration: 70s
  close_action:
    - switch.turn_on: close_cover
  close_duration: 70s
  stop_action:
    - switch.turn_off: open_cover
    - switch.turn_off: close_cover  

output:
  - platform: esp8266_pwm
    id: blue_led
    pin: GPIO13
    inverted: True

light:
  - platform: monochromatic
    name: "Led estore"
    output: blue_led

What is a King Q4? Where did you get your info on GPIOs?

Hi, see this please :slight_smile:
https://github.com/xoseperez/espurna/issues/1513

Any progress??
I have one of these King Q4 switches and just started playing around with ESPHome…
I’ll try to flash my device!! How did you flash it? Any specific guide to follow?
I appreciate any advice!!
Thanks!!

If you follow the espurna discussion linked in post 2 you will see the espurna code linked there.

Basically the esp communicates over a uart, you’ll need to set up a uart component and send the commands. See https://esphome.io/components/uart.html#uart-write-action

OK. Now we’re on the same page… I flashed it with ESPHome and everything’s behaving just like you described on your first post.
I’ll keep digging and will let you know any breakthrough!

Any news? Have you done it?

I gave up with the King Q4 and I’m using a NodeMCU and a pair of relays instead…

I was checking the SonoffLAN integration (https://github.com/AlexxIT/SonoffLAN) documentation and it looks like it adds support to KingArt Q4 on eWelink network…
I cannot test it, since my KingArt Q4 is “bricked” with ESPHome firmware…
Maybe if someone could extract the original firmware and send it, I would be able to try it!!
Someone?? :grin: :grin:

I don’t know about King Q4, but with sonoff devices : you can’t extract the firmware from one device and flash it to another. It won’t work.

I didn’t know that… So I’m stuck with my bricked King Q4!
I forgot to extract the original firmware before flashing it… Damn!! :tired_face: :tired_face:
At least my NodeMCU solution is working great!! :slightly_smiling_face:

If you used tuya-convert it saves the firmware by default.

I flashed with ESPHome Flasher… No backups as far was I know…

Upload tasmota, it is said to work.

Hello, guys - what this?? I mean table of GPIOs.

What are you asking? It is a table of GPIOs.

If you want to know what the templates mean, the tasmota docs are very thorough.