I have almost got my deep sleep setup working, however when waking, it wont connect to wifi.
It also seems to spew a mass deauth broadcase when trying to connect as everything else on the same AP is disconnected.
The error is
[D][esp-idf:000]: E (5536) wifi:
[D][esp-idf:000]: Association refused temporarily, comeback time 0 mSec
[D][esp-idf:000]:
[D][esp-idf:000]: E (5555) wifi:
[D][esp-idf:000]: Association refused temporarily, comeback time 0 mSec
[D][esp-idf:000]:
[D][esp-idf:000]: E (5572) wifi:
[D][esp-idf:000]: Association refused temporarily, comeback time 0 mSec
[D][esp-idf:000]:
[D][esp-idf:000]: E (5589) wifi:
[D][esp-idf:000]: Association refused temporarily, comeback time 0 mSec
[D][esp-idf:000]:
[W][wifi_esp32:482]: Event: Disconnected ssid='wifi' bssid=[redacted] reason='Association Failed'
[W][wifi:630]: Error while connecting to network.
[D][wifi:673]: Retrying with hidden networks...
[I][wifi:303]: WiFi Connecting to 'wifi'...
[W][wifi_esp32:479]: Event: Disconnected ssid='IoT' reason='Probe Request Unsuccessful'
[W][wifi:640]: WiFi network can not be found anymore.
[D][wifi:673]: Retrying with hidden networks...
[D][binary_sensor:036]: 'power_button': Sending state OFF
[I][deep_sleep:117]: Beginning Deep Sleep
[D][esp32.preferences:114]: Saving 1 preferences to flash...
[D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
Any ideas on this one? I’m using fast connect with a specific BSSID set.
That won’t matter because you are still going from boot to sleep. Nothing else in your YAML will be used.
Here’s how I handle sleep. (Note, I don’t use the ESP32 much since I still have a dozen Wemos D1 Mini’s in my workshop. In fact this code is run on a bare ESP01).
Basically, the first thing the YAML code does is to check if a helper named otamode is on or off. If it’s on, then I skip sleep. If it’s off, I go back to sleep.
So from my desktop I have a switch to turn otamode on or off.
# This is the ESP device inside the Jeep to provide presence (status=connected).
substitutions:
device_name: jeep
friendly_name: jeep
packages:
wifi: !include common/wifi.yaml
device_base: !include common/esp8266.yaml
esphome:
on_boot:
priority: -100.0
then:
- delay: 1s
- script.execute: test_ota
binary_sensor:
- platform: status
name: "Jeep Status"
- platform: homeassistant
id: otamode
entity_id: input_boolean.jeep_ota_mode
#################################################
# Script to test if the otamode switch is on or off
script:
- id: test_ota
mode: queued
then:
- logger.log: "Checking OTA Mode"
- if:
condition:
binary_sensor.is_on: otamode
then:
- logger.log: 'OTA Mode ON'
- deep_sleep.prevent: deep_sleep_handler
else:
- logger.log: 'OTA Mode OFF'
- delay: 2s
- script.execute: test_ota
#################################################
#Deep Sleep
deep_sleep:
id: deep_sleep_handler
run_duration: 5s
sleep_duration: 120s