ESPHome with ESP8266 - WiFi not reconnecting after deep sleep

My esp8266 isn’t able to recover from deep sleep via wifi.

It’s a simple setup with my esp8266 with a BME280 with pins D0 connected to RST. Without any deep sleep configured, the unit successfully provides sensor values every 10s but as soon as I configure the deep sleep it never re-connects to the esp8266 via wifi. The sensor update interval is 10s, deep sleep run duration is 30s (so should be plenty of time for the unit to recover and resend sensor values within the 30s window) and a deep sleep duration of 3 min. …as per code and logs below.

A very simple setup but can’t figure out why I can’t reconnect.

esphome:
  name: outdoor_bme280
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "RobsBillion-2.4g"
  password: "#############"
  power_save_mode: none
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.133
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.254
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0


# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


i2c:
  sda: D2
  scl: D1
  
sensor:
  - platform: bme280
    temperature:
      name: "Outdoor Temperature"
      oversampling: 16x
      id: od_bme28_temperature
    pressure:
      name: "Outdoor Pressure"
      id: od_bme28_pressure
    humidity:
      name: "Outdoor Humidity"
      id: od_bme28_humidity
    address: 0x76
    update_interval: 10s
    
  - platform: wifi_signal
    name: "Outdoor WiFi Signal"
    id: od_wifi_strength
    update_interval: 10s
    
  - platform: adc
    id: source_sensor
    pin: A0
    name: "Outdoor battery voltage"
    update_interval: 10s
    filters:
      - multiply: 15.42

deep_sleep:
  run_duration: 30s
  sleep_duration: 3min

Uploading: [============================================================] 100% Done…

INFO Waiting for result…
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.1.133 using esphome API
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error connecting to 192.168.1.133: timed out). Re-Trying in 1 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
INFO Successfully connected to 192.168.1.133
[20:20:12][I][app:095]: esphome version 1.13.4 compiled on Jun 6 2019, 20:19:38
[20:20:12][C][wifi:368]: WiFi:
[20:20:12][C][wifi:250]: SSID:

[redacted]
[20:20:12][C][wifi:251]: IP Address: 192.168.1.133
[20:20:12][C][wifi:253]: BSSID:

[redacted]
[20:20:12][C][wifi:254]: Hostname: ‘outdoor_bme280’
[20:20:12][C][wifi:258]: Signal strength: -53 dB ▂▄▆█
[20:20:12][C][wifi:259]: Channel: 10
[20:20:12][C][wifi:260]: Subnet: 255.255.255.0
[20:20:12][C][wifi:261]: Gateway: 192.168.1.254
[20:20:12][C][wifi:262]: DNS1: 0.0.0.0
[20:20:12][C][wifi:263]: DNS2: 0.0.0.0
[20:20:12][D][bme280.sensor:197]: Got temperature=23.6°C pressure=1001.7hPa humidity=37.1%
[20:20:12][D][sensor:092]: ‘Outdoor Temperature’: Sending state 23.56000 °C with 1 decimals of accuracy
[20:20:12][D][sensor:092]: ‘Outdoor Pressure’: Sending state 1001.65283 hPa with 1 decimals of accuracy
[20:20:12](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[20:20:12][C][i2c:028]: I2C Bus:
[20:20:12][C][i2c:029]: SDA Pin: GPIO4
[20:20:12][C][i2c:030]: SCL Pin: GPIO5
[20:20:12][C][i2c:031]: Frequency: 50000 Hz
[20:20:12][I][i2c:033]: Scanning i2c bus for active devices…
[20:20:13][I][i2c:040]: Found i2c device at address 0x76
[20:20:13][C][logger:137]: Logger:
[20:20:13][C][logger:138]: Level: DEBUG
[20:20:13][C][logger:139]: Log Baud Rate: 115200
[20:20:13][C][logger:140]: Hardware UART: UART0
[20:20:13][C][bme280.sensor:142]: BME280:
[20:20:13][C][bme280.sensor:143]: Address: 0x76
[20:20:13][C][bme280.sensor:155]: IIR Filter: OFF
[20:20:13][C][bme280.sensor:156]: Update Interval: 10.0s
[20:20:13][C][bme280.sensor:158]: Temperature ‘Outdoor Temperature’
[20:20:13][C][bme280.sensor:158]: Unit of Measurement: ‘°C’
[20:20:13][C][bme280.sensor:158]: Accuracy Decimals: 1
[20:20:13][C][bme280.sensor:158]: Icon: ‘mdi:thermometer’
[20:20:13][C][bme280.sensor:159]: Oversampling: 16x
[20:20:13][C][bme280.sensor:160]: Pressure ‘Outdoor Pressure’
[20:20:13][C][bme280.sensor:160]: Unit of Measurement: ‘hPa’
[20:20:13][C][bme280.sensor:160]: Accuracy Decimals: 1
[20:20:13][C][bme280.sensor:160]: Icon: ‘mdi:gauge’
[20:20:13][C][bme280.sensor:161]: Oversampling: 16x
[20:20:13][C][bme280.sensor:162]: Humidity ‘Outdoor Humidity’
[20:20:13][C][bme280.sensor:162]: Unit of Measurement: ‘%’
[20:20:13](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[20:20:13](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[20:20:13][C][bme280.sensor:163]: Oversampling: 16x
[20:20:13][C][adc:026]: ADC Sensor ‘Outdoor battery voltage’
[20:20:13][C][adc:026]: Unit of Measurement: ‘V’
[20:20:13][C][adc:026]: Accuracy Decimals: 2
[20:20:13][C][adc:026]: Icon: ‘mdi:flash’
[20:20:13][C][adc:031]: Pin: 17
[20:20:13][C][adc:051]: Update Interval: 10.0s
[20:20:13][C][ota:029]: Over-The-Air Updates:
[20:20:13][C][ota:030]: Address: 192.168.1.133:8266
[20:20:13][C][api:102]: API Server:
[20:20:13][C][api:103]: Address: 192.168.1.133:6053
[20:20:13][C][wifi_signal.sensor:009]: WiFi Signal ‘Outdoor WiFi Signal’
[20:20:13][C][wifi_signal.sensor:009]: Unit of Measurement: ‘dB’
[20:20:13][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[20:20:13][C][wifi_signal.sensor:009]: Icon: ‘mdi:wifi’
[20:20:13][C][deep_sleep:020]: Setting up Deep Sleep…
[20:20:13][C][deep_sleep:023]: Sleep Duration: 180000 ms
[20:20:13][C][deep_sleep:026]: Run Duration: 30000 ms
[20:20:13][D][api:572]: Client ‘Home Assistant 0.93.2 (192.168.1.120)’ connected successfully!
[20:20:18][D][sensor:092]: ‘Outdoor WiFi Signal’: Sending state -54.00000 dB with 0 decimals of accuracy
[20:20:22][D][adc:056]: ‘Outdoor battery voltage’: Got voltage=0.27V
[20:20:22][D][sensor:092]: ‘Outdoor battery voltage’: Sending state 4.11100 V with 2 decimals of accuracy
[20:20:22][D][bme280.sensor:197]: Got temperature=23.6°C pressure=1001.7hPa humidity=37.2%
[20:20:22][D][sensor:092]: ‘Outdoor Temperature’: Sending state 23.56000 °C with 1 decimals of accuracy
[20:20:22][D][sensor:092]: ‘Outdoor Pressure’: Sending state 1001.65625 hPa with 1 decimals of accuracy
[20:20:22][D][sensor:092]: ‘Outdoor Humidity’: Sending state 37.16406 % with 1 decimals of accuracy
[20:20:28][D][sensor:092]: ‘Outdoor WiFi Signal’: Sending state -52.00000 dB with 0 decimals of accuracy
[20:20:32][D][adc:056]: ‘Outdoor battery voltage’: Got voltage=0.27V
[20:20:32][D][sensor:092]: ‘Outdoor battery voltage’: Sending state 4.11100 V with 2 decimals of accuracy
[20:20:32][D][bme280.sensor:197]: Got temperature=23.6°C pressure=1001.7hPa humidity=37.1%
[20:20:32][D][sensor:092]: ‘Outdoor Temperature’: Sending state 23.56000 °C with 1 decimals of accuracy
[20:20:32][D][sensor:092]: ‘Outdoor Pressure’: Sending state 1001.65967 hPa with 1 decimals of accuracy
[20:20:32][D][sensor:092]: ‘Outdoor Humidity’: Sending state 37.14160 % with 1 decimals of accuracy
[20:20:38][D][sensor:092]: ‘Outdoor WiFi Signal’: Sending state -53.00000 dB with 0 decimals of accuracy
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: timed out). Trying to reconnect in 2 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: timed out). Trying to reconnect in 4 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: [Errno 113] No route to host). Trying to reconnect in 8 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: [Errno 113] No route to host). Trying to reconnect in 16 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: [Errno 113] No route to host). Trying to reconnect in 32 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: [Errno 113] No route to host). Trying to reconnect in 64 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: [Errno 113] No route to host). Trying to reconnect in 128 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: [Errno 113] No route to host). Trying to reconnect in 256 seconds
INFO Connecting to 192.168.1.133:6053 (192.168.1.133)
WARNING Couldn’t connect to API (Error connecting to 192.168.1.133: [Errno 113] No route to host). Trying to reconnect in 300 seconds

Did you solve this issue? I happen to have the same.

Hi,
You do connect the PIN D0 and RST with a cable, to operate deep sleep