Esphome - Sonoff S31 integration

I have been trying to integrate a Sonoff S31 via ESPhome (currently using tasmota firmware) without luck as far as the power metering is concerned.

The problem seems to stem from adding the uart section. the firmware compiles, and uploads, but the sonoff is unresponsive and the only way to get it back online is to flash a basic firmware without the uart section.

If I comment out the uart section below, the code compiles and sonoff operates fine where I can toggle the relay / restart the unit without issues. On tasmota firmware using mqtt, it’s working as expected with home assistant. I’ve got 10 of these units waiting to migrate to esphome currently on tasmota.

Anyone experience something like this? (latest esphome, sonoff s31 wifi)

Thanks!

esphome:
  name: sonoff_s31_1
  platform: ESP8266
  board: esp01_1m
  on_boot:
    then:
      - switch.turn_on: relay

wifi:
  ssid: "ssid"
  password: "password"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Sonoff S31 1 Fallback Hotspot"
    password: "password"


captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "password"

uart:
  rx_pin: RX
  baud_rate: 4800

ota:
  password: "password"

status_led:
  pin:
    inverted: True
    number: GPIO13
    
binary_sensor:
  - platform: status
    name: "Sonoff_S31 1 Status"
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Sonoff_S31 1 Button"
    on_press:
      - switch.toggle: relay   
      
switch:
  - platform: gpio
    pin: GPIO12
    name: "Sonoff_S31 1 Relay"
    id: relay
  - platform: restart
    name: "Sonoff_S31 1 Restart"      
    
sensor:
  - platform: wifi_signal
    name: "Sonoff S31 WiFi Signal"
    update_interval: 60s
  - platform: cse7766
    current:
      name: "Sonoff S31 1 Current"
    voltage:
      name: "Sonoff S31 1 Voltage"
    power:
      name: "Sonoff S31 1 Power"    
1 Like

It´s probably a conflict on the RX pin. Both uart and logger uses it. You´ll need to add one line:

logger:
  baud_rate: 0
2 Likes

That’s was it, appreciate your help!

This helped me. Thanks!