Unable to wake up ESP8266 after Deep Sleep

Hello,
I have recently had problems getting my ESP8255 D1m (now from AZ-Delivery) to wake up from deep sleep. It makes no difference whether I power it via USB or externally. After flashing the program, I put a jumper between D0 and RST. The log shows that the ESP goes to sleep with the preset settings. Then the blue LED lights up briefly after the sleep time but the ESP does not wake up.
I’m pretty sure I have several ESPs running like this. But now I can’t get it to work. I have already tested 4 boards and one from AZ-Delivery to rule out a simple hardware defect.

My simple test program looks like this:

captive_portal:

deep_sleep:
  id: deep_sleep_1
  run_duration: 10s
  sleep_duration: 30s
    

sensor:

  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    id: "Wifi_Sensor"
    update_interval: 60s
    entity_category: "diagnostic"

  # this sensor is to receive the analog value from the PCB, invisible in HA
  - platform: adc 
    pin: A0
    name: "Batteriespannung Roller"
    # internal: true # can be omitted, only to clarify
    update_interval: 1s
    unit_of_measurement: 'V'
    filters:
      - calibrate_linear:
#          # Map 0.0 (from sensor) to 0.0 (true value)
          - 1.0 -> 17.18
          - 0.0 -> 0.0
  # this sensor is visible in HA and shows the analog value   

Does anyone have similar problems, or could it be related to the current ESPHome software. I have 2024.3.2
Unfortunately the other topics are a bit older and I haven’t found a proper solution yet.

Thanks and greetings
the Noblast

What happens if you increase this to say 60s?

Possibly it is waking and sleeping again before it connects to api and shows logs etc.

Show the whole yaml file. How are you waking the ESP?

Hello Mahko_Mahko,

I’ve tried different times, but it doesn’t seem to have any effect.
The setting works perfectly on other boards.

But thanks for the tip

Gurß
the Noblast

Hello stevemann,

I do not wake up the ESP via a condition. The simple setting run-duration and sleep-duration is sufficient

I have the code running with other sensor data, everything works there. I suspect the hardware or an ESPHome update.
However, the other ESP’s have all been updated to the latest version and are still running.

I have read in another forum that some have solved it by soldering a 10 kOhm resistor between 3.3V and SDD0. I will try this today :wink:

Greetings the Noblast

Was ESP8255 a mistype? Are you working with the Wemos D1 Mini (ESP12f module)?

SDD0 (GPIO7) is connected to the flash chip, so I don’t see how this could possibly have any effect.

Do you see the same presentation with other boards? You weren’t clear about this.

Hi Steveman,

it was a mistype, of course I have ESP8266 D1m boards.
I already had 3 boards from the first delivery equipped with it and it worked. The second one did not work. Then I ordered AZ-Delifery boards, but they have the same problem. Now I have received a replacement from AZ-Delivery and it seems to be working again.

On the other boards, I temporarily put a resistor between the 3.3 V and GPIO7 and it seems to have had an effect. But that can’t really be right :frowning:

Thanks,
the Noblast

As I said before, post your yaml file.

Hello Stevemann,

here is a yaml-file. I have changed the run times and sleep times to be able to attach a log file.

Here is the yaml-file:

esphome:
  name: test-roller
  friendly_name: Test-Roller

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "[redacted]"
ota:
  password: "[redacted]"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test-Roller Fallback Hotspot"
    password: "[redacted]"

captive_portal:

deep_sleep:
  id: deep_sleep_1
  run_duration: 20s
  sleep_duration: 30s
mqtt:
  broker: 192.168.0.146
  port: 1883
  username: homemqtt
  password: !secret mqttpwd
  # ...
  on_message:
    - topic: esp-volvo/ota_mode
      payload: 'ON'
      then:
        - deep_sleep.prevent: deep_sleep_1
    - topic: esp-volvo/sleep_mode
      payload: 'ON'
      then:
        - deep_sleep.allow: deep_sleep_1
    
    
sensor:

  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    id: "Wifi_Sensor"
    update_interval: 60s
    entity_category: "diagnostic"

  # this sensor is to receive the analog value from the PCB, invisible in HA
  - platform: adc 
    pin: A0
    name: "Batteriespannung test-roller"
    # internal: true # can be omitted, only to clarify
    update_interval: 1s
    unit_of_measurement: 'V'
    filters:
      - calibrate_linear:
#          # Map 0.0 (from sensor) to 0.0 (true value)
          - 1.0 -> 17.18
          - 0.0 -> 0.0
 
    

and here the log, I let it run for 10min after the last entry:

INFO ESPHome 2024.4.0
INFO Reading configuration /config/esphome/test-roller.yaml...
INFO Starting log output from test-roller.local using esphome API
WARNING Can't connect to ESPHome API for test-roller.local: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError)
INFO Trying to connect to test-roller.local in the background
INFO Successfully connected to test-roller @ 192.168.0.98 in 0.005s
INFO Successful handshake with test-roller @ 192.168.0.98 in 2.461s
[09:49:25][I][app:100]: ESPHome version 2024.4.0 compiled on Apr 20 2024, 09:34:33
[09:49:25][C][wifi:580]: WiFi:
[09:49:25][C][wifi:408]:   Local MAC: (hide)
[09:49:25][C][wifi:413]:   SSID: [redacted]
[09:49:25][C][wifi:416]:   IP Address: 192.168.0.98
[09:49:25][C][wifi:419]:   BSSID: [redacted]
[09:49:25][C][wifi:421]:   Hostname: 'test-roller'
[09:49:25][C][wifi:423]:   Signal strength: -66 dB ▂▄▆█
[09:49:25][C][wifi:427]:   Channel: 6
[09:49:25][C][wifi:428]:   Subnet: 255.255.255.0
[09:49:25][C][wifi:429]:   Gateway: 192.168.0.251
[09:49:25][C][wifi:430]:   DNS1: 192.168.0.251
[09:49:25][C][wifi:431]:   DNS2: 0.0.0.0
[09:49:25][C][logger:166]: Logger:
[09:49:25][C][logger:167]:   Level: DEBUG
[09:49:25][C][logger:169]:   Log Baud Rate: 115200
[09:49:25][C][logger:170]:   Hardware UART: UART0
[09:49:25][C][adc:097]: ADC Sensor 'Batteriespannung test-roller'
[09:49:25][C][adc:097]:   Device Class: 'voltage'
[09:49:25][C][adc:097]:   State Class: 'measurement'
[09:49:25][C][adc:097]:   Unit of Measurement: 'V'
[09:49:25][C][adc:097]:   Accuracy Decimals: 2
[09:49:25][C][adc:102]:   Pin: GPIO17
[09:49:25][C][adc:142]:   Update Interval: 1.0s
[09:49:25][C][captive_portal:088]: Captive Portal:
[09:49:25][C][mdns:115]: mDNS:
[09:49:25][C][mdns:116]:   Hostname: test-roller
[09:49:25][C][ota:096]: Over-The-Air Updates:
[09:49:25][C][ota:097]:   Address: test-roller.local:8266
[09:49:25][C][ota:100]:   Using Password.
[09:49:25][C][ota:103]:   OTA version: 2.
[09:49:25][C][api:139]: API Server:
[09:49:25][C][api:140]:   Address: test-roller.local:6053
[09:49:25][C][api:142]:   Using noise encryption: YES
[09:49:25][C][mqtt:138]: MQTT:
[09:49:25][C][mqtt:139]:   Server Address: 192.168.0.146:1883 (192.168.0.146)
[09:49:25][C][mqtt:141]:   Username: [redacted]
[09:49:25][C][mqtt:142]:   Client ID: [redacted]
[09:49:25][C][mqtt:144]:   Discovery prefix: 'homeassistant'
[09:49:25][C][mqtt:145]:   Discovery retain: YES
[09:49:25][C][mqtt:147]:   Topic Prefix: 'test-roller'
[09:49:25][C][mqtt:149]:   Log Topic: 'test-roller/debug'
[09:49:25][C][mqtt:152]:   Availability: 'test-roller/status'
[09:49:25][C][wifi_signal.sensor:009]: WiFi Signal 'WiFi Signal Sensor'
[09:49:25][C][wifi_signal.sensor:009]:   Device Class: 'signal_strength'
[09:49:25][C][wifi_signal.sensor:009]:   State Class: 'measurement'
[09:49:25][C][wifi_signal.sensor:009]:   Unit of Measurement: 'dBm'
[09:49:25][C][wifi_signal.sensor:009]:   Accuracy Decimals: 0
[09:49:25][C][mqtt:668]: MQTT Message Trigger:
[09:49:25][C][mqtt:669]:   Topic: 'esp-volvo/ota_mode'
[09:49:25][C][mqtt:670]:   QoS: 0
[09:49:25][C][mqtt:668]: MQTT Message Trigger:
[09:49:25][C][mqtt:669]:   Topic: 'esp-volvo/sleep_mode'
[09:49:25][C][mqtt:670]:   QoS: 0
[09:49:25][C][mqtt.sensor:028]: MQTT Sensor 'WiFi Signal Sensor':
[09:49:25][C][mqtt.sensor:032]:   State Topic: 'test-roller/sensor/wifi_signal_sensor/state'
[09:49:25][C][mqtt.sensor:028]: MQTT Sensor 'Batteriespannung test-roller':
[09:49:25][C][mqtt.sensor:032]:   State Topic: 'test-roller/sensor/batteriespannung_test-roller/state'
[09:49:25][C][deep_sleep:049]: Setting up Deep Sleep...
[09:49:25][C][deep_sleep:052]:   Sleep Duration: 30000 ms
[09:49:25][C][deep_sleep:055]:   Run Duration: 20000 ms
[09:49:26][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:27][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:28][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:29][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:30][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:31][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:32][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:33][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:34][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:35][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:36][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:37][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:38][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:39][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:40][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[09:49:41][I][deep_sleep:117]: Beginning Deep Sleep
[09:49:41][I][deep_sleep:119]: Sleeping for 30000000us
INFO Processing expected disconnect from ESPHome API for test-roller @ 192.168.0.98
WARNING Disconnected from API
WARNING Can't connect to ESPHome API for test-roller @ 192.168.0.98: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError)
INFO Trying to connect to test-roller @ 192.168.0.98 in the background

Thanks
the Noblast

I think running MQTT and trying to run API as well may be the problem. Is there any reason you want to run API?
You have also exposed some passwords and encryption keys. Probably should redact that info and change them.

Hi Spiro,

Thank you for your advice.

I hope I understand the API question correctly:
I only use MQTT to be able to update the boards OTA. The data is then available twice in Home Assistant. But it seems that MQTT shows the data as unavailable during the sleep phase, while the data from ESPHome continues to show the last value because it seems to recognize that the board has gone to sleep.

Greetings
the Noblast

Hi,

here a Log File with the same settings, only the resistor 10k Ohm is soldered from 3.3V to the SDD0 (GPIO7) Pin.

INFO ESPHome 2024.4.0
INFO Reading configuration /config/esphome/test-roller.yaml...
INFO Starting log output from test-roller.local using esphome API
WARNING Can't connect to ESPHome API for test-roller.local: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError)
INFO Trying to connect to test-roller.local in the background
INFO Successfully connected to test-roller @ 192.168.0.98 in 0.006s
INFO Successful handshake with test-roller @ 192.168.0.98 in 2.751s
[11:35:10][I][app:100]: ESPHome version 2024.4.0 compiled on Apr 20 2024, 09:34:33
[11:35:10][C][wifi:580]: WiFi:
[11:35:10][C][wifi:408]:   Local MAC: [redacted]
[11:35:10][C][wifi:413]:   SSID: [redacted]
[11:35:10][C][wifi:416]:   IP Address: 192.168.0.98
[11:35:10][C][wifi:419]:   BSSID: [redacted]
[11:35:10][C][wifi:421]:   Hostname: 'test-roller'
[11:35:10][C][wifi:423]:   Signal strength: -40 dB ▂▄▆█
[11:35:10][C][wifi:427]:   Channel: 6
[11:35:10][C][wifi:428]:   Subnet: 255.255.255.0
[11:35:10][C][wifi:429]:   Gateway: 192.168.0.251
[11:35:10][C][wifi:430]:   DNS1: 192.168.0.251
[11:35:10][C][wifi:431]:   DNS2: 0.0.0.0
[11:35:10][C][logger:166]: Logger:
[11:35:10][C][logger:167]:   Level: DEBUG
[11:35:10][C][logger:169]:   Log Baud Rate: 115200
[11:35:10][C][logger:170]:   Hardware UART: UART0
[11:35:10][C][adc:097]: ADC Sensor 'Batteriespannung test-roller'
[11:35:10][C][adc:097]:   Device Class: 'voltage'
[11:35:10][C][adc:097]:   State Class: 'measurement'
[11:35:10][C][adc:097]:   Unit of Measurement: 'V'
[11:35:10][C][adc:097]:   Accuracy Decimals: 2
[11:35:10][C][adc:102]:   Pin: GPIO17
[11:35:10][C][adc:142]:   Update Interval: 1.0s
[11:35:10][C][captive_portal:088]: Captive Portal:
[11:35:10][C][mdns:115]: mDNS:
[11:35:10][C][mdns:116]:   Hostname: test-roller
[11:35:10][C][ota:096]: Over-The-Air Updates:
[11:35:10][C][ota:097]:   Address: test-roller.local:8266
[11:35:10][C][ota:100]:   Using Password.
[11:35:10][C][ota:103]:   OTA version: 2.
[11:35:10][C][api:139]: API Server:
[11:35:10][C][api:140]:   Address: test-roller.local:6053
[11:35:10][C][api:142]:   Using noise encryption: YES
[11:35:10][C][mqtt:138]: MQTT:
[11:35:10][C][mqtt:139]:   Server Address: 192.168.0.146:1883 (192.168.0.146)
[11:35:10][C][mqtt:141]:   Username: [redacted]
[11:35:10][C][mqtt:142]:   Client ID: [redacted]
[11:35:10][C][mqtt:144]:   Discovery prefix: 'homeassistant'
[11:35:10][C][mqtt:145]:   Discovery retain: YES
[11:35:10][C][mqtt:147]:   Topic Prefix: 'test-roller'
[11:35:10][C][mqtt:149]:   Log Topic: 'test-roller/debug'
[11:35:10][C][mqtt:152]:   Availability: 'test-roller/status'
[11:35:10][C][wifi_signal.sensor:009]: WiFi Signal 'WiFi Signal Sensor'
[11:35:10][C][wifi_signal.sensor:009]:   Device Class: 'signal_strength'
[11:35:10][C][wifi_signal.sensor:009]:   State Class: 'measurement'
[11:35:10][C][wifi_signal.sensor:009]:   Unit of Measurement: 'dBm'
[11:35:10][C][wifi_signal.sensor:009]:   Accuracy Decimals: 0
[11:35:10][C][mqtt:668]: MQTT Message Trigger:
[11:35:10][C][mqtt:669]:   Topic: 'esp-volvo/ota_mode'
[11:35:10][C][mqtt:670]:   QoS: 0
[11:35:10][C][mqtt:668]: MQTT Message Trigger:
[11:35:10][C][mqtt:669]:   Topic: 'esp-volvo/sleep_mode'
[11:35:10][C][mqtt:670]:   QoS: 0
[11:35:10][C][mqtt.sensor:028]: MQTT Sensor 'WiFi Signal Sensor':
[11:35:10][C][mqtt.sensor:032]:   State Topic: 'test-roller/sensor/wifi_signal_sensor/state'
[11:35:10][C][mqtt.sensor:028]: MQTT Sensor 'Batteriespannung test-roller':
[11:35:10][C][mqtt.sensor:032]:   State Topic: 'test-roller/sensor/batteriespannung_test-roller/state'
[11:35:10][C][deep_sleep:049]: Setting up Deep Sleep...
[11:35:10][C][deep_sleep:052]:   Sleep Duration: 30000 ms
[11:35:10][C][deep_sleep:055]:   Run Duration: 20000 ms
[11:35:10][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:11][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:12][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:13][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:14][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:15][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:16][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:17][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:18][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:19][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:20][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:21][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:22][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:23][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:24][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:25][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:26][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:35:26][I][deep_sleep:117]: Beginning Deep Sleep
[11:35:26][I][deep_sleep:119]: Sleeping for 30000000us
INFO Processing expected disconnect from ESPHome API for test-roller @ 192.168.0.98
WARNING Disconnected from API
WARNING Can't connect to ESPHome API for test-roller @ 192.168.0.98: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.0.98', port=6053))]: [Errno 113] Connect call failed ('192.168.0.98', 6053) (SocketAPIError)
INFO Trying to connect to test-roller @ 192.168.0.98 in the background
INFO Successfully connected to test-roller @ 192.168.0.98 in 0.004s
INFO Successful handshake with test-roller @ 192.168.0.98 in 2.419s
[11:36:07][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:08][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:09][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:10][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:11][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:12][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:13][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:14][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:15][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:16][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:17][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:18][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:19][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:20][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:21][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:22][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:36:22][I][deep_sleep:117]: Beginning Deep Sleep
[11:36:22][I][deep_sleep:119]: Sleeping for 30000000us
INFO Processing expected disconnect from ESPHome API for test-roller @ 192.168.0.98
WARNING Disconnected from API
WARNING Can't connect to ESPHome API for test-roller @ 192.168.0.98: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError)
INFO Trying to connect to test-roller @ 192.168.0.98 in the background
INFO Successfully connected to test-roller @ 192.168.0.98 in 0.008s
INFO Successful handshake with test-roller @ 192.168.0.98 in 2.388s
[11:37:04][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:05][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:06][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:07][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:08][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:09][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:10][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:11][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:12][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:13][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:14][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:15][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:16][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:17][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:18][D][sensor:093]: 'Batteriespannung test-roller': Sending state 0.08389 V with 2 decimals of accuracy
[11:37:19][I][deep_sleep:117]: Beginning Deep Sleep
[11:37:19][I][deep_sleep:119]: Sleeping for 30000000us
INFO Processing expected disconnect from ESPHome API for test-roller @ 192.168.0.98
WARNING Disconnected from API
WARNING Can't connect to ESPHome API for test-roller @ 192.168.0.98: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError)
INFO Trying to connect to test-roller @ 192.168.0.98 in the background


Thanks
the Noblast

mqtt:
  broker: 192.168.0.146
  port: 1883
  username: homemqtt
  password: !secret mqttpwd
  
  birth_message:
    topic: Test-Roller/birth
    payload: 'ON'
  will_message:
    topic: Test-Roller/willdisable
    payload: disable
  # ...
  on_message:
    - topic: esp-volvo/ota_mode
      payload: 'ON'
      then:
        - deep_sleep.prevent: deep_sleep_1
    - topic: esp-volvo/sleep_mode
      payload: 'ON'
      then:
        - deep_sleep.allow: deep_sleep_1	

If you put in a birth and will field in MQTT but make sure to pick a different topic like above then then the entity won’t go unavailable when it goes into deep sleep. You could then remove API. If you are running deep sleep to conserve power then it is best to send the device to sleep as soon as you get the sensor reading.

I suspect that you are seeing a race between API and MQTT that doesn’t complete before the ESP goes to sleep. This would explain why different boards present differently.

I never use API and MQTT together. In fact I am moving (slowly) away from MQTT for my devices.

In my case, I have an ESP in each of my cars that is mostly asleep. Every 15 seconds they wake, connect API then go back to sleep. This provides me with a presence detect. (If it’s connected, it’s present).

To do updates OTA, I turn on a helper entity ironically called “OTA_Mode”. In the ESP yaml code, I run an on_connect script to test that helper entity. If the helper entity is not on, it goes back to sleep.

Hope this helps.

Hi Spiro,

thanks for the coding. That works fine, now the MQTT Values stay available. Unfortunately it has no influence to the wake up behavior. I deleted the API lines and send the MQTT Message only. Also I changed the Run and Sleep Time to 60s but it still stay sleeping.

Thanks,
the Noblast

Hi Stevemann,

I tried both ways now. Only API and MQTT only. Also I changed the time to 60s running time and 60 sleeping to have time to complete internal task. But non of these works at the mentioned boards.

But now I’m curious, what do you use ESP for in your cars? And I also find the implementation with the helper interesting. Would you send me your Yaml code so that I can perhaps optimize mine?

Thanks and greetings
the Noblast

If by wake up behaviour you mean that you can’t get the device to go into OTA mode then perhaps there is something wrong with the way you are trying to trigger it. Show the code you are using to send the MQTT message for sleep prevent. If you are getting readings on the sensor that update then it is waking and going back to sleep.

The ESP’s are a beacon. If the API connects, the car is ‘home’. It is an interconnect. If neither car is ‘home’, the garage door automation won’t run.

Here is a link to my notebook:
Esphome example deep sleep - Notebook (mann.ws)

Hello Spiro,

the problem is that the board doesn’t wake up. The OTA message can of course only be recognised in running mode. If the ESP are awake, the OTA function works to prevent them from going back to sleep very well.
The strange thing is that the boards sometimes only wake up when the resistor is soldered between 3.3 volts and SDD0. Without adjusting the Yaml code, the behaviour of the board changes.
And not just with one board, but with several.

Greetings
the Noblast

Ok, it was just that you were able to show logs of the device above. I suspect then that was just when you did a hard reset of the D1 Mini but wouldn’t afterwards wake from deep sleep.
Checking one last thing.

When you said externally you meant supplying 3.3V and GND from an external source to the 3.3V and GND pins and not from putting 5V to the 5V pin on your D1 mini?