AGSHOME Smart Wi-Fi Garage Door Opener tuya TYWE2S

Hi everyone
I recently received my Garage Door Opener, I spend a full day setting it up and make it work.
I am going to share very high-level steps and configurations to receive improvements, suggestions or for anyone who has the same problem.

The official framework was not working (and I didn’t want to use it in the first place :stuck_out_tongue: )
also, TUYA convert was not working due to the new official framework which was pre-installed in my case. (I am not allowed to add more than 2 link: github issue → ct-Open-Source/tuya-convert/issues/483 )

So I end up flashing ESP-Home with the help of my raspberry pi 4

TYWES2 Pinout: https://developer.tuya.com/en/docs/iot/wifie2smodule?id=K9605u79tgxug
How to flash: Flashing a Sonoff with a Raspberry Pi
Important: you need to connect Ground and GPIO_0(IO0) to initiate flash mode. connect it before powering the chip with 3v3 then immediately run the command in raspberry pi.
for each command, you need to disconnect the 3v3 and connect it again. you can keep the GPIO_0->GND connected at all times.

Or you can install default Tasmota and then install ESP-Home.

ESP home settings:
this is TYWE2S which means ESP8285

esphome:
  name: garage_door
  platform: ESP8266
  board: esp8285

And it is a TUYA

# Make sure logging is not using the serial port
logger:
  baud_rate: 0

# Enable Home Assistant API
api:

ota:

uart:
  rx_pin: GPIO3
  tx_pin: GPIO1
  baud_rate: 9600

# Register the Tuya MCU connection
tuya:

you need a binary_sensor to detect cover state, switch to change the state, and cover itself

 binary_sensor:
  - platform: "tuya"
    name: "Garage Door State"
    id: state
    sensor_datapoint: 101
switch:
  - platform: "tuya"
    id: relay
    name: "Garage Door Toggle Switch"
    switch_datapoint: 1
    internal: true
  - platform: template
    name: "Gate Remote"
    icon: "mdi:gate"
    turn_on_action:
    - switch.turn_on: relay
    - delay: 100ms
    - switch.turn_off: relay
cover:
  - platform: template
    device_class: garage
    name: "Garage Door"
    lambda: |-
      if (id(state).state) {
        return COVER_OPEN;
      } else {
        return COVER_CLOSED;
      }
    open_action:
      - switch.toggle: relay
      - delay: 100ms
      - switch.turn_off: relay
    close_action:
      - switch.toggle: relay
      - delay: 100ms
      - switch.turn_off: relay
    stop_action:
      - switch.toggle: relay
      - delay: 100ms
      - switch.turn_off: relay

Hope it helps someone.
Also, any suggestion or improvement is much appreciated :slight_smile:

4 Likes