Response packet discription

I am writing a driver that will parse the feedback given after a res_requried is sent. I understand the sent packet that needs to be sent. I have also looked at Building a LIFX packet but this does not show a response from LIFX.

If I see how the LIFX responds to a sent message then I can parse the information correctly.

From Header Description:

_res_required_ set to one (1) within a Set message, e.g Light::SetPower will cause the device to send the corresponding State message, e.g Light::StatePower

Though personally I just use ack_required instead.

But what does the entire message consist of? Does it consist of a header, etc.

Yes. The messages the bulb sends to you are built the same way as the messages you send to the bulb.

@ppelleti

Just to be clear…

If I send:
31 00 00 14 00 00 00 00 3c 2b 45 69 1b 23 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 66 00 00 00 00 55 55 00 00 FF FF AC 0D D0 07 00 00

what will it look like?

@daniel_hall, could you take a look at this? I haven’t had time to decode the message yet.

So, that is:

Header {hdrSize = 49, hdrOrigin = 0, hdrTagged = False, hdrAddressable = True, hdrProtocol = 1024, hdrSource = 0, hdrTarget = 3c2b45691b23, hdrAckRequired = False, hdrResRequired = True, hdrSequence = 0, hdrType = 102}
SetColor {scColor = HSBK {hue = 21845, saturation = 0, brightness = 65535, kelvin = 3500}, scDuration = 2000}

One thing I noticed is that you’re setting source to 0, and I thought it was generally better to set source to nonzero, to get a unicast response.

Anyway, though, you’re sending a SetColor message, so I would expect you to get back a State message. An example State message might look like this:

Header {hdrSize = 88, hdrOrigin = 0, hdrTagged = False, hdrAddressable = True, hdrProtocol = 1024, hdrSource = 305419896, hdrTarget = 0015edaabbcc, hdrAckRequired = False, hdrResRequired = False, hdrSequence = 0, hdrType = 107}
StateLight {slColor = HSBK {hue = 4369, saturation = 8738, brightness = 13107, kelvin = 5000}, slPower = On, slLabel = "Living Room"}

which, in hex, is:

58000014785634120015edaabbcc0000000000000000000000000000000000006b00000011112222333388130000ffff4c6976696e6720526f6f6d0000000000000000000000000000000000000000000000000000000000

though I just made this up by hand. The best way to know what the actual hardware would send back would be to send your message and see what you get back.

1 Like

Sorry it took me a while to reply to this, I’ve been sick recently. Looks like @ppelleti has me covered though.

Broadcasts on a wifi network have a big impact, and are more likely to be dropped than other packets. Setting source to a random non-zero value (and thus using unicast messages) should also make things more reliable.

1 Like