LIFX Developer Zone

Tile StateDeviceChain


#1

Hello fellow developers,

Was curious if anyone can shed any light on the response 702 - StateDeviceChain, specifically with the second variable type. Its name is tile_devices[16] and the type on the documentation is 16 Tile. Seems to me from the name its an array of some type, but I have not been able to properly parse it and because of this it is throwing my last variable of total_count off which will be important to my application in the future for safe guards.

Thanks for the help guys and gals,

Austin - ChonBonStudios


#2

Hi,

The Tile it’s referring to is https://lan.developer.lifx.com/docs/tile-messages#section-tile

So, if say we have the pkt:

96030014777d44ccd073d533134600004c4946585632010150fc6c230a000000be0200000089001effd0100000000000000000a03f08083201000000370000000a00000000623346aa30481500623346aa3048152d00030001000000ffffffffffff00000000803f0000a03f08083201000000370000000900000000623346aa30481500623346aa3048152d00030001000000ffffffffffff0000000000000000803e08083201000000370000000600000000623346aa30481500623346aa3048152d00030001000000d7008800751000000000803f0000803e08083201000000370000000a00000000623346aa30481500623346aa3048152d00030001000000650420ffbf0e0000000000400000a03f08083201000000370000000a00000000623346aa30481500623346aa3048152d00030001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005

Then the header will unpack into:

size         : 918
protocol     : 1024
addressable  : True
tagged       : False
reserved1    : b'\x00'
source       : 3427040631
target       : b'\xd0s\xd53\x13F\x00\x00'
reserved2    : b'LIFXV2'
res_required : True
ack_required : False
reserved3    : b'\x00'
sequence     : 1
reserved4    : b'P\xfcl#\n\x00\x00\x00'
pkt_type     : 702
reserved5    : b'\x00\x00'

And the payload unpacks into

start_index                   : 0

tile0_reserved                : 137
tile0_reserved                : -226
tile0_reserved                : 4304
tile0_reserved                : 0
tile0_user_x                  : 0.0
tile0_user_y                  : 1.25
tile0_width                   : 8
tile0_height                  : 8
tile0_reserved                : 50
tile0_device_version_vendor   : 1
tile0_device_version_product  : 55
tile0_device_version_version  : 10
tile0_firmware_build          : 1533529181000000000
tile0_reserved                : 1533529181000000000
tile0_firmware_version        : 196653
tile0_reserved                : 1

tile1_reserved                : -1
tile1_reserved                : -1
tile1_reserved                : -1
tile1_reserved                : 0
tile1_user_x                  : 1.0
tile1_user_y                  : 1.25
tile1_width                   : 8
tile1_height                  : 8
tile1_reserved                : 50
tile1_device_version_vendor   : 1
tile1_device_version_product  : 55
tile1_device_version_version  : 9
tile1_firmware_build          : 1533529181000000000
tile1_reserved                : 1533529181000000000
tile1_firmware_version        : 196653
tile1_reserved                : 1

tile2_reserved                : -1
tile2_reserved                : -1
tile2_reserved                : -1
tile2_reserved                : 0
tile2_user_x                  : 0.0
tile2_user_y                  : 0.25
tile2_width                   : 8
tile2_height                  : 8
tile2_reserved                : 50
tile2_device_version_vendor   : 1
tile2_device_version_product  : 55
tile2_device_version_version  : 6
tile2_firmware_build          : 1533529181000000000
tile2_reserved                : 1533529181000000000
tile2_firmware_version        : 196653
tile2_reserved                : 1

tile3_reserved                : 215
tile3_reserved                : 136
tile3_reserved                : 4213
tile3_reserved                : 0
tile3_user_x                  : 1.0
tile3_user_y                  : 0.25
tile3_width                   : 8
tile3_height                  : 8
tile3_reserved                : 50
tile3_device_version_vendor   : 1
tile3_device_version_product  : 55
tile3_device_version_version  : 10
tile3_firmware_build          : 1533529181000000000
tile3_reserved                : 1533529181000000000
tile3_firmware_version        : 196653
tile3_reserved                : 1

tile4_reserved                : 1125
tile4_reserved                : -224
tile4_reserved                : 3775
tile4_reserved                : 0
tile4_user_x                  : 2.0
tile4_user_y                  : 1.25
tile4_width                   : 8
tile4_height                  : 8
tile4_reserved                : 50
tile4_device_version_vendor   : 1
tile4_device_version_product  : 55
tile4_device_version_version  : 10
tile4_firmware_build          : 1533529181000000000
tile4_reserved                : 1533529181000000000
tile4_firmware_version        : 196653
tile4_reserved                : 1

tile5_reserved                : 0
tile5_reserved                : 0
tile5_reserved                : 0
tile5_reserved                : 0
tile5_user_x                  : 0.0
tile5_user_y                  : 0.0
tile5_width                   : 0
tile5_height                  : 0
tile5_reserved                : 0
tile5_device_version_vendor   : 0
tile5_device_version_product  : 0
tile5_device_version_version  : 0
tile5_firmware_build          : 0
tile5_reserved                : 0
tile5_firmware_version        : 0
tile5_reserved                : 0

tile6_reserved                : 0
tile6_reserved                : 0
tile6_reserved                : 0
tile6_reserved                : 0
tile6_user_x                  : 0.0
tile6_user_y                  : 0.0
tile6_width                   : 0
tile6_height                  : 0
tile6_reserved                : 0
tile6_device_version_vendor   : 0
tile6_device_version_product  : 0
tile6_device_version_version  : 0
tile6_firmware_build          : 0
tile6_reserved                : 0
tile6_firmware_version        : 0
tile6_reserved                : 0

tile7_reserved                : 0
tile7_reserved                : 0
tile7_reserved                : 0
tile7_reserved                : 0
tile7_user_x                  : 0.0
tile7_user_y                  : 0.0
tile7_width                   : 0
tile7_height                  : 0
tile7_reserved                : 0
tile7_device_version_vendor   : 0
tile7_device_version_product  : 0
tile7_device_version_version  : 0
tile7_firmware_build          : 0
tile7_reserved                : 0
tile7_firmware_version        : 0
tile7_reserved                : 0

tile8_reserved                : 0
tile8_reserved                : 0
tile8_reserved                : 0
tile8_reserved                : 0
tile8_user_x                  : 0.0
tile8_user_y                  : 0.0
tile8_width                   : 0
tile8_height                  : 0
tile8_reserved                : 0
tile8_device_version_vendor   : 0
tile8_device_version_product  : 0
tile8_device_version_version  : 0
tile8_firmware_build          : 0
tile8_reserved                : 0
tile8_firmware_version        : 0
tile8_reserved                : 0

tile9_reserved                : 0
tile9_reserved                : 0
tile9_reserved                : 0
tile9_reserved                : 0
tile9_user_x                  : 0.0
tile9_user_y                  : 0.0
tile9_width                   : 0
tile9_height                  : 0
tile9_reserved                : 0
tile9_device_version_vendor   : 0
tile9_device_version_product  : 0
tile9_device_version_version  : 0
tile9_firmware_build          : 0
tile9_reserved                : 0
tile9_firmware_version        : 0
tile9_reserved                : 0

tile10_reserved               : 0
tile10_reserved               : 0
tile10_reserved               : 0
tile10_reserved               : 0
tile10_user_x                 : 0.0
tile10_user_y                 : 0.0
tile10_width                  : 0
tile10_height                 : 0
tile10_reserved               : 0
tile10_device_version_vendor  : 0
tile10_device_version_product : 0
tile10_device_version_version : 0
tile10_firmware_build         : 0
tile10_reserved               : 0
tile10_firmware_version       : 0
tile10_reserved               : 0

tile11_reserved               : 0
tile11_reserved               : 0
tile11_reserved               : 0
tile11_reserved               : 0
tile11_user_x                 : 0.0
tile11_user_y                 : 0.0
tile11_width                  : 0
tile11_height                 : 0
tile11_reserved               : 0
tile11_device_version_vendor  : 0
tile11_device_version_product : 0
tile11_device_version_version : 0
tile11_firmware_build         : 0
tile11_reserved               : 0
tile11_firmware_version       : 0
tile11_reserved               : 0

tile12_reserved               : 0
tile12_reserved               : 0
tile12_reserved               : 0
tile12_reserved               : 0
tile12_user_x                 : 0.0
tile12_user_y                 : 0.0
tile12_width                  : 0
tile12_height                 : 0
tile12_reserved               : 0
tile12_device_version_vendor  : 0
tile12_device_version_product : 0
tile12_device_version_version : 0
tile12_firmware_build         : 0
tile12_reserved               : 0
tile12_firmware_version       : 0
tile12_reserved               : 0

tile13_reserved               : 0
tile13_reserved               : 0
tile13_reserved               : 0
tile13_reserved               : 0
tile13_user_x                 : 0.0
tile13_user_y                 : 0.0
tile13_width                  : 0
tile13_height                 : 0
tile13_reserved               : 0
tile13_device_version_vendor  : 0
tile13_device_version_product : 0
tile13_device_version_version : 0
tile13_firmware_build         : 0
tile13_reserved               : 0
tile13_firmware_version       : 0
tile13_reserved               : 0

tile14_reserved               : 0
tile14_reserved               : 0
tile14_reserved               : 0
tile14_reserved               : 0
tile14_user_x                 : 0.0
tile14_user_y                 : 0.0
tile14_width                  : 0
tile14_height                 : 0
tile14_reserved               : 0
tile14_device_version_vendor  : 0
tile14_device_version_product : 0
tile14_device_version_version : 0
tile14_firmware_build         : 0
tile14_reserved               : 0
tile14_firmware_version       : 0
tile14_reserved               : 0

tile15_reserved               : 0
tile15_reserved               : 0
tile15_reserved               : 0
tile15_reserved               : 0
tile15_user_x                 : 0.0
tile15_user_y                 : 0.0
tile15_width                  : 0
tile15_height                 : 0
tile15_reserved               : 0
tile15_device_version_vendor  : 0
tile15_device_version_product : 0
tile15_device_version_version : 0
tile15_firmware_build         : 0
tile15_reserved               : 0
tile15_firmware_version       : 0
tile15_reserved               : 0

total_count                   : 5

Hopefully you can see where your parsing goes wrong by comparing against that :slight_smile:


#3

Yes I have know realized that the tile_devices[16] is an area of the tile class, I guess the only question I have for LifX then is why an area of 16? As far as I am aware the max number of supported tiles in a single chain is 5, I guess maybe to future proof in case they support more? If so that would be awesome, I would love more in a single chain, imagine a 4 x 4 grid and the animations you could do! Maybe we could actually communicate to more than 5 via the lan protocol and the default app by lifx cannot for now, I dont have more than 5 tiles so I cant try this yet but I would love to see if someone tried this!


#4

Yeah, having 16 and start_index is essentially future proofing the API.