i am thinking to get a PIR sensor and a 5v relay. Any movement detected by the PIR sensor it will send command to relay to switch ON for xsecs. Also it will publish an event to my MQTT broker. The light switching ON is for 2 reasons. 1. to "scare" the intruders, 2. to help my camera pickup the image.
That is in the night.
In the morning i would like to do the MQTT publish only, just to save energy.
I have an ESP8266 nodemcu.
May i have your suggestions please?