Skip to content

Commit

Permalink
Fixed unpack bug for LightSetColor message
Browse files Browse the repository at this point in the history
API spec and message packing routine both include a reserved 8-bit unsigned field.  Unpack did not account for this.
  • Loading branch information
FlyingDiver committed Jun 10, 2018
1 parent 316b084 commit cb738c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lifxlan/unpack.py
Expand Up @@ -171,8 +171,9 @@ def unpack_lifx_message(packed_message):
message = LightGet(target_addr, source_id, seq_num, {}, ack_requested, response_requested)

elif message_type == MSG_IDS[LightSetColor]:
color = struct.unpack("<" + ("H"*4), payload_str[0:8])
duration = struct.unpack("<I", payload_str[8:12])[0]
reserved = struct.unpack("<B", payload_str[0:1])[0]
color = struct.unpack("<" + ("H"*4), payload_str[1:9])
duration = struct.unpack("<I", payload_str[9:13])[0]
payload = {"color": color, "duration": duration}
message = LightSetColor(target_addr, source_id, seq_num, payload, ack_requested, response_requested)

Expand Down

0 comments on commit cb738c9

Please sign in to comment.