Legality of non-lethal "booby traps" in the home

Inspired by this thread:

OK, so it’s established that setting up spring guns, vicious animals, etc. to do in would-be burglars is illegal.

Does the law say much about non-lethal booby traps? Let’s say you’ve got it rigged so that if a burglar comes in your window, a big bucket of grape jelly spills out and gets the sticky stuff all up and down the perp.

Can this guy bring the homeowner up on any reasonable kind of charge?

Here’s one that’s been available commercially for years.

Or, to take it one step further, how about a non-lethal booby trap that imprisons the intruder until the homeowner can return and call the cops?

You better hope that your booby trap that imprisons somebody only imprisons bad guys or else you’re in for a heap of trouble.

In the event of a fire you’re going to come home to a crispy firefighter in a cage. I don’t think that’s going to fly.