Now the shorter days and the longer nights are arrived in The Netherlands it’s dark outside when leaving or coming from work.
From Ali express I bought some battery power led light with build in pir (passive infrared) and light sensor. Very handy, you stick them somewhere above the door with some dubbelsided tape and they will light up if some one, good or bad will approach the door.
It will also be handy if I get a notification on my smartphone  if some approached the door, so the idea was born.

Because I already had some domotica system with Iot (Internet of things) running it would be handy to integrate it with this. The small esp8285 Esp-M3 module was the one that will do the job, mostly because it’s small of size.  It will send a message to my mosquitto broker and with node-red it will handle the message.

The pir led light is battery powered so very low or no power consumption was required.
The idea is that when the leds are going on, the esp8285 will connect to the wifi, send a message to the broker, and then go in deep sleep. When the leds are going off again the esp8285 will be switched of completely and will therefore draw no current anymore.
After studying the controller (BISS0001) in the pir led light it was not that difficult to accomplish. Finding the correct output pin with the help of the datasheet was easy. This pin (2) will become high when the leds are turned on by the pir detector. With this is should be possible to switch on the esp8285.
The pir led light works on 4×1.5V battery and the esp8282 on 3.3V, so we need also a voltage regulator to get the correct voltage. The idea was to combine the switch on and regulator part, this made me choose for a regulator with an enabled pin. Also was it important that the regulator does drawn as low current as possible when disabled. Google and ali-express gave me the LC1463, a fixed voltage regulator that can deliver up to 300mA and draws only 0.1µA when disabled, perfect for the job.
This time no designed pcb, but floating wiring the parts together in the pir led light  with roadrunner wire.

Have a look at the schematic and picture to see how to connect. Not all the pir led lights from China are the same, but if they have the BISS0001 controller inside and you can locate the plus and minus coming from the battery it’s easy to connect.

Before soldering the esp8285 module in the pir led light you have to program it first. For this you need to connect the Vcc, Gnd, Txd and Rxd to your Usb to serial convertor. After plugin the convertor in the USB port you have to bring the esp8285 in download mode by resetting it and holding the GPIO0 to gnd. So for this you need to solder also an wire to reset and GPIO0. If the blue led on the esp8285 module short flashes it’s in download mode.
After downloading and testing the sketch you can remove the header, the reset and GPIO0 wire again. Be sure that your program works.
It’s also possible to bring the esp8282 in OTA (Over The Air programming) after programming, this can be done be placing the value 15 in the “/vm/tuin/pirsensorachter/status” topic. For more details see the sketch on github.

Current measured: 56µA when standby, 130mA when leds and wifi on (takes 4 seconds to login wifi and send message to the broker), leds on only 60mA.

The test sketch can be found on  Github