Skip to content

Control 3D printers RGB LED's via Octoprint MQTT Events

Notifications You must be signed in to change notification settings

mroote/Octoprint-LED-Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Octoprint-LED-Control

Control WS2812 LED's via Octoprint MQTT Events

Using the MQTT plugin for Octoprint this script will respond to event messages and change attached LED's using the desired animation.

Useful for lighting the build surface and reacting to print events such as heating or print completed.

Dependencies

External Dependencies

  • MQTT Broker running, either on the Octopi server or elsewhere.
  • MQTT Plugin installed through OctoPrint and configured to connect to the MQTT broker.

Setup

  1. Use git to clone the script, I use the ~/.octoprint/scripts directory in the octopi user's home dir.
  2. Change any configuration options in the led_control.py file to reflect your LED strip.
  3. Add systemd service file to /etc/systemd/user/
  4. Enable systemd service with systemctl enable --user led_control.service
  5. Start service with systemctl start led_control.service

Usage

The script can be run with two modes, daemon and single run. Single run is useful for testing animations while daemon mode will listen to thq MQTT bus and respond to messages.

To run a single run animation:

$ ./led_control.py --animation color_wipe --color 255 255 255

To launch the daemon mode:

$ ./led_control.py --daemon

Help text is available with all options for each mode with the --help flag.

$ ./led_control.py --help
usage: led_control.py [-h] [--daemon [DAEMON]] [--host HOST] [--port PORT]
                      [--user USER] [-p PASSWORD]
                      [--animation {rainbow_cycle,rainbow,theater_chase_rainbow,theaterchase,color_wipe,bounce}]
                      [--color RGB RGB RGB] [--color2 RGB RGB RGB]
                      [--wait-ms WAIT_MS] [--interval INTERVAL]

optional arguments:
  -h, --help            show this help message and exit
  --daemon [DAEMON]     Start LED Control Daemon.
  --host HOST           Hostname or IP Address for MQTT broker.
  --port PORT           Port for MQTT broker.
  --user USER           User for MQTT broker.
  -p PASSWORD, --password PASSWORD
                        Password for MQTT broker.
  --animation {rainbow_cycle,rainbow,theater_chase_rainbow,theaterchase,color_wipe,bounce}
                        Run a single animation and exit.
  --color RGB RGB RGB
  --color2 RGB RGB RGB
  --wait-ms WAIT_MS
  --interval INTERVAL

About

Control 3D printers RGB LED's via Octoprint MQTT Events

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages