This would presumably be installed in a door jam to turn a light on/off when the door is open/closed. It works on 110V with a maximum current of 2A. All of that is fine for my application (125mA LED light).

But is this safe/legal/to-code? The wires are not shielded, and not long, so they would need to be extended, which would require a junction box, right?

Safe or not?

  • 2
    Is there any indication of a UL listing? Is this for North American usage?
    – bib
    Commented Jan 31, 2018 at 20:19
  • 1
    @bib - Doubt it - definitely an import.
    – Josh M.
    Commented Jan 31, 2018 at 20:50
  • 1
    safe and legal are two different questions. It's probably safe, there's not much to go wrong, electrically speaking, so if it works, it should stay working. You also need to remember that those listings quote Chinese Amps, which need converted to standard by dividing by 2.5.
    – dandavis
    Commented Jan 31, 2018 at 21:26
  • 1
    You know there are mechanical springy switches that are made for door jambs and are safe and listed and all that right?
    – JPhi1618
    Commented Jan 31, 2018 at 21:45
  • 1
    @dandavis, to be fair, UL was only making sure it was electrically safe.
    – JPhi1618
    Commented Jan 31, 2018 at 22:03

2 Answers 2


Edit: How to use good wiring methods for a closet light switch with a door reed switch or plunger. The key is work in low voltage.

First, keep in mind Code has a thing or two to say about closet lights, so the heat of the light doesn't start a fire, and even more about mains wiring in closets.

Option 1: use low voltage lighting off a transformer or power supply located at the mains supply. But watch it, low voltage means high current!

Option 2: bring mains power to the light fixture, mount an extension octagon box on the fixture box, and something like a RiB or Aube transformer-relay combo device. These either mount in a knockout on the junction box, or on the cover of a 4" square junction box. They are made for this use exactly.

The RiB's cost as little as $16 but most of this equipment puts the mains wiring inside the junction box and the low voltage wiring outside as code requires. RiB does not. Ask a local electrical supply house (not big-box store) if they have any magic junction boxes to solve this.

See where it says "Sold By" and the next word is not Amazon? This is Amazon Marketplace, which is on the same level as eBay and AliExpress. That gomi doesn't even come close to meeting the standards for equipment used in mains wiring. In NEC, this is covered in Article 110, particularly 110.3 where equipment must be listed by an independent testing lab such as UL, CSA or German TUV. (note CE is not a testing lab.)

Mind you, *components** are not equipment. If it's sold at Digi-Key or Mouser, it's a component. You use equipment, not components, in mains wiring. So what does a UL mark on a component mean? It means UL has already done performance, insulation, toxic smoke etc. testing and will not need to redo those tests when certifying your equipment.

Equipment used in mains electric is sold at your friendly neighborhood electrical supply house, which are mostly local shops but include Greybar and City Electric. Home Depot, Lowes and Menards have some of this stuff.

Your item there looks like a component. But setting aside that, it doesn't provide any possible way to wire it using any safe wiring methods in NEC chapter 3.

It's fit for using inside of equipment, where chapter 3 does not apply: say you manufacture a relay box and want an interlock to shut off power if the cover was removed. But the equipment would need to be listed separately.

Another option for its use is low-voltage wiring. The component is certified (by who? magic elves?) for 120V, but you're allowed to use it at lower voltages**. Code is much more relaxed when there's 5 volts on a wire instead of 120. Low voltage wiring is covered in a different chapter, and devices which look like this (but are listed) are used in things like security systems all the time.

This would allow you to wire it using the informal rules for thermostat and intercom wiring, put 5V or 12V on it, and use that to switch your mains load, either with a relay or smart switch magic.

And by "it" I mean a quality unit sourced from a security-system supply house, Mouser, McMaster-Carr, etc. This online dreck is often wildly overpriced, in this case I found a similar one at West Marine (!!!)* for half the price, free shipping and UL listed. SMH. Use Marketplace/eBay/Ali for inspiration but get listed versions of it, often cheaper, often at local shops.

* West Marine is infamous for overpricing already-overpriced marine gear.

** in fact, putting anywhere near spec voltage on something that "fell off a truck in Shenzhen" is itself crazy.

*** not even on Amazon Prime, Prime requires the manufacturer stock up Amazon warehouses, and Amazon charges a mint for that, and that is passed onto you in the price.

  • Thanks, I thought so! I was just looking for a cheap "closet light switch". There are others which are low voltage with a relay, but seemed seriously overpriced. I'll skip this one and keep looking.
    – Josh M.
    Commented Jan 31, 2018 at 20:54
  • 1
    @JoshM. Ah, so that's what you're doing! I edited with a few ideas of sanely priced, Code legal options. Commented Jan 31, 2018 at 22:21

It would not be to code unless it bore the (legitimate) mark of a suitable standards body, like UL. I'm sure it does not, otherwise you'd see similar things on the shelves here.

Because it can only handle 2A, it would need to be protected by a fuse or breaker not greater than 2A. So you'd need a secondary fuse somewhere in line. That could be in an in-line fuse holder in the junction box. I have no idea if there are code-legal 2A fuses and holders for use in residential wiring in this way.

The separate wires, not protected by any kind of sheath, are a problem. Possibly you could rig up a length of conduit to convey those wires back to the junction box.

Any junction box it'd need to be "accessible". Basically on the inside of your closet where the light switch would be, would probably work. If the box were on the other face of the studs that make up the door frame, then you could have a length of conduit from the box through the studs, with this sensor thing in the end of the conduit. You could have a switch mounted in the box; maybe one of those on-off-on dual-throw switches so you could bypass this device when (just sayin') it fails in one mode or the other.

Offhand I'd say, wire this up in a low-voltage circuit. But they expressly say not use it on 12/24V. Which strikes me as odd; possibly they mean it cannot handle DC.

If this were a component of a fixture, like a motion detector integral to the chassis in which the lamp were installed, then I think you'd be ok. But intended to be installed in a door jamb, I really doubt it.

So: Code? Almost certainly not. Safe enough? Your call.

There are major-brand code-compliant door jamb switches available for exactly this purpose in the catalogs of all the major brands. EG, L*viton 1865. (It's rated at 3A switching but I'm sure it's code-compliant on a 15A circuit). These devices have an integral junction box so can be fed by standard Romex.

I'd still use a dual-throw switch for when you want to leave the door open without the light on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.