This is a pretty simple security light type of device with the obvious advantage of being web-connected.
The problem that kills this application stone dead is the ESP8266 bootloader. When power is applied, both GPIO pins are set as inputs and their state (logic 0 or 1) determines whether the ESP-01 will run user code (when both are at logic 1) or whether it enters a state for loading firmware. However, it appears that the only state that allows user code will be executed after a power-up is for both GPIO0 and GPIO2 to be at a "1". With a PIR connected to one of these input pins it's obvious that this situation cannot be guaranteed.
Has anyone got experience of an ESP-01 running a different bootloader that doesn't rely on the logic states of the GPIO pins when power is applied? As it appears to me that with the existing boot code the device cannot be used reliably in a standalone application where one of the pins will be used as as input.