The Lifx Accessor discovers and controls a Lifx light bulb over Wifi in a local area network. In order to use it, you need to be connected to the same network that the light bulb stores its credentials. The main advantage over Hue is that there is no need to know the IP address in advance.
While it is possible to interact with Lifx bulbs over the Internet by sending HTTP requests to the Cloud, this module does not provide such mechanism. The communication with Lifx light bulbs is done over UDP/IP. Messages are arrays of numeric bytes ordered in little-endian. The packets construction can be found in this link.
Discovery
Discovery consists on broadcasting UDP discovery messages on port number 56700. The receiving Lifx light bulbs will answer with a 'State' message. The IP address and mac address are extracted from the answer. Every new discovered bulb is added to an array, and the user can select the one to use.
Possible use case scenarios
There are two ways for controlling a Lifx bulb using this acccessor:
- The first one consists on discovering Lifx bulbs on the network and then selecting the one to use.
- The second is by running a manual configuration, where the light parameters are received in the input port. A use case of this scenario is when a server sends information about available devices and their parameters.
Pros
- The setup is easy. No need for a previous knowledge of the IP address.
- Both supported use case scenarios.
Cons
- The setup (configuring the light with a certain Wifi network credentials) is not supported. It can be done using the Lifx mobile app.
- It is possible to run discovery and control the light, even if not setup. For this, you need to connected to the Lifx Wifi. The drawback is that discovery is limited to only one bulb, the one you are connected to its network!
- Lifx supports only WPA/WPA2 and OPEN encryption (see Wi-Fi Connectivity Checklist). No support for WEP or WPS. Besides, only a Wifi SSID and a password can be used. This makes the Lifx inappropriate to Enterprise networks.
Demo
A simple use case demo can be found in Lifx folder under $PTII/org/terraswarm/accessor/demo.
Open Questions
- It might be interesting to use Ontologies to convert a color 'string' value to [[https://en.wikipedia.org/wiki/HSL_and_HSV|HSBK], which is used to represent the color and color temperature of a light.
- In case of muti-Wifi netwok
ToDo
- Add fault tolerance mechanisms. For this, all sent messages will request acknowledgment. Since it is possible to store a message reference in the packet itself, it is easy to check if the acknowledgment is not received within a time interval.
- Add color support.