At a high level, here's what's happening:
- A Raspberry Pi acts as a wireless router, with custom DHCP, DNS, and HTTP servers running on board.
- The DNS server redirects lookups seeking any of Google's listed domains for their push service to... nowhere!
- In the mailbox, a switch is closed when a phone is inserted. The switch wakes up an embedded ESP-32 microcontroller.
- Upon waking, the ESP-32 connects to WiFi, raises the mailbox's flag, and alerts the HTTP server on the Pi that a phone has been inserted and that notifications may flow.
- The HTTP server tells the DNS server to turn off redirects and pass all lookups through to a "real" server.
- At the same time, the DHCP server is instructed to boot any connected devices off of the network (they are allowed to, and will, reconnect).
- The phone inside the mailbox disconnects (see 6), reconnects, and immediately tries (and succeeds) to reach Google's push servers. Any notifications that have been queued up should come through.
- After the phone is removed (or 30 seconds, whichever comes first), the ESP-32 reaches back out to the HTTP server and asks it to revert the changes made in step 5. DNS redirects are turned back on.
- Once again, the DHCP boots all connected devices in order to sever any existing connections.
[will be back to give detailed instructions tomorrow]