How do I receive messages upon waking using ESP8266?

I am working on building a garden irrigation controller using an ESP8266 on battery power as the brains of the operation. The goal is to wake up periodically and test the soil moisture level. If the soil is too dry, open the water valve and go back to sleep. Then wake up every few minutes, test moisture, turn the valve off if the threshold has been met then go back to a long sleep cycle.
I see having several parameters involved. Sleep time between moisture checks while valve is off, sleep time between moisture checks when valve is on, dry threshold, wet threshold.
I would like to be able to adjust those values using something like MQTT using my raspberry pi as a broker. I'm not sure that is the best method as the ESP8266 is going to spend most of its life sleeping. Is there something else I should be looking at?

You can use MQTT, just set the retain option for your topic to let the server store the value to return it for a new client.

But checking that value at every wake up will draw much current and the battery time will be limited. Decide how often these values must be updated and only connect to the MQTT server that often.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.