I have some WIFI bulb from Xiaomi/Philips. It is controlled using Mi Home app. I can control it (turn on/off) both when I am in the same network as the bulb or when I'm in a completely different place, in a different network.
How is it possible?
I understand that while being in the same wifi network, my phone is able to talk directly to the bulb (although I do not know if this is what happens in reality). However, when I'm in a different network, how does that work?
I assume that Mi Home does not actually talk with the bulb directly. I believe it communicates with some cloud server that actually communicates with the bulb. However, how does such server (in the cloud) communicate with my bulb in my local (NATted) network? I do not have any port forwarding set up on my router for my bulb.
The only way I see it possible is if it is the bulb that checks if there are any commands for it in the cloud by invoking some API on schedule (every few seconds?) - some form of HTTP polling. I don't like this idea, because that would mean that my network would be very "crowded" if I had a few of these bulbs.
So, how am I able to control my bulb from another network?