How to make MacBook automatically connect to different wifi networks as desired?

My main router is located in the living room and creates a wifi hotspot, call it X. I've created an additional wifi hotspot in my bedroom, call it Y, using two powerline adaptors.

How do I make my MacBook automatically connect to X while I'm in the living room and to Y while I'm in the bedroom. Thanks.


OS X will connect to the Wi-Fi network with the strongest signal, although it won't switch immediately between networks to avoid disruption to the connection.

You can alleviate this by having the same SSID for both networks, which will cause OS X to see them as a single network and switch between them automatically.