Setting a selector.

Now we have setup the API key to authenticate the program when asking LIFX to do certain things, we can now make it so that when we run tasks like lifxAPI.SelectedLightsOn(), it will only do it for the selected selector. We have also made this super simple to set and change in your program, so you can even tell your program to switch selectors mid program.

  • To do this, all we need to run is lifxAPI.setSelector("My-New-Selector"), again replacing "My-New-Selector"with your actual selector. If your not sure what your selector name should be, refer to this page by LIFX. Once you have entered your selector, run the program. And woosh, like before, it will update and save your selector. Now we can use functions like lifxAPI.SelectedLightsOff()to only turn off your room, meaning less getting shouted at by any other person in your house because you sent them into darkness.

Tip: You can use this mid program to change your selector, which means your program can handle multiple rooms!

results matching ""

    No results matching ""