Anyone got resources for smart switches?

Hello, wondering if anyone has any resources for how things like Google Home, Alexa and Home Assistant gateway turn lights on and off?

I mean on the network level when I say “Ok google, turn on the lights”, how does it know the IP address of my smart switch, and what packet (JSON?) to send it to? Does it just use the broadcast address? Having trouble finding stuff on it, because I don’t even know what term to search for without it coming up with a bunch of irrelevant stuff.

Want to build my own sensor out of an ESP8266 and have it talk to one of the numerous smart switches I have, and also how Home Assistant and other systems monitors the states of the switches, lights and other things like that.

Wasn’t sure which section to put this into, so I thought Third Party Integrations was as good as any.

Smart switches connect to a server at startup, so there is no broadcasting involved.

A server that the manufacturer setup online somewhere? How does Home Assistant discover them?

Depends on the integration. I’ll give some examples :

  • if you use tasmota on your switches, your switches connect to an mqtt server, and the switches get either pushed to HA if you enabled discovery, or HA knows them because you configured them in configuration.yaml
  • if you use tuya switches, the connect to a server in china. HA knows about them, because when you configured the tuya-integration, HA polls the tuya cloud server and gets informed about the available switches/lights/…
  • if you have HUE lights, the switches/lights connect to the HUE hub. HA knows about them, because when you configured the HUE integration, HA knows how to poll the HUE hub for available items.
  • etc…

This is what I want to learn more about. So how does the server for the switches know which subset of all switches to send back to HA when requested? I have tested with WeMo, and HA automatically finds them on my network.

Wemo does indeed broadcasting.