Determine if a firmware restart should be postponed by checking Klippy's state. This should correctly schedule the restart regardless of whether or not the device is bound to Klipper.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This handles a specific scenario where a power device is bound to the Klipper service and is configured to perform a firmware restart after power on. In this case, we can detect if the firmware restart is required and abort it if necessary.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
When this option is set to "True", the device will power on after the file manager queues an upload for printing.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Now that init occurs before the server starts there is no need to block requests until post initialization.
Signed-off-buy: Eric Callahan <arksine.code@gmail.com>
Occasionally a server restart will fail as the new loop instantiates as closed. This seems to be an issue with asyncio, attempt to work around by retyring to create a new loop.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Previously a set was used to remove duplicate components, however this is unnecessary as the `load_component` method immediately returns dups. Using a list should preserve the load order based on the configuration, making it more predictable.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The `send_event()` method now returns a future that can be awaited until all callbacks are complete. All events emitted during Klipper init are now awaited, and a Lock is used to prevent re-entry. This resolves potential timing issues with commands sent during the init sequence.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Components may call a "component_init" method for initialization that requires async calls. This allows moonraker to track init progress and guarantee init order.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Remove the "load_component_multi" method as it is not
necessary. Components are responsible for loading
"child" sections as required. Core components can
now have their own config section.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add support for holding multiple printer jobs in a queue.
When a job successfully completes Moonraker will load
the next job in the queue.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This module adds a helper to track Klippy's "print_stats" module. It
stores the current stats and emits events for changes in job state.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The `update_service_status()` method could result in the creation of multiple subprocesses for each update, resulting in a performance hit as subprocesses are inherently expensive.
Fetch the state for all detected services in a single subprocess.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Log all import errors other than ModuleNotFound errors. Add a server warning if a gpio type is configured and the gpiod module is not loaded.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This resolves an issue where a path is containter two slashes as a separator reports as outside of the root.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Most containers do not have access to systemd, so using
systemd-detect-virt will fail. We can check the cgroup
and sched files of the first process to reliably determine
if Moonraker is running within a container.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It isn't valid to run some commands from within containers. Use systmd-detect-virt to detect a virtualized environment and report the type and id via the system_info endpoint.
If Moonraker is running from within a container do not allow access to the reboot and shutdown endpoints.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>