Esphome Sonoff TH Origin THR316

Hello I try to flash my sonoff th origin (THR316) with esphome without success.

Any one can help me on this config file? I have updated GPIO Sonoff TH Origin 16A Switch Module (THR316) Configuration for Tasmota but it doesn’t started as expected.

  device_name: sonoff-temp

  board: nodemcu-32s

  ssid: !secret wifi_ssid_house_iot
  password: !secret wifi_password_house_iot
  fast_connect: true


  rx_pin: GPIO16
  baud_rate: 4800
  - platform: cse7766
    update_interval: 30s
      name: ${device_name} Current
      id: a_sensor
      name: ${device_name} Voltage
      id: v_sensor
      name: ${device_name} Power
      id: w_sensor
      name: ${device_name} Energy
      id: wh_sensor
  - platform: wifi_signal
    name: ${device_name} Wifi Signal Strength
    update_interval: 60s
  - platform: uptime
    name: ${device_name} Uptime

  - pin: GPIO27

  - platform: gpio
      number: GPIO0
        input: true
        pullup: true
      inverted: true
    name: "Sonoff Button"
      - switch.toggle: relay

  - platform: gpio
    name: "Sonoff Relay"
    pin: GPIO21
    id: relay

    number: GPIO16
    inverted: yes

Thanks for your help.

Logs? Where are they?

Hello @nickrout sorry, here you can find the logs:

I’m also in the process of flashing/setting up a Sonoff THR316 right now. Managed to get it to boot, next step is to configure the button/relay/leds and temp sensor (ds18b20). It wouldnt boot with power from the FTDI (boot loop, apparently it doesnt deliver sufficient power), worked fine when connected to mains (disconnected the FTDI).

Btw you have a power meter in your config but the THR316 doesnt have one

Hello @sneakyfoxy thank you for your answer.
I tried to configure it with the minimum configuration (no button etc…) But I also have a boot loop (with FTDI).
I try to manage it and keep it post here if I found the great configuration.

Could you update here the yaml you are using? Are you using temperature and humidity reading?

@sneakyfoxy What’s your secret sauce for flashing these devices? I’m using a Sparkfun CH140C breakout and have soldered a header onto the Sonoff THR board. I connect 4 wires (VCC, Gnd, Rx, Tx). I power on the device while holding down the front panel (on/off) button which seems to result in no WiFi light. In HA I “+ Add Device” and can see the new ComPort. But the connection never happens. I get a yellow flashing (Tx?) light on the CH340C board, but no Rx light . And no success at flashing. I strongly suspect I am not putting the Sonoff device in a flashing state. Ideas?

Perhaps this will help someone else but make sure Tx > Rx and Rx > Tx. This sounds silly but double check on the device that this is correct as Tx & Rx are in different positions in relation to 3v or Gnd when you compare Tx & Rx with the Sonoff Basic.

1 Like