So i'm making this model of a house, and the basic idea is that its meant to be secure, one of the features i wanted to add was the automatic back-up power system in case someone cuts the main power supply from the outside, for that i could only think of a NOT gate, but i have no idea how to use one or how to even make one, i want the power to run through the not gate and when the power is cut off, it automatically turns on the backup current from another 9V battery which will then power the same house appliances and other security systems that i've put in the house, i also wanted to use the NOT gate in the door lock system so that no one can enter the house through the door