Another possibility is ESP8266 when it starts up turns on a relay whose contacts wired
in parallel with tilt switch, or a mosfet used as a switch, and no matter what happens with
tilt switch power is maintained to ESP8266 so it can complete its task, then ESP8266 goes
back to sleep. If tilt switch needs a wide angle to activate that might be enough to keep
false close open cycles to a minimum, all to be investigated.
I think you should also look into power management, eg. ESP8266 looks at battery and
notifies host if its end of life.....
It might just be easier to use a ATTINY85 8 pin micro to manage all the pulse generation
for the ESP8266, debounce, etc......
Regards, Dana.