DALI cli
March 22, 2026 ยท View on GitHub
Command line interface to control a DALI system.
Important
This application is still in development. Use with caution. Give ample feedback.
DALI is the digital addressable lighting interface as described by the DALI-Alliance.
Usage
To transmit a gear OFF command to the DALI bus you enter the following.
dali --serial-port /dev/ttyUSB0 off
This will transmit the control gear command OFF, using broadcast addressing, via an adapter connected to the serial port. Alternatively, you can use a Lunatone or BEGA adapter.
dali --hid off
Usually, you will operate with a single bus interface. You can use an environment variable to set it once.
export DALI_SERIAL_PORT=/dev/ttyUSB0
dali max
dali min
dali off
Use optional addressing to direct DALI commands to single controllers attached to the bus.
dali dapc 100 --adr G0
Use the --help option to learn more about available commands.
dali --help
Some commands support further parameters. Again, the help option let
you explore the available commands and their usage. Note that most commands for DALI control gears are grouped under the gear command,
while control device commands are grouped under the device command.
dali gear --help
The commands are structured like a tree. For instance the following command queries a control gear's status.
dali gear query status
status: 4 = 0x04 = 00000100b
bit : description
0 : controlGearFailure
0 : lampFailure
1 : lampOn
0 : limitError
0 : fadeRunning
0 : resetState
0 : shortAddress is MASK
0 : powerCycleSeen
Supported Hardware
- Lunatone 241 389 23DO
- Lunatone 241 389 23-30
- BEGA 71024
- Serial based SevenLab Hardware
Tests
This script:
./test_dali_cli.sh
prepares a virtual environment, and then runs the tests. Optionally you can
add --log-level=debug for more detailed logging.
Install from github
git clone https://github.com/SvenHaedrich/dali_cli.git
cd dali_cli
python3 -m venv --prompt dali venv
source venv/bin/activate
python3 -m pip install -e .
HID-USB Support
For the Lunatone USB adapter you need to copy the file 99-lunatone-dali.rules into
the udev folder and reload the udev rules.
sudo cp 99-lunatone-dali.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
By default, this rule uses MODE="0660", which grants read/write access only to root
and members of the appropriate group (for example plugdev). If you really want to
allow all users to access the device, you can change MODE to 0666. You can grant
access to specific user accounts by adding them to the plugdev group. Note that some
Linux distributions always require per-user permission. To grant permission to a user
named <username>:
sudo usermod -a -G plugdev <username>
You will have to log out and then back in for the group change to take effect.