Smart Switch – How Does It Learn WiFi Settings?

smart-switch

This question is not about how to do wiring or configuring a smart switch. This is basically to kill my curiosity on how that stuff works.

So when you hook up a smart switch, you power it up by connecting the mains (live and neutral) and then uses an app to feed in the wifi settings of your home network. But you do not necessarily connect to the switch's hotspot or anything (in some modes you do, but this is not about that) so how exactly the switch learns your home wifi settings via the app?

Yes, the phone is connected to the home wifi but before pairing, the switch is not, and it cannot connect because it doesn't know the home wifi ssid or password. This seems like the classic chicken-egg problem to me 🙂 Can someone explain it technically?

Best Answer

It is not possible to give you an answer to your question that covers the exact details because there are a range of different technologies in use for smart devices. I will list a few of them here:

1) Some smart devices use proprietary wireless RF connections to a hub device that then in turn connects to your network. The hub knows how to search for devices to establish pairing via the RF connection. Often the pairing requires placing the smart device in a pairing mode so it announces itself to the hub. Setting up the hub on the local network will typically use a wired connection and get an IP address via DHCP.

2) Some smart devices use a proprietary communications protocol over the power line to a hub device that then in turn connects to your local network. Operation is similar to as described in (1) above.

3) Other smart devices have a full WiFi end point built right in. These devices are most often configured by using an App in a smart phone that talks to the smart device using a separate protocol from the phone over Blue Tooth. The smart device is typically initially placed into a Blue Tooth pairing mode and the App on the phone automates the pairing. Information about the WiFi connection is passed from the App to the smart device via the paired Blue Tooth connection.

4) There are smart devices that have a full WiFi end point built in but also have a display and buttons or a touch screen. WiFi connection information for these is entered directly into the device via this user interface. This is often seen with smart thermostat units.

5) There are a class of smart devices that have the WiFi end point but also have a USB connection. The USB connection is attached to a laptop or PC and used in a setup mode with an App on the laptop or PC to configure the WiFi connection information in the smart device through this USB interface. This type of setup has been common with some types of WiFi access routers.

6) Yet another class of smart devices that have a WiFi interface can be placed into a setup mode by pressing a button or switch. Often an LED will blink to show it is in the setup mode. In this mode the smart device acts as a WiFi access point and advertises a specific SSID. An app on a smart phone makes the phone search for that SSID and will temporarily connect the phone to that access point. Once connected the App can configure the smart device according to the SSID and password for the local network. An example of this scheme can be found in the more recent models of the Sonoff Wi-Fi smart switches.