mainsail-crew / mainsail

Mainsail is the popular web interface for managing and controlling 3D printers with Klipper.
https://docs.mainsail.xyz
GNU General Public License v3.0
1.63k stars 341 forks source link

WLED controls in Mainsail #1413

Open iCarl opened 1 year ago

iCarl commented 1 year ago

Requested feature:

Could it possible to have a color picker in a similar fashon to the neopixel support in Mainsail ( #1050 )?

Solves the following problem:

No response

Additional information:

No response

meteyou commented 1 year ago

Thx for your request! I don't think, that it will work fine, because wled is no part of Moonraker or Klipper. It's a third-party software. But I have to double-check it.

rackrick commented 1 year ago

WLED offers an JSON API to controll it. With that it is possible to implement a color picker. The real question is if its a use case for mainsail.

meteyou commented 1 year ago

We actually want to have only one api between Mainsail and Host (Moonraker). So it would be nice if it could connect with Moonraker.

rackrick commented 1 year ago

That's reason I said to question the usecase for mainsail. The moonraker wled api offers just basic control of wled. Which doesn't include the possibility for a colorpicker. The moonraker docs even recommend to use the wled json api for more low level control.

iCarl commented 1 year ago

Ok, thanks

meteyou commented 1 year ago

@rackrick ohhh... i missed this option. maybe i should check the moonraker integration of WLED and check what is possible in the GUI with it.

@iCarl i will reopen this ticket as a reminder to check this component.

rackrick commented 1 year ago

@meteyou hmm... just checked the moonraker repo. there is even an function to set the wled colors set_wled in moonraker. But this function is not exposed as an api endpoint... just as remote method for gcode calls? remote methods for GCODE.

Guess you have a better undstanding of moonraker then i have. May have a look there. If it's possible to expose that method as endpoint. Implmenting the color picker could be quite easy.

meteyou commented 1 year ago

@rackrick mainsail only sends G-Codes for the klipper LEDs. So it would fit, but Moonraker must also manage the current state and update it via Websocket to the clients. This is what I have to check.

rackrick commented 1 year ago

grafik @meteyou moonraker returns just an ok result... not the actuall state of the leds. Thats what you meant right?

meteyou commented 1 year ago

@rackrick thats normal for gcode. you should get a notify back with the new state.

rackrick commented 1 year ago

@meteyou the notify_status_update contains pretty much everything else. but no wled information. If I compare it to the klipper led function. The next status_update contains the colors per channel... etc

meteyou commented 1 year ago

notify_status_update should only send klipper data. so it should be a own notify_xx for WLED. Maybe this is missing right now in Moonraker.

meteyou commented 1 year ago

ahh.. find right now the docs for it: https://moonraker.readthedocs.io/en/latest/web_api/#get-strips. there are own API commands for it.

rackrick commented 1 year ago

there are... but they don't contain any color channel information. which we would need for the colorpicker 😅

meteyou commented 1 year ago

Oh right. Only presets, brightness and on/off

rackrick commented 1 year ago

guess the "problem" is the possibilty of having each led in a different state.

LED 1 -> red
LED 2 -> green
LED 3 -> blue

what do you want to display in the colorpicker then?

moonraker keeps track of the color states in the array _chain_data which could be probably added in the return of the status endpoint.

meteyou commented 1 year ago

This would fit. It's the same as klipper returns for Neopixel. And then we also need an API point to send new color commands. Atm moonraker only supports on/off from presets.

rackrick commented 1 year ago

@rackrick mainsail only sends G-Codes for the klipper LEDs. So it would fit, but Moonraker must also manage the current state and update it via Websocket to the clients. This is what I have to check.

We could use the gcode method for that or would you prefer an extra http endpoint for that?

meteyou commented 1 year ago

Because you get the update states via Moonraker directly, I would also prefer to send the commands via Moonraker with separate API points (Websocket/http).

iCarl commented 11 months ago

Any updates on this request ?

peperonikiller commented 8 months ago

Currently using gcodes to control WLED at the moment. Would love to see my WLED light pop up in the misc bar some day ;)

c-mellueh commented 4 months ago

+1