![wiring a bathroom fan and light to one switch wiring a bathroom fan and light to one switch](https://www.doityourself.com/forum/attachments/electrical-ac-dc/20582d1383692996-new-bath-exhaust-fan-wiring-questions-fandiagram1.jpg)
So I decided to install a second Shelly to control the lights, which meant I could do things in future like turn them on using a motion sensor, or not turn them on if the room was already bright enough, and I could do so independent of the fan and its timing. The power source will either enter at the switch box or up at the light fixture or the exhaust fan. The key factor is to understand where the power source enters the circuit. Once I started to connect things up, though, I realised I’d have to do a bit of rewiring of the lights, too, because of the way things were connected. The electrical wiring for separate switching of the bathroom exhaust fan and the light fixture will require identifying the existing circuit and existing switch wiring. I could also adjust those times if, say, it was the middle of the night. And then, if you’re staying a bit longer, turn the fan on and leave it running for five minutes after you’ve departed. Even better, I could follow the model that some newer timed fans now use: after the light switches on, don’t start the fan for a minute or two, in case this is just a brief visit. Once I discovered the Shelly 1, with its mains-voltage input, I realised I could use it to read the state of the light switch and control the fan directly, with adjustments being made in software, which would be much nicer and wouldn’t involve inhaling any glass fibres. Oh, and did I say that we had three bathrooms like this? There had to be a better way. Then repeating the process until I got it right. The wiring diagram below shows the wiring setup you need to connect your new timed fan to your existing light circuit ceiling rose so that when the ligh is turned on, so is the fan. Twist the ground wires together and connect them to the green ground screw on the switch. Splice the white wires together and cap them. Connect the black wire from the fan to the bottom terminal of the switch and the live circuit wire to the top terminal. Then climbing back down, going to the bathroom, turning on and off the light and waiting for 10-15 mins with a stopwatch to see whether I’d set it correctly. Mount the fan and light and move to the switch box.
![wiring a bathroom fan and light to one switch wiring a bathroom fan and light to one switch](https://www.tschmidt.com/writings/Bathroom_Fan_Control_files/image002.jpg)
The trouble was that adjusting the timer meant getting a ladder and going up into the attic with a torch, clambering over rafters to the farthest, most inaccessible corner, then burrowing through thick layers of fibreglass insulation to get to the fan, unscrewing the top and inserting a small screwdriver in a slot and turning it a little bit. ‘A little while’, we realised, was perhaps a bit long in our case, after one guest hinted that the sound of the fan in their ensuite had kept them awake for 20 mins… In our bathrooms, we had traditional extractor fans controlled by the pull-cord light switch, with a timer so that the fan turned off a little while after the light.