Wake Up from deep sleep ESPhome when battery charging

Hi to everyone!!
Are more than 2 years i am using HA (really perfect) now it’s time to grow and use ESPhome.
I am using lilygo t5 4.7 (battery version) i was able to configure and make it work perfectly, I made a command to put the esphome in deep sleep when the battery is about 3.20V, only problem, i would like to know if there is some way to wake it up from deep sleep when i connect the plug to charge the battery.
Checking on the forum i didn’t find a solution, before i was finding a solution about turning OFF WIFI when the battery goes to 3.25V, but i i think there is no way (no solution), so now i stop only to the option to wake it up from deep sleep, i am using GPI0 to wake up, but unfortunately the do not look so strong and it would be nice if this option would be Automatic

I make compliments for HOME ASSISTANT software, it made my life more simple :wink:

Deep sleep is a state where execution is running in a special mode with really limited capabilities, so making it in code alone is probably not possible.
What you might have to do is hardwire the charger circuit somehow to a pin on the ESP chip, so that when the charger is connected then a pin is switched and you then wake up the chip.
You probably have to search ESP forums for this hack, since it is more than just ESP software codes.

I was thinking already about this, but i thought there was a way, instead for the WiFi? so the battery it last more.

When i try to turn off is back on after some seconds

1 Like

You can send the ESP32 to sleep for say 10 minutes and then when it wakes up read the voltage and send it straight back to sleep once Home assistant gets the voltage and it is <3.2V. So it would be awake only for few seconds. Then when battery >3.2V you can disable deep sleep. Search for OTA mode for ESP32. This is usually what it’s called when disable deep sleep as you do this when you also want to update the ESP. This can all be done through automation or in esphome with lambda.

Sorry i waited much but i made some test and tried some idea, at the end i bought a charger cable with magnet and added one reed switch connected to some free GPI0, now when the battery is low and it goes in deep_sleep, i connect the cable with the magnet, the reed switch it closes the contact and the ESP wakes up automatically, at the moment i made those modifications, auto wake up from deep_sleep, when charging the battery, slow down the CPU to 80Mhz (less is not working the CPU is panicking), i was able to stop the wifi at night ( because i have it near the bed), only problem i am not able to disable the messages i see in the log, every 0.5s i receive this message ( trying to connect, impossible to connect), maybe blocking those messages i am able to use less cpu

Nice idea!