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.

esphome:
  device_name: sonoff-temp

esp32:
  board: nodemcu-32s

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

logger:
api:
ota:

uart:
  rx_pin: GPIO16
  baud_rate: 4800
  
sensor:
  - platform: cse7766
    update_interval: 30s
    current:
      name: ${device_name} Current
      id: a_sensor
    voltage:
      name: ${device_name} Voltage
      id: v_sensor
    power:
      name: ${device_name} Power
      id: w_sensor
    energy:
      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

dallas:
  - pin: GPIO27

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

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

status_led:
  pin:
    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).

https://community.home-assistant.io/t/help-with-flashing-sonoff-dual-r3-please/297547/2

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.

Hi.
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