My aim is to get the following behavior: the ESP8266 wakes up and sends some message either:
1. every some predefined amount of time, periodically,
or
2. when the door opens.
I mean, whatever of the two above happens, the circuit should wake up.
Getting just point 1 working is easy, it's the basic flow when using deep sleep. I've already got it working.
Point 2 alone is a bit trickier but still relatively easy, it requires hooking up the sensor to the "wake" pin so that there's high state when the magnet is away from the reed switch (the door is closed). The only tricky part I see is keeping the ESP8266 awake even if the door closes, so that it has enough time to connect to the network and send the message.
Getting both requirements to work simultaneously, it's just beyond my knowledge. I need to work it like this because having only point 1, in pessimistic cases, will report the door getting open after some time, not when the door actually opens. Only point 2 is not enough because I want to have a kind of a health check - someone could break the circuit and I wouldn't ever know about it without these periodical messages.
I found some inspirations in the net:
* https://hobbytronics.com.pk/esp-deep-sl ... ut-wakeup/
* https://github.com/esp8266/Arduino/issues/1729
but they only describe how to accomplish point 2. I've tried to fit the solution from the first link to my needs, but I just don't have enough knowledge about electronics to define such behavior.
Could you help me design a correct circuit that can be used to achieve the above?
Any help greatly appreciated!