One of the current methods of protecting your home is by setting traps that attract mobs; lure them into a narrow hole and kill them quickly. A good, easy-to-create trap is the lava drawbridge.
Part 1 of 4: Creating a base for the pistons
Step 1. Dig a hole in front of your door
Dig a hole 4 blocks long, 2 blocks wide, starting at your door. The length of the pit depends on the length of your trap.
Make a hole 5 blocks deep
Step 2. Make a base for the sticky pistons
At the bottom of your trap, make a base for the sticky pistons. You can use any structure, one block high. Dig more around the sides so you can work there.
Step 3. Install 8 sticky pistons
Make the frame 2 pistons wide and 4 long.
Step 4. Install a red follower behind each piston
Step 5. Make the floor of your trap
On top of the sticky pistons, place any block as a floor for your trap.
Part 2 of 4: Installing Lava
Step 1. Place the lava two blocks lower than your front door
The number of lava blocks will depend on the length of your trap. Lava blocks should be 1 block higher and 1 block to the left of your pistons.
Step 2. Place the glass on top of the lava
Part 3 of 4: Connecting repeaters to the switch
Step 1. Install the switch in a convenient location inside your home, preferably near the door
Step 2. Connect the red repeater to the switch
Step 3. Cover the rest of the surface
Make sure the only hole is in front of your door.
Part 4 of 4: Testing Your Trap
Step 1. At night, lure the mobs to your door
Step 2. Enter the house through the front door and wait for the mob to fall into the pit
Step 3. Release the lava
When all the mobs are in the pit, use the switch to release the lava.