The WEMOS D1 is a board built around an ESP8266 System on Chip. That component has several suspend modes, we are interested in "deep sleep". When the board enters deep sleep, power consumption drops below the milliwatt. An internal timer wakes up the device after a programmable interval (not more than one hour), but the internal state is lost: no variables, no clock, everything is lost. You need to store all that somewhere else before entering deep sleep.
For instance in the cloud: all your state and history can be recorded in a MongoDB DBaaS, and operated on using Stitch functions.
This project describes
- the board hosting the WEMOS, the relais, and the circuitry needed to power the boards and the empty tank sensing
- the sketch running on the WEMOS
- some hints about the DB structure and the functions running on the MongoDB platform.