LIFX Developer Zone

Noob help needed please

I am a bit of a noob here and am currently stuck.
I am attempting to set up a tile array controlled by my ISY-994 home automation controller.
The ISY has the ability to send a binary string to an IP as a resource.
I can currently turn on the tiles with sending to the Tile IP
Like wise off
or Red

Where I am stuck is implementing SetTileEffect (719) to use firmware commands for Morph and Fire
719 it > 32 bits
Suggestions please on the packet
Thank you in advance


I’m not sure why those messages you mention would work because they aren’t valid.
EDIT: actually, sorry, I thought your strings were hex, but they were integers, your messages are valid ! except the target field should be the mac address of your device and when you do that tagged should be false.

SetTileEffect looks like this

size         : 104
protocol     : 1024
addressable  : True
tagged       : False
reserved1    : bitarray('00')
source       : 3195971583
target       : bitarray('0000101111001110101010111100110011001000010111100000000000000000')
reserved2    : bitarray('000000000000000000000000000000000000000000000000')
res_required : False
ack_required : True
reserved3    : bitarray('000000')
sequence     : 4
reserved4    : bitarray('0000000000000000000000000000000000000000000000000000000000000000')
pkt_type     : 719
reserved5    : bitarray('0000000000000000')
reserved8    : bitarray('00000000')
reserved9    : bitarray('00000000')
instanceid   : 3670190861
type         : 2
speed        : 5000
duration     : 0
reserved6    : bitarray('00000000000000000000000000000000')
reserved7    : bitarray('00000000000000000000000000000000')
parameters   : bitarray('0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000')
palette_count: 7
palette      : [{"brightness": 1.0, "hue": 0.0, "kelvin": 3500, "saturation": 1.0}, {"brightness": 1.0, "hue": 39.99633783474479, "kelvin": 3500, "saturation": 1.0}, {"brightness": 1.0, "hue": 59.997253376058595, "kelvin": 3500, "saturation": 1.0}, {"brightness": 1.0, "hue": 121.99954222934309, "kelvin": 3500, "saturation": 1.0}, {"brightness": 1.0, "hue": 238.99473563744564, "kelvin": 3500, "saturation": 1.0}, {"brightness": 1.0, "hue": 270.9983978027008, "kelvin": 3500, "saturation": 1.0}, {"brightness": 1.0, "hue": 293.9986266880293, "kelvin": 3500, "saturation": 1.0}, {"brightness": 0.0, "hue": 0.0, "kelvin": 0, "saturation": 0.0}, {"brightness": 0.0, "hue": 0.0, "kelvin": 0, "saturation": 0.0}, {"brightness": 0.0, "hue": 0.0, "kelvin": 0, "saturation": 0.0}, {"brightness": 0.0, "hue": 0.0, "kelvin": 0, "saturation": 0.0}, {"brightness": 0.0, "hue": 0.0, "kelvin": 0, "saturation": 0.0}, {"brightness": 0.0, "hue": 0.0, "kelvin": 0, "saturation": 0.0}, {"brightness": 0.0, "hue": 0.0, "kelvin": 0, "saturation": 0.0}, {"brightness": 0.0, "hue": 0.0, "kelvin": 0, "saturation": 0.0}, {"brightness": 0.0, "hue": 0.0, "kelvin": 0, "saturation": 0.0}]

You can work out what messages to send by using photons.

so if you have python3.6 or above, create a virtualenv and do pip install lifx-photons-core in it and then say something like

lifx lan:tile_effect match:cap=matrix flame --debug

The --debug mean it’ll print out the bytes it sends and receives.

Or you could create a script like

from photons_messages import DeviceMessages
import binascii

message = DeviceMessages.SetPower(level=0, source=123, sequence=0, target="d073d5001337")

messages are here

Don’t hesitate to ask more questions!

Thank you delfick
I managed to update python to 3.7 on a pi and get photons up and running
i can see the string it is sending to the tiles
is there a way to select an output format to the string format I mentioned above ??

You could always do something like

python -c 'import binascii, sys; print(";".join(str(i) for i in binascii.unhexlify(sys.argv[1])))' 2a000034b43cf0840000000000000000000000000000010d000000000000000075000000ffffe8030000

appears to have a syntax error that I cannot figure out, but I am a nothing on python

What is erroring? If you paste the error here I can help work out why it complains

C:\WINDOWS\system32>python -c ‘import binascii, sys; print(";".join(str(i) for i in binascii.unhexlify(sys.argv[1])))’ 2a000034b43cf0840000000000000000000000000000010d000000000000000075000000ffffe8030000
File “”, line 1
SyntaxError: EOL while scanning string literal

oh, I see, yeah windows terminal is very annoying.

I suggest putting the command in a file

import binascii
import sys

print(";".join(str(i) for i in binascii.unhexlify(sys.argv[1])))

and then

python3 2a000034b43cf0840000000000000000000000000000010d000000000000000075000000ffffe8030000

Thank you for all the help here :grinning:
called in some help and get a string that looks like what the ISY wants, but the strings dont turn on effects, just turn on last setting code is below, am I missing something ??

import binascii
import sys

strIn = sys.argv[1]
strOut = “”
if(";" in strIn):
data = strIn.split(’;’,-1)
for temp in data:
strTemp2 = hex(int(temp)).split(‘x’)[1]
#print(temp + " " + strTemp2.zfill(2))
strOut+= strTemp2.zfill(2)

print (strOut)

for i in range(0, len(strIn) - 1, 2):
str2Char = strIn[i:i+2]
strOut += str(int(str2Char,16)) + “;”
print (strOut[:-1])