ESPHome & Sonoff Basic not working

I have ESPHome working controlling a range of devices, mostly self-built using NodeMCU and ESP8266_01 devices.

I’m now trying to add some Sonoff Basic switches and am struggling. I first tested the Sonoff switches using the EweLink app and they worked fine.

Using this guide, I then built my config in ESPHome and uploaded the firmware using esphomeflasher. It finishes OK, giving the MAC address etc. so I am fairly confident that the firmware has uploaded OK.

The problem is that once I’ve uploaded the firmware and power cycled the Sonoff Basic, it no longer connects to the WiFi, or gives any indication that it is working!

I used reserved leases on the DHCP so use fixed addresses for all my ESPHome devices. The addresses I’m using for the Sonoff basic switches are not in use and are reserved for these switches. I have copied / pasted the WiFi name and password from a working one so it should be correct.

I’m out of ideas so any help gratefully received!

esphomeyaml:
  name: sonoff_basic_01
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: 'MyWiFi'
  password: 'MyPassword'
  manual_ip:
    static_ip: 192.168.100.186
    gateway: 192.168.100.254
    subnet: 255.255.255.0
api:

logger:

ota:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Sonoff Basic Button"
    on_press:
      - switch.toggle: relay

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

status_led:
  pin:
    number: GPIO13
    inverted: yes

Output of the esphomeflasher after flashing in case this holds the key!

Using 'COM14' as serial port.
Connecting....
Detecting chip type... ESP8266
Connecting...

Chip Info:
 - Chip Family: ESP8266
 - Chip Model: ESP8285
 - Chip ID: 0097B916
 - MAC Address: BA:DF:00:D7:B9:16
Uploading stub...
Running stub...
Stub running...
 - Flash Size: 1MB
 - Flash Mode: qio
 - Flash Frequency: 40MHz
Erasing flash (this may take a while)...
Chip erase completed successfully in 3.4s
Compressed 344192 bytes to 237331...
Wrote 344192 bytes (237331 compressed) at 0x00000000 in 21.0 seconds (effective 131.2 kbit/s)...
Hash of data verified.

Leaving...
Hard Resetting...
Done! Flashing is complete!

Showing logs:
Serial port closed!

Based on ESPHome’s own issue tracker it looks like the logger: component is the culprit. You could try it without and see if this solves your problem.

Thanks, @Florian. I have now tried removing logger: but no change unfortunately so I’m still looking for the cause.

I’ve just realised that my ESPHome version is 1.10.1 but I have no idea how to update it on HASS.IO - the normal update link / reminder has not appeared. Once I figure that I’ll try again!

Sorted! The problem was the ESPHome version. Now working. Thanks.

Okay, thanks for letting us know. Did you have to comment out the logger component or is it working for you with it enabled?

It works with logger: enabled.

Question: All the ESPHome devices show “Update Available! 1.10.1 :arrow_right:1.12.1” - how do I get rid of this? I’ve re-compiled and re-uploaded the firmware but the message stays.

Thanks.

Answered my own question again! Forcing a page refresh sorts that message!

Thanks @Florian for your help!

1 Like

Just got My Sonoff Basic R2 and having problems with it.

I have successfully uploaded program and when i put the mains power back on. The LED on the sonoff just flashes once a second.

INFO Reading configuration...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d config/garden_light
Processing garden_light (framework: arduino; platform: [email protected]; board: esp01_1m)
--------------------------------------------------------------------------------
Warning! Library `{'requirements': None, 'name': 'Update'}` has not been found in PlatformIO Registry.
You can ignore this message, if `{'requirements': None, 'name': 'Update'}` is a built-in library (included in framework, SDK). E.g., SPI, Wire, etc.
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp01_1m.html
PLATFORM: Espressif 8266 > Espressif Generic ESP8266 ESP-01 1M
HARDWARE: ESP8266 80MHz 80KB RAM (1MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 27 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS>
|   |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncTCP> 1.2.0
|   |-- <ESP8266WiFi> 1.0
Retrieving maximum program size .pioenvs/garden_light/firmware.elf
Checking size .pioenvs/garden_light/firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [====      ]  39.2% (used 32144 bytes from 81920 bytes)
PROGRAM: [===       ]  31.8% (used 325188 bytes from 1023984 bytes)
========================= [SUCCESS] Took 1.22 seconds =========================
INFO Successfully compiled program.
INFO Running:  esptool.py --before default_reset --after hard_reset --chip esp8266 --port /dev/cu.usbserial-14310 write_flash 0x0 config/garden_light/.pioenvs/garden_light/firmware.bin
esptool.py v2.6
Serial port /dev/cu.usbserial-14310
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: b4:e6:2d:3a:af:fb
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 329328 bytes to 229783...
Wrote 329328 bytes (229783 compressed) at 0x00000000 in 22.3 seconds (effective 118.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/cu.usbserial-14310 with baud rate 115200

My Config

esphome:
  name: garden_light
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "xxxxxx"
  password: "xxxxxx"
  manual_ip:
    static_ip: 192.168.85.45
    gateway: 192.168.85.1
    subnet: 255.255.255.0

# Enable logging
logger:
  level: DEBUG

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

ota:
  password: "xxxxx"

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Garden Light Status"
    on_press:
      - switch.toggle: relay

switch:
  - platform: gpio
    name: "Garden Light"
    pin: GPIO12
    id: relay

status_led:
  pin:
    number: GPIO13
    inverted: yes

Any help please…

I think I sorted it I had to press the reset button on my uart usb device before disconnecting and connecting the mains supply. Then the esp came up in HA discovery.

I have been experiencing this problem now for some time. Sonoff basic modules flashed OTA will drop off the network after updating. ESPHome version: 2022.2.5 is the latest at the time of this writing and is taking down my sonoffs. I have not tried removing the logging, but definitely not updating any more Sonoffs for the time being.

This regularly happens on my SonoffBasic for the last year or more.

Luckuly always works on 4CH and RFBridge.

Cheers

Hiya, this is still happening to me and what worse is, after the latest ESPHOME update, it completely broke it. none of sonoff basic is now connected to my ESPHOME. Is anyone having this issue too?