Now I am going to talk about how LIFXcl works, then how LIFXtend works.
LIFXcl
First, the command must reach the gateways. If you don't specify a gateway, the command is broadcast to all devices on your network ("255.255.255.255"). This usually works fine, however some routers might block this communication, which is why I added the ability to specify a Gateway.
So now the command is at the gateway. The gateway will relay the command to the other bulbs as long as the site defined in the command is the same as the bulbs site. When a command is issued by LIFXcl with only the "Site" given, the target will be declared as "FF-FF-FF-FF-FF-FF" which means "everyone" or broadcast. Your gateway bulbs will communicate this command to the pan, and all your bulbs will do what you broadcast.
If you define a target mac address however, it will only be executed by that specific bulb.
LIFXtend
First I told you the bulbs don't react if a site is not defined. That's not true all the times. They react to "Get Pan gateway", which is there to find the gateways and the site. So the first thing LIFXtend does when you press "Discover" is issue this command. All gateway bulbs will answer and tell their site and their mac_address.
Next, we can broadcast "Get light state" to our new found site. Then, all of your bulbs will answer, and your list of bulbs will get populated. From there on we can issue commands to the individual bulbs via their own gateway, which is a much smoother way than just broadcasting all the time. The rest is just some update calls from time to time to check if the bulbs behave and if they are still all online. You can even disconnect a gateway bulb, LIFXtend will find another way after 10-20 seconds. (Actually the LIFX Network itself finds another way, the bulbs are pretty clever in that regard).
More information about the packets: https://github.com/magicmonkey/lifxjs/blob/master/Protocol.md#0x66
Sunday, February 2. 2014
LIFX Network Part Two
Trackbacks
Trackback specific URI for this entry
No Trackbacks