I removed a light fixture, box and octagon to install an led recessed light that doesn't require a jbox. There were 12 wires crammed in there and when removing the box the tags I had to keep track came off (r.i.p. my DIY soul…)
I can't seem to figure out how to add the light fixture to this mix of wires and keep the switch for it working.
If I wire the black wires from nm1, nm3, nm4 and the neutrals from the same, the light in room 2 functions properly with its switch. How do I add the light fixture and nm2 into this and keep it's switch functional?
I assume nm4 is to the panel because of its older sheathing and also because wiring just nm1 and nm3 didn't complete the circuit. Nm1 and nm2 together didn't yield anything either.
edit 1
Best Answer
So you currently have the black wires from NM4, NM3, and NM1 connected together, and similarly the white wires from NM4, NM3, and NM1 connected together. What you probably have is power arriving via NM4 and being distributed to other rooms via NM3 and NM1.
You can verify this by temporarily disconnecting NM3 or NM1 and observing what parts of your house go dark. (You have already done this for NM3.)
It is also possible that NM4 and NM1 are on separate breakers. Investigate this possibility by temporarily separating the bundles of three black and three white wires, temporarily connecting a load (such as NM3) to each of NM4 and then NM1, and observing which breakers control NM4 and NM1.
NM2 seems to go to switch #1. You can verify this through contact testing, or you can just assume the cable doesn't make any other stops along the way. If this switch formerly controlled the light that you removed then this is a safe assumption.
Now -- to connect your new light and switch #1.
Please be aware that this installation, while safe, is not up to current code, because there is no neutral connection available at switch #1. You are carrying a technical debt, i.e. the future installation of a smart switch at the location of switch #1 might require replacing NM2.
I believe it is proper to replace your ceiling lamp in this way because, in terms of code compliance, you are at least not making things worse.