petrklus / lifx-simple

Controlling LiFX bulbs using command line. Pure Python 2.7
MIT License
39 stars 5 forks source link

MultiZone Support #6

Open frakman1 opened 7 years ago

frakman1 commented 7 years ago

Is there any chance you could add support for the new LIFX light strip's multi-zone capability?

The protocol documentation is here The product link is here

Thank you for writing this awesome LIFX library!

petrklus commented 7 years ago

I have pre-ordered the product as soon as it came out but still waiting to receive it. Do you have it already? Planning to implement as soon as I get my hands on the product!

frakman1 commented 7 years ago

Yes. I have two starter kits and would love to help you test it if you want.

petrklus commented 7 years ago

@frakman1 see my latest commit - have a play! At the moment command-line support only, no webservice yet

frakman1 commented 7 years ago

I just checked it out. I tried the demo mode with just one parameter (IP address) Looks great! I'm not sure how to use the full command line options. In particular, how the start and end index are supposed to work. Can you provide some example calls or some more information, please? I can make the whole strip change colour but I don't know what parameters to change to change different segments to different colours.

For example, I would expect the call to:

python set_colour_multizone.py 192.168.2.182 0 125 20 100 100 3500 1

to change the first half of the strip (0 to 125) to colour red (hue=20) etc etc. However, what happens instead, is that the whole strip turns red. What am I missing?

I also don't understand the use of the "tools.NO_APPLY/APPLY_ONLY" parameter. Why would you set the parameters but not apply them?

frakman1 commented 7 years ago

mousex

I played around with it this weekend and made a simple change so that the mouse now controls it.

X position of mouse selects the segment and moves it. Y position of mouse changes the hue of that segment.

petrklus commented 7 years ago

Hello @frakman1 , thank you for your interest!

  1. I have not tested the command line interface yet but the order of parameters should be following:

start_index, end_index, hue, sat, bri, kel, apply_changes

For the LIFX Z, assuming you've plugged in 2 of the segments (normal starter pack), you've got 16 total zones. I do not think there is a device yet that would support any more, I suppose they are future proofing.

  1. There are three types of packet - setting a colour (APPLY), only putting colour in a queue (NO_APPLY) and "submit" packet (APPLY_ONLY). The idea is that you can prepare colour change with multiple NO_APPLY packets and then either submit the change with one that would contain APPLY or noop packet with APPLY_ONLY. The reason for existence of APPLY_ONLY is that sometimes it's cleaner to separate the colour setting and "commit" but in theory there is no functional difference between this and sending last packet with both colour change and APPLY param.