SGC01 smart wifi garage opener

Hi.

I bought a swing gate opener which included a SGC01 wifi smart control. I opened it up and it’s controlled by an ESP12 I believe. I managed to flash it with EspHome, but I am struggeling on controlling the relay.

I tried to do a continuity check between COM port on relay and the different pins on the ESP without luck.

Tried a couple of “random” pin configurations in EspHome, but if I choose the wrong one I have to solder back and re-flash. Any tips on how to find the correct pin for controlling the relay?

Figured it out. For future refernce if it can help others, this is the pins for momentary switch and door sensor for this board

esp8266:
  board: esp12e

switch:
  - platform: gpio
    pin: 15
    id: relay
    name: "Swing gate"
    icon: "mdi:gate"
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: relay
    
binary_sensor:
  - platform: gpio
    device_class: opening
  # filters: 
  #   - invert:  depending on if reed switch is normally open or normally closed
    name: "Swing gate status"
    pin:
      number: 16
      mode: INPUT
1 Like

Do you know what the header pinouts are on the board to be able to flash it?

Thanks

Never mind, I’ve worked it out
SGC01-Flash Pins

Hi, i’m using the exact the same device(sgc01 smart wifi) on my sliding gate. It controlled by a xhouse app. xhouse app has no direct integration to HA. Can someone help me if there is a way to integrate this device into HA? Or can someone share how to flash this device to esphome? I would like to expose this into HA and have control locally.

Hi all, do you know if this works with Tuya / Smart Home app? Or do I have to sign up to ANOTHER app?

If you have a USB to serial adapter you can connect to the ESP chip on the SGC01 board as per @cygnus-x1 post above.

R to the serial adapters TX pin,
T to the serial adapters RX pin,
Power to power, and ground to ground.

More info on USB to serial adapters here: Getting Started - Tasmota Under Serial Programmers.

More info on connecting to the ESP board here : Physically Connecting to your Device — ESPHome Including some important notes about how to put the board in flashing/programming mode. You might have to install drivers, bridge GPIO0 and GND, and/or have to power cycle after erase and before uploading etc.

This is the code I used in ESPHome:

esp8266:
  board: esp12e

switch:
  - platform: gpio
    pin: 15
    id: relay
    name: "Swing gate"
    icon: "mdi:gate"
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: relay
    
binary_sensor:
  - platform: gpio
    device_class: opening
    name: "Swing gate status"
    pin:
      number: 16
      mode: INPUT

I got this device working in Home Assistant using XHouse IOT API calls. Unfortunately there is no local API. It all goes via http://47.52.111.184:9010/xhouseAppEncapsulation
so no SSL encryption either. However they do use timestamps and tokens in their HTTP Headers so it is somewhat secure.

I would recommend if you can flash it with ESPHome or swap it out with, dare I say, a Tuya alternative as at least they have a local API. This would likely be a drop-in replacement: Wofea WiFi Smart Garage Door Opener Controller DC12 DC24V - AliExpress
or a Konnected door opener which comes with ESPHome pre-installed: Smart Garage Door Opener White (v2) – Konnected

Anyway for anyone that would prefer to leave their XHouse IOT device as is you can use this AppDaemon code: XHouse IOT AppDaemon for Home Assistant · GitHub

I tried really hard to instead use Node-Red or n8n but I couldn’t get it to work. However using AppDaemon is super easy.

Written guide below or follow along with the video guide. https://youtu.be/U8Lxwaw6P1E

Using XHouse IOT Device with Home Assistant via AppDaemon

Step 1: Install the AppDaemon Addon in Home Assistant

If you haven’t already, install AppDaemon through Home Assistant’s Add-on Store or as a Docker container.

Step 2: Add AppDaemon .py file

Download the xhouse.py file and put it in your AppDaemon apps directory e.g.

\addon_configs\a0d7b954_appdaemon\apps

Step 3: Update apps.yaml file

Paste in the apps.yaml configuration into your apps.yaml file. Change the email and password fields to your XHouse IOT account details.

Step 4: Restart AppDaemon

After saving both files, restart AppDaemon to load the app.

How It Works

  1. AppDaemon logs in to your XHouse IOT account when it starts
  2. It hopefully discovers all your devices and creates cover or switch entities in Home Assistant (it has only been tested with the SGC01 so it might not work with other devices)
  3. It refreshes the devices state every 5 minutes (configurable)
  4. You can control your device through Home Assistant’s UI

The entities will appear as a cover or switch with entity IDs such as cover.xhouse_800421019117424640.

Please note that using this will cause your app on your phone to log out. Ideally create a second XHouse IOT account and share the device with it. That way you can use the app and Home Assistant simultaneously.

I’ve a sliding gates and the installer is offering me to configure a SGC01 smart Wifi to control it… I don’t want to go on the trouble of going through the API on the Xhouse cloud (for security reason I’m filtering traffic) and I’m not keen to re flash the ESP module (sounds fun but don’t have time and all the equipment to do it).
Would it be easier to install a Shelly module (Shelly 1 Gen3) to control the gate ?

Actually yes the Shelly would be a great alternative to the SGC01. You would likely need to do a little bit of configuring on the Shelly to get it to work how you want it but there’s heaps of videos out there explaining wiring it up, how to use it with a dry contact sensor etc.

Just wanted to drop a thank you. I was relying on google to allow me to open/close my gate using home assistant but it frequently stopped working with google saying it was offline. I had no luck flashing my particular XH-SCG01 as mine has an ESP32c2-12 and I just couldn’t get anywhere with it. This is a great alternative solution.

1 Like