LIFXLan question about Location byte array

This is a StateLocation message payload:

payload = [123, 119, 23, 235, 63, 249, 234, 65, 47, 96, 92, 123, 89, 204, 143, 188, 79, 102, 102, 105, 99, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 91, 41, 2, 122, 82, 20]

    location = [b for b in struct.unpack("B"*16, payload[0:16])]
    label = "".join([chr(b) for b in struct.unpack("b"*32, payload[16:48])])
    updated_at = struct.unpack("Q", payload[48:56])[0]

Payload:
Location : [123, 119, 23, 235, 63, 249, 234, 65, 47, 96, 92, 123, 89, 204, 143, 188]
Label : Office
Updated At : 1464366978551197952

Am I getting the correct values? Why is location a byte string? Am I supposed to keep it like that or convert it to something else for consumption?

Location is an opaque 16-byte value. Basically it is a UUID, although I don’t think the LIFX documentation refers to it as such.

For consumption in a UI, use the label. (“Office”, in this case.)

Same thing with group ID as well? So devices can only be part of one group?

Yes. There is some further discussion of groups and locations in this thread, this thread, and this thread.

The location id is the unique representation of the group. We use this to uniquely identify a location because a location might get renamed while a bulb is offline. This way you can use the id to always uniquely identify the location. The label for the location is the label on the bulb that has the highest timestamp set.

The same works for groups.