Esphome and relay water pump


I’m doing a water irrigation system with a mini solar panel and a 16850 battery for the D1 mini that controlls the relay, and i will add a dht22 and a rain sensor.

Now i want to improve it and try to get better battery comsumptions (the battery dies during the night) so i’m testing with deep sleep, the problem i have is that if i use deep sleep, i cant wake it up on because looks that network is off, so unless i add a button to do that wake up, or just wait to the “sleep_duration” finished, but is difficult to match the exact time the d1 mini is on to switch on the pump
if i use the deep sleep i get several days of battery, but i lose the “on demmand” swith on/off pump

As this is a relay, i would need to use it on demmand, but at the same time save battery to have it available always, do you think this is possible or i just need to add more batteries?


You don’t give a clear picture of how it is all set up. Anyway, i would compute how much energy is needed to keep your mcu solution operational through the night and base the size of the solar and batteries to support that. If you have enough sunny days this could be a workable aolution for you.

Is everything powered by the battery?

Would it be acceptable for the “on demand” to run next time it wakes?


I’ve read about using MQTT to wake up, but as you say, you must wait the next time it wakes. I’m thinking more about a switch, if i need to switch on a bulb i just clic the button and the light is on. i would need something similar to this idea, just clic wake up de D1 mini to start working.

another similarity could be a wake on lan for a PC, a magic packet with the MAC address and the PC switch on, but not sure if with esp8266 something like this could be done because with deep sleep WIFI is off

AFAIK, the only way to wake up a 8266 is to set RST low (a timer is just a special case).

You won’t be able to use the network to wake it up, so you have to think of another kind of trigger.
Instant “on demand” seems not possible.
What about waking up every X and test current conditions? I imagine you don’t need second-level precision for an irrigation system, do you?

Assuming this would be connected to HA, you could create a “Irrigation requested” input boolean in HA, that would be read by the ESP on wakeup…

1 Like

I’ve run into the same problem (i.e. running out of battery in <1 week) for my garden watering relay. I’ve currently not gotten it back up-and-running since it’s been winter and all, but I’m going to try out just sleeping for 10min then waking up, figuring out if it needs to stay awake to water, and then return to sleep for the duration of the watering cycle.

Implementing Deep Sleep with ESPHome (not MQTT):
:battery: ESPHome: Batteries, Deep Sleep, and Over-the-Air Updates – Tatham Oddie

I chose the linked route, as I currently don’t have anything else on MQTT, and using a HA helper was a simple and clean solution. I haven’t worked everything out yet, but I’ve successfully implemented the deep sleep, and it’ll remain awake if my DoNotSleep helper is toggled on. Other options, which currently aren’t available on ESPHome, would be using some sort of LoRa or ESPNow solution, since it seems like the WiFi is really the driver behind the low battery life.

1 Like

Yeah that’s what mine does. I need to finalise the write up…