1

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?

2

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.

  • Thanks for the quick response Michael. – Ε Г И І И О Jun 15 at 10:17
  • BTW to my surprise, some of my smart switches work in a totally different way. They neither connect to a hub nor they use bluetooth. That's why I was baffled. – Ε Г И І И О Jun 15 at 10:20
  • As I said in my answer I listed some of the techniques used. But once again I cannot answer for every device and especially because you have offered no specific model information for your devices. – Michael Karas Jun 15 at 10:25
  • Here's one: youtube.com/watch?v=cIRU17UQhUU sorry for the stupid background music on it, I couldn't find a better one. – Ε Г И І И О Jun 15 at 10:56
  • @ΕГИІИО - I added an additional description on how the Sonoff WiFi smart switch pairs with the phone app. – Michael Karas Jun 15 at 12:42
1

Finally I figured how your smartphone passes your wifi info to the smart switch. My guess was right, it was using ultrasonic communication behind the scenes. And this seems to be somewhat common with devices such as Chromecast, Lisnr & Chirp.

I tested this with an ultrasonic wave capturing app and all fell into place afterwards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.