cp2004 / OctoPrint-WS281x_LED_Status

Add some RGB LEDs to your printer for a quick status update!
https://plugins.octoprint.org/plugins/ws281x_led_status
GNU Affero General Public License v3.0
111 stars 26 forks source link

Documentation improvement - API commands #140

Closed TDI4 closed 3 years ago

TDI4 commented 3 years ago

Is your feature request related to a problem? Please describe. I liked to implement my printer in my home automation deeper than Octoprint binding in Openhab, so i started to work on power on/off the PSU with MQTT, switch lights with MQTT and so on. With the "PSU Control" plugin and it's documentation it worked flawlessly, but with this plugin I had to dig much deeper. Your github wiki is pretty fine, but the commands tab (at least for me) did not helped a lot. https://cp2004.gitbook.io/ws281x-led-status/v/0.7.x/documentation/host-commands

response: { "status" : 400, "response" : Expected valid command "data" : {"command":"WS_LIGHTSON"} }

Describe the solution you'd like Finally I found the solution in your code itself (octoprint_ws281x_led_status/api.py) where you define for example "CMD_LIGHTS_ON = "lights_on" insted of "@WS_LIGHTSON" what's in the documentation. Since I modded it in my "MQTT Subscribe" plugin it works.

response: { "status" : 200, "response" : {"lights_on":true,"torch_on":false} "data" : {"command":"lights_on"} }

Why should this be implemented? To prevent others spending half a day finding where's the problem in the command.

Additional context

With this setup it works. Thank you in advance for your effort, and by the way, the plugin is pretty awesome, instead of using Marlin's built-in feature :) 2021-05-08_21h01_57

github-actions[bot] commented 3 years ago

Hi @TDI4,

It looks like there is some information missing from this issue that is required to process it:

Please read this guide, especially the troubleshooting section.

If you have read this guide, please tick the box in your issue next to 'I have read the Get Help Guide'

* [x] I have read the Get Help Guide

If you didn't mean to ask for help, please make sure you used the right template - bugs and requests should have [Bug] and [Request] respectively in the title.

I'm just a bot 🤖, not a human being, so don't expect any replies from me :) Your ticket is read by humans too, I'm just not one of them.

cp2004 commented 3 years ago

This is the page you want:

https://cp2004.gitbook.io/ws281x-led-status/documentation/rest-api

The commands you found, are host @ commands. These can be added to gcode scripts or other plugins that execute gcode commands. They aren't API commands.

TDI4 commented 3 years ago

I've seen that page, but you mention "see blow" but the API commands are missing, and not equal to the host @ commands. That's why I say it's confusing, and if you add that 5 commands to the documentation, you could save time for someone else who would like to use it. 2021-05-08_23h19_43

cp2004 commented 3 years ago

Hmm, below that used to be a table there that documented all the options. I wonder where it went. Will check and fix ASAP - it should have been there, but I wasn't aware it had gone missing. Now to hunt down a missing table on the internet.

cp2004 commented 3 years ago

https://github.com/cp2004/OctoPrint-WS281x_LED_Status/commit/ab6cd3e94f841f754302cb880fe508b2c89318ca#diff-b321f270a4612b13844ce604e3bbdcf9f3cdfc5dafdef03c2832aafbe07014eeL93-L106

^ See proof! I'm not going mad...

cp2004 commented 3 years ago

Apologies for the inconvenience there, it is back at https://cp2004.gitbook.io/ws281x-led-status/documentation/rest-api#commands

TDI4 commented 3 years ago

Thank you for the fast response :) Now it looks (again), how it shoud be. Perfect!