I'd like to make an ultrasonic switch for my light bulbs.
What does this mean? Are you trying to get the lights to come on when you get close to them?
Since the ground wire passes through the switch, how would I use an ultrasonic sensor or something like that to make it work?
What switch does the ground wire pass through? Usually, the switch makes/breaks the hot wire, not the ground wire.
And would it need coding or a arduino?
Yes.