What is needed here is The Thing, which was a very clever bit of espionage equipment. It had no power supply and only emitted a signal when activated remotely. Side note: turns out Leon Theremin (as in the inventor of the musical device) was later revealed to have been a Soviet spy.
As to prank devices, my best was using the small electronic guts of a musical Christmas card. I rigged it so it would play continuously and placed it in the tissue box of a coworker (to diffuse the sound).
My favorite part of that story is that, after the bug was discovered, the soviets kept activating the transmitter that powered it… either to pretend denying the existence of the bug, or make us worry that there were more we hadn’t found yet.