This implements two queues, one for commands that execute locally and a second
for gcode commands that execute on the Klippy host. While it is valid for a local
command to execute concurrently with a remote command, commands of the same type
(local or remote) should execute sequentially.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Update paneldue.py
Report that the PanelDue is "idle" until it is first initialized. This allows for the Macros to be set upon first connection
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add a "get_return_code" method that allows users to fetch the return code after the shell command has executed.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This implementation adds a delay that allows for pip to function correclty after the venv is built.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The current method for rebuilding the virtualenv fails. A potential workaround is to do the rebuild and subsequent update with a script. For now, disable the rebuild.
Signed-off-by: Eric Callahan <arskine.code@gmail.com>
This manager can perform updates on moonraker and klipper, assuming that the source is located in a valid git repo, the origin points to the official repo, and the currently selected branch is "master".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This makes it possible for clients to hard restart an service in the event it becomes unresponsive.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This method collects the entire response and returns it with the call. Suitable for commands that produce little output.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This allows moonraker plugins to look up the stored info without needing to make an addition "info" request to Klippy.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Do not allow on, off, or status requests without arguments. Pass device objects to "power_device()" rather than device names.
Signed-off-by: Eric Callahan <arkine.code@gmail.com>
Devices are now configured using "prefix" sections. The pin configuration now more closely mimics that of Klipper's configuration so as to reduce confusion.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Only load the plugin for each prefix section once. Plugins themselves will be responsible for parsing the configuration from each prefix section.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Tornado clears the headers when an error is detected, "set_default_headers" must be overrridden so that errors are properly returned.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rather than allow all origins as was the default with "enable_cors", users may not specify the domains allowed. If "*" is specified, all domains are allowed.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
GIven that subscriptions are reset, connected clients no longer maintained and they cannot check "webhooks.state" to see if Klippy is ready. This notifcation may be used to in its place.
SIgned-off-by: Eric Callahan <arksine.code@gmail.com>
Clients may provide arguments either in the query string or body. Reserved arguments "token" and "connection_id" are excluded from the result.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Some requests, such "printer/objects/subscribe", require a websocket
for asynchronous updates. Clients may now specify a "connection_id"
in the form data that identifies an associated websocket.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
There is no need to pass the auth, server, or websocket manager objects to request handlers. They can be retreived directly from the application reference.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This allows clients to "unsubscribe"by sending an empty dict. Each client will receive updates only for subscribed objects.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This class encapsulates all request data received from a client. This simplifies callbacks and makes it easier to add additional parameters to a client request.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This allows regsitered methods to be coroutines. Execution is done on the event loop to prevent a coroutine from blocking the incoming command queue.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This is a better description of the item parsed from _convert_path() is a path relative to the "root" directory.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Previously different parts of the file manager referred to name identifying a "root directory" as either base or root. This could lead to confusion, so all references are now "root".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Since we need to walk through a file list each time one is requested there is no gain from storing lists locally.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Storage is now updated by individual calls to "parse_metadata()" instead of passing a full list. This will allow the manager to
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If extended==True is passed to GET directory then the result for each gcode file will include associate metadata, if present.
SIgned-off-by: Eric Callahan <arksine.code@gmail.com>
Credit to GitHub user cdkeito for creating a template from which this implementation was inspired.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This method provides basic server information, such as loaded plugins and the state of the UDS connection to Klippy.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Now that the file_manager directly handles DELETE file requests, it is not necessary have the HTTP file handler perform any checks. Thus it is no longer required to pass a "can_delete" parameter.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This method is now the primary means of deleting files, as it includes checks to make sure that the delete is allowed.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Websocket APIs are now generated using traditional namespaces, for example "printer.gcode.script" rather than "post_printer_gcode_script". Local endpoints that register multiple requests methods will have the method prefixed (ie:. "server.files.get_directory", "server.files.post_directory", "server.files.delete_directory")
Signed-off-by: Eric Callahan
If the metadata script encoutners an error it will return an empty dict for the "metadata" item. Do not update the metadata storage or send a notification if the dict is empty.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Attempt to reconnect every 250ms when disconnected. Once connected, attempt to initialize every 250ms.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Move logic for managine metadata to its own class. Allow 3 retries if extraction fails, and send a printer event if metadata is updated due to an added file.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Logging to a file has the potential to block a the main thread, a QueueLogger resolves this by forwarding logging request to a secondary thread.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This optimized version should initialize faster as it doesn't rely on an additional Periodic Callback when Klippy is detected as ready.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Like gcode_apis, the klippy_apis module registers Web API aliases for particular gcodes. In addition, this module presents an interface where moonraker can call Klippy APIs directly.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This allows users to specify a "confirmed_macros" that wil pop up a message box requiring confirmation before proceeding. Useful for restart and firmware_restart to prevent accidental execution.
Also do not raise an exception when Klippy disconnects after a restart or firmware_restart.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The make_request() method is now awaitable and returns the result directly vs the previous behavior of returning a request that was awaited.
There is no longer a need to check the result to see if it is an error, exceptions are raised if an error is detected.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is expected that the Klippy will disconnect when a restart request is sent. Handle those exceptions so they return an acknowledgement.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
There "check_available" endpoint no longer exists in Klippy, so use "objects/list" instead. If Klippy is not properly configured Moonraker will log the result.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This reduces the amount of code needed to handle the connection and adds more robust error handling. This also prepares moonraker for the eventual transition of Klippy hosting the server socket.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rather than receive its configuration from Klippy, moonraker will receive its configuration from a config file. By default this file is located at ~/moonraker.conf.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Klippy requests typically only timeout when the connection between Klippy and the Server is disconnected. Rather returning a timeout, send an error if there are any pending requests when a disconnection is detected.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Remove the "primary_config" option from the upload handler, as we no longer allow writes to printer.cfg unless it is located in the config path. We now assume that the config path is the main config, so all files there are located at /server/files/config/*.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
There is no longer a need for Moonraker to check in with Klippy's `moonraker/check_ready` request. It can now simply check in with the "info" request.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This notification is moved from moonraker.py. Instead of sending a filelist, it now updates the file list and sends all relevant information to the client.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Break gcode and config file uploads into their own functions. Add a 'primary_config' argument to config file uploads. If set to true, the upload will overwrite printer.cfg.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This implentation allows for uploads to different local paths by specifying a "root" argument in the form.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This logging may be useful in helping users troubleshoot problems stemming from Klippy based errors.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Sensor information is no longer provided by the response to the "check_ready" remote procedure call. The temperature store now fetches the sensor data itself and sets up the subscription.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>