Install a new black wire to the bottom wire screw on the switch located beneath the top connection just made. Install a 3 wire cable of the same wire gauge from the vanity light to the wall switch.
2020 E27 Screw Socket Adapter With Switch Plug Socket Base For Energy Saving Led Bulbs Hose Universal Lamp Holder Converters E27 For Night Light From
How to wire a light switch from a plug socket. The black and white would be used for the power for the outlet and the vanity light switch. This kind of task is really useful if you have a source of power where you can plug in a light but want to place the switch in a more convenient. Connect the black incoming wire to the switch to be installed in the circuit using the screwdriver. In this case if you have a neutral and a ground you can run 14 2 wire to an outlet. Switch on the light to see if its working. The procedure is not unlike wiring multiple lights to a single switch.
In the in line method the switch is in line with the power to the load so power comes into the switch box. Put in the new socket box and pull the cable through it. You can even wire the switch to control the outlet which is a great option if you prefer a plug in light fixture to a permanent one. The neutral path should run from the wide prong at the wall outlet through a marked insulation wire to the neutral terminal on the switch and to the threaded metal bulb socket. Connect the two twisted wires back into the switch terminal. Screw the socket into place and turn power back on.
Splice and strip individual wires and connect them to the right terminals on the socket. The hot path for electricity should run through the narrow plug prong at the wall outlet to the hot terminal on the switch and to the hot button at the base of the socket when the switch is on. The red wire would be used as the switched leg back up to the vanity light where it would be connected to the black wire of the vanity light. Put back the switch cover. You can plug something into the socket to see if its working. Learn how to wire up a plug in light and switch.
Hi in this video im showing how to make a light spur from socket outlet thats on ring circuit. The black wire should be installed at the top wire screw on the back side of the switch. Conversely you can connect the switch for a new light fixture to a nearby outlet which is a procedure similar to wiring outlets in series.