11chrisadams11 / klipper-ws281x_led_status Goto Github PK
View Code? Open in Web Editor NEWUse WS281x LED strips with Klipper
Use WS281x LED strips with Klipper
moonraker: v0.7.1-876-g87dba2f
Klipper-WS281x_LED_Status: master, 715991aed1a3cbdbbc4c8926028d11e644ad51f8
I ran the klipper_ledstrip.py
from the command line. It exits with this traceback:
Traceback (most recent call last):
File "/home/pi/Klipper-WS281x_LED_Status/./klipper_ledstrip.py", line 167, in <module>
run()
File "/home/pi/Klipper-WS281x_LED_Status/./klipper_ledstrip.py", line 110, in run
if moonraker_api.power_status(moonraker_settings) == 'on':
File "/home/pi/Klipper-WS281x_LED_Status/moonraker_api.py", line 28, in power_status
return json.loads(ret.text)['result']['devices'][0]['status']
KeyError: 'result'
Navigating to http://<printer_ip>:7125/machine/device_power/devices
gives me a 404 (in json format, thanks, moonraker). That api call looks correct from the docs. Other api calls work (like http://<printer_ip>:7125/printer/objects/query?heater_bed&extruder&display_status
).
I don't have any power control in my klipper config. I think that may be the reason I am getting different results?
Let me know if I can provide any other info.
I made these changes to get it running here:
diff --git a/klipper_ledstrip.py b/klipper_ledstrip.py
index a8d90fc..8ee21f6 100755
--- a/klipper_ledstrip.py
+++ b/klipper_ledstrip.py
@@ -107,7 +107,7 @@ def run():
if printer_state_ == 'complete':
base_temps = []
- if moonraker_api.power_status(moonraker_settings) == 'on':
+ if completion_settings['shutdown_when_complete'] and moonraker_api.power_status(moonraker_settings) == 'on':
shutdown_counter += 1
if completion_settings['shutdown_when_complete'] and shutdown_counter > 9:
shutdown_counter = 0
And in the config:
diff --git a/settings.conf b/settings.conf
index 82b68cd..cf3abe5 100644
--- a/settings.conf
+++ b/settings.conf
@@ -9,7 +9,7 @@ strip_settings:
idle_timeout : 300 # Time in seconds before LEDs turn off when on same state
completion_settings:
- shutdown_when_complete : True
+ shutdown_when_complete : False
bed_temp_for_shutdown : 50
hotend_temp_for_shutdown: 40
Either the moonraker_api.py should be catching and handling the exception, or that api shouldn't be called at all if shutdown_if_complete
is false. I understand why you might have added that feature here. But it honestly doesn't fit in with LED control. It might be better to just separate it into a separate project (I sure wish moonraker had a plugin system like octoprint to manage this kind of thing for me, but that is off-topic).
Thanks for all the work. I just got it running 5 mins ago, and I am happy to see it lighting up again after being off since I installed moonraker. I haven't set up the service yet, just running the command through ssh right now.
hello, can you please tell me how to use it with a sk6812 strip. thank you
Hi
Firstly, thanks for putting this together, it is REALLY appreciated!
Minor, very minor, typo in your instructions I thought I'd let you know about. You have "chmod 744 ./klipper-ledstrip.py" but it should be "chmod 744 ./klipper_ledstrip.py"
Edit: Had asked a couple of questions as well but then found the Reddit thread so moved questions to there as it seemed a better place to ask.
First of all Thank you! You made it possible to use NeoPixel with Klipper, that’s awesome.
I’m not quite sure if I’m getting this right.
My LEDs are on Pin 10.
When starting the script all LEDs are white. Starting the print job they stay white.
Every 5 minutes or so they change to the expected behavior an showing a green progress bar for about 2 seconds and then changing back to full white.
also when using the macros, the selected mode just stays for 1 or 2 seconds and then it changes to all white again.
Stopping the script and just use the macros, ON, WHITE and PURPLE are working, as well as useing the values in bash.
what am I missing?
Thanks for sour help.
I´m abaut to install LED Status on klipper, i reached git clone [email protected]:11chrisadams11/Klipper-WS281x_LED_Status.git
Cloning into 'Klipper-WS281x_LED_Status'...
I get this error.
The authenticity of host 'github.com (140.82.121.3)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,140.82.121.3' (ECDSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I cannot see the file on your resposity on Git.
BR Tom
Script isnt working ... it only shows
with open('settings.conf', 'r') as settings_file: FileNotFoundError: [Errno 2] No such file or directory: 'settings.conf'
or
with open('settings_sample.conf', 'r') as sample_settings_file: FileNotFoundError: [Errno 2] No such file or directory: 'settings_sample.conf'
All files stored in Klipper-WS28x_LED_Status
Direction for use correction. You cant cd in a .git
Clone code to Raspberry Pi running Klipper and Moonraker cd /home/pi git clone https://github.com/11chrisadams11/Klipper-WS281x_LED_Status.git cd Klipper-WS281x_LED_Status.git
Hello, could you please write a program that supports Orange PI 3 LTS?
https://github.com/orangepi-xunlong
thank you~
So I just got this installed and everything went off without a issue. But now my Led strap constantly turn off, flash white, off, back to the predefined setting, i.e. Idle colors, off, full white, off, idle color. I saw a reddit post from 2 years ago saying this issue was solved in an update.
I also copied the scripts to be able to use macros to turn off the leds, make them white, or make them purple. When running the command, the console returns 'Error running command ...'
I'm at a loss of what to try. I've rebooted, ensured the service is setup correctly, verified config files. Any tips or suggestions?
When attempting to restart the service, I get the following errors. When I run the klipper_ledstrip.py
command, the LED strip response as expected.
`pi@sv01-mainsailos:/Klipper-WS281x_LED_Status $ sudo /etc/init.d/ledstrip status/Klipper-WS281x_LED_Status $ sudo service ledstrip status
/etc/init.d/ledstrip: 1: /etc/init.d/ledstrip: [Unit]: not found
/etc/init.d/ledstrip: 2: /etc/init.d/ledstrip: Python: not found
/etc/init.d/ledstrip: 5: /etc/init.d/ledstrip: [Service]: not found
/etc/init.d/ledstrip: 15: /etc/init.d/ledstrip: [Install]: not found
pi@sv01-mainsailos:
● ledstrip.service
Loaded: loaded (/etc/init.d/ledstrip; generated)
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)
pi@sv01-mainsailos:/Klipper-WS281x_LED_Status $ sudo service ledstrip stop/Klipper-WS281x_LED_Status $ sudo service ledstrip start
pi@sv01-mainsailos:
Job for ledstrip.service failed because the control process exited with error code.
See "systemctl status ledstrip.service" and "journalctl -xe" for details.
pi@sv01-mainsailos:~/Klipper-WS281x_LED_Status $ systemctl status ledstrip.service
● ledstrip.service
Loaded: loaded (/etc/init.d/ledstrip; generated)
Active: failed (Result: exit-code) since Sun 2022-08-28 11:30:40 PDT; 7s ago
Docs: man:systemd-sysv-generator(8)
Process: 28112 ExecStart=/etc/init.d/ledstrip start (code=exited, status=203/EXEC)
-- Subject: A start job for unit ledstrip.service has begun execution-- The job identifier is 2008 and the job result is failed.
`
-- ledstrip.service --
`cat /etc/init.d/ledstrip
[Unit]
Description=Simplified Python Klipper LED Strip Service
After=syslog.target
[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/home/pi/Klipper-WS281x_LED_Status/
ExecStart=/home/pi/Klipper-WS281x_LED_Status/klipper_ledstrip.py
StandardOutput=syslog
StandardError=syslog
KillSignal=SIGINT
[Install]
WantedBy=multi-user.target
`
Hi,
thank you for developing this, really great and works like a charm!
But I have a bit of issues in starting the script before a print.
My idea was to start the script via a GCode shell command which I add to the start code of the slicer.
Here a snip form my printer.cfg:
[gcode_shell_command led_off]
command: sudo /home/pi/klipper_ledstrip.py 0 0 0
timeout: 2.
verbose: True
[gcode_shell_command led_white]
command: sudo /home/pi/klipper_ledstrip.py 255 255 255
timeout: 2.
verbose: True
[gcode_shell_command status_led]
command: sudo /home/pi/klipper_ledstrip.py
timeout: 2.
verbose: True
[gcode_macro LED_OFF]
gcode:
RUN_SHELL_COMMAND CMD=led_off
[gcode_macro LED_WHITE]
gcode:
RUN_SHELL_COMMAND CMD=led_white
[gcode_macro STATUS_LED]
gcode:
RUN_SHELL_COMMAND CMD=status_led
You note that I had to add sudo, which is per se not allowed for gcode shell command, but nevertheless LED_OFF and LED_WHITE is working with this setup.
As soon as I run STATUS_LED the script gets loaded and led's are displaying standby but immediately Klipper shuts down with
Errno 1 Operation not permitted
19:23:49
// Klipper state: Shutdown
19:23:49
!! Internal error on command:"RUN_SHELL_COMMAND"
19:23:49
!! Internal error on command:"STATUS_LED"
Surely I am doing something wrong but like to understand what that would be and how to recify.
If I start the script via ssh everything runs fine using same command.
Sorry to misuse this; this is most probably not an issue with the script but with me not understanding what's actually going on....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.