Skip to content

(2) The CLI (Command line Interface)

Zach Glenwright edited this page Dec 23, 2021 · 2 revisions

Prerequisites needed for the CLI: Bleak

NeewerLite-Python has a command-line interface that allows communication with Neewer lights without needing to use the normal GUI, which simplifies some installations. If you're using a more bare-bones setup (like a Raspberry Pi with only a command-line interface which can't use GUI-based programs), you can install Bleak, forego installing the PySide2 package and still use NeewerLite-Python to control lights from the command line.

Using the CLI, you can send one command to one light at a time (at the moment) - to use the CLI version of NeewerLite-Python, use the --cli parameter when you launch the program. For a simple example:

python3 ./NeewerLite-Python.py --cli

Other parameters available for CLI mode:

--list - Runs a scan for Neewer lights in the area accessible to the program, and prints a list of the lights and their associated MAC addresses (or GUIDs in MacOS)

--silent - start NeewerLite-Python in "quiet" mode, which prints fewer debug messages to the console

--on / --off - turn the light on or off - please note, if you accidentally put both parameters on the CLI, ON will be triggered

--light= - the MAC address of the light you want to control - please note, if you don't specify a light, NeewerLite-Python will still calculate a bytestring, but not send any data to a light

--mode= - the mode parameter specifies which mode to use (possible options are CCT, HSI, ANM or SCENE) - please note, if you specify a mode, but no parameters, NeewerLite-Python will use the mode defaults, listed below (*)

CCT mode-specific parameters:

--temp= or --temperature= - the color temperature to set the current light to (from 3200K-8500K, if your light supports the higher temperatures)

--bri= or --brightness= or --intensity= - how bright to set the light (from 0-100%)

HSI mode-specific parameters:

--hue= - the color hue to set the light to (from 0-360º)

--sat= or --saturation= - the saturation (color intensity) to set the light to (from 0-100%)

--bri= or --brightness= or --intensity= - how bright to set the light (from 0-100%)

ANM/SCENE mode-specific parameters:

--scene= or --animation= - Which animation to use (from 1-9)

--bri= or --brightness= or --intensity= - how bright to set the light (from 0-100%)

Examples:

python3 ./NeewerLite-Python.py --cli --light=11:22:33:44:55:66 --mode=cct --temp=5200 --bri=50 - set light 11:22:33:44:55:66 to CCT mode, with a color temperature of 5200K, and set the brightness to 50%

python3 ./NeewerLite-Python.py --cli --light=11:22:33:44:55:66 --mode=hsi --hue=240 --sat=100 --brightness=100 - set light 11:22:33:44:55:66 to HSI mode, with the hue set to 240º (blue), with saturation and brightness set to 100%

python3 ./NeewerLite-Python.py --cli --light=11:22:33:44:55:66 --mode=hsi -- set light 11:22:33:44:55:66 to HSI mode, with the default HSI parameters (listed below)

* - Default mode parameters (if only the mode parameter is used, or one of the values are left out):

CCT mode - Default color temperature: 5600K / Default brightness: 100%

HSI mode - Default hue: 240º / Default saturation: 100% / Default brightness: 100%

ANM or SCENE mode - Default animation : 1 (Police Sirens) / Default brightness: 100%

Clone this wiki locally