{"__v":0,"_id":"57fdc6b23dc6b90e003486f2","category":{"project":"5581248904ae5b0d0026289a","version":"57fdb17c4defec0e0064228b","_id":"57fdb520bcc07b0e00d1ef41","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-10-12T03:59:28.475Z","from_sync":false,"order":1,"slug":"guides","title":"Guides"},"parentDoc":null,"project":"5581248904ae5b0d0026289a","user":"557e2561eb75d80d00af3dab","version":{"__v":2,"_id":"57fdb17c4defec0e0064228b","project":"5581248904ae5b0d0026289a","createdAt":"2016-10-12T03:43:56.009Z","releaseDate":"2016-10-12T03:43:56.009Z","categories":["57fdb17c4defec0e0064228c","57fdb17c4defec0e0064228d","57fdb17c4defec0e0064228e","57fdb520bcc07b0e00d1ef41"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-12T05:14:26.111Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"The LIFX Application allows users to organise each bulb by giving it a group and a location. Most users use groups to represent a room, and location to represent a property (such as a house or office) but this does not need to be the case. These groups and locations are stored on the bulbs themselves, and are designed so that they can be modifies or renamed as long as one of the bulbs in the affected group is powered on.\n\n## Groups\n\nEach group is stored in a bulb as three pieces of data, a 16 byte identifier, a 32 byte string and a 64-bit integer timestamp.\n\n| Field | Type |\n|-------|------|\n| group | byte array, size: 16 bytes |\n| label | string, size: 32 bytes |\n| updated_at | unsigned 64-bit integer |\n\nWhen determining what groups are available given the data from all the bulbs your app can see each unique id should be considered a separate group. To determine the correct label to display to the user search the list of all the bulbs with matching group ids, and choose the label from the one with the highest timestamp. This allows the protocol to remain resilient even in situations where a group changes label while or more of the members of the group are offline.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Groups spanning locations\",\n  \"body\": \"At the current time groups should not have the same id across multiple locations. That is to say all groups are subsets of a parent location. Groups that span multiple locations are undefined and may not behave in the expected manner.\"\n}\n[/block]\n## Locations\n\nLocations are also stored as three pieces of data identical to the way a group is stored.\n\n| Field | Type |\n|-------|------|\n| location | byte array, size: 16 bytes |\n| label | string, size: 32 bytes |\n| updated_at | unsigned 64-bit integer |\n\nThe same algorithm mentioned for groups applies to locations as they share the same semantics. A location is considered to contain the groups of the bulbs within it, so groups should not span multiple locations.\n\n## Control\n\nTo control a group of lights simultaneously simply message each member of the group individually using a unicast message.","excerpt":"Using groups and Locations form the LIFX app in your third party development","slug":"groups-and-locations","type":"basic","title":"Groups and Locations"}

Groups and Locations

Using groups and Locations form the LIFX app in your third party development

The LIFX Application allows users to organise each bulb by giving it a group and a location. Most users use groups to represent a room, and location to represent a property (such as a house or office) but this does not need to be the case. These groups and locations are stored on the bulbs themselves, and are designed so that they can be modifies or renamed as long as one of the bulbs in the affected group is powered on. ## Groups Each group is stored in a bulb as three pieces of data, a 16 byte identifier, a 32 byte string and a 64-bit integer timestamp. | Field | Type | |-------|------| | group | byte array, size: 16 bytes | | label | string, size: 32 bytes | | updated_at | unsigned 64-bit integer | When determining what groups are available given the data from all the bulbs your app can see each unique id should be considered a separate group. To determine the correct label to display to the user search the list of all the bulbs with matching group ids, and choose the label from the one with the highest timestamp. This allows the protocol to remain resilient even in situations where a group changes label while or more of the members of the group are offline. [block:callout] { "type": "info", "title": "Groups spanning locations", "body": "At the current time groups should not have the same id across multiple locations. That is to say all groups are subsets of a parent location. Groups that span multiple locations are undefined and may not behave in the expected manner." } [/block] ## Locations Locations are also stored as three pieces of data identical to the way a group is stored. | Field | Type | |-------|------| | location | byte array, size: 16 bytes | | label | string, size: 32 bytes | | updated_at | unsigned 64-bit integer | The same algorithm mentioned for groups applies to locations as they share the same semantics. A location is considered to contain the groups of the bulbs within it, so groups should not span multiple locations. ## Control To control a group of lights simultaneously simply message each member of the group individually using a unicast message.