Commit Graph

941 Commits

Author SHA1 Message Date
Eric Callahan df1892801f docs: refactor the "power" configuration docs
Add the "status_delay" option for Home Assistant and refactor to clarify what each option does for each device type.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-15 11:01:03 -05:00
Eric Callahan 1caaebe03f power: implement workaround for Homeassistant devices
Some devices on the Home Assistant server do not update their internal state immediately after a request returns.  Introduce a configurable delay to work around this issue.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-15 10:59:46 -05:00
Eric Callahan c3400bd237 power: add timer support to the RFDevice
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-15 08:11:08 -05:00
Eric Callahan 18c6ff5a99 power: refactor gpio device to use gpio component
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-15 08:11:08 -05:00
Eric Callahan 83901b1896 gpio: helper component for managing system gpios
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-15 08:10:29 -05:00
Eric Callahan dfa11f0f3e utils: add method to load system level modules
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-15 06:41:38 -05:00
Eric Callahan adb88fd8cf authorization: validate user data on startup
This provides corrective action in the event that an
invalid user entry makes its way into the database.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-15 06:00:59 -05:00
Richard Mitchell 389e9c7e62
wled: support for remote neopixel control
Signed-off-by:  Richard Mitchell <richardjm+moonraker@gmail.com>
2021-11-14 07:16:20 -05:00
FrYakaTKoP 79b1c071ad docs: change repository links from meteyou to mainsail-crew
Signed-off-by:  Christoph Frei <fryakatkop@gmail.com>
2021-11-14 06:47:17 -05:00
Pedro Lamas bed239c90a mqtt: implements last will and testament
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2021-11-13 11:00:26 -05:00
Eric Callahan ca27c2cf10 power: change gpiod line request based on version
For gpiod versions 1.3 or greater use the "default_val" keyword argument to set the default, otherwise use
"default_vals".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 9789b3d999 docs: update user changes
Note that core components should now be configured in their own config section.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan a9e865eb54 docs: update documenation with API and configuration changes
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 6d458125a1 power: fix scheduled firmware restarts
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>
2021-11-12 10:11:39 -05:00
Eric Callahan 7f11214609 power: abort a scheduled firmware restart if klipper reports ready
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>
2021-11-12 10:11:39 -05:00
Eric Callahan 739af51904 power: add "on_when_upload_queued" option
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>
2021-11-12 10:11:39 -05:00
Eric Callahan 484c4aea59 eventloop: fix FlexCallback annotation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan ac23f00d1f update_manager: remove initialized lock
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>
2021-11-12 10:11:39 -05:00
Eric Callahan 2d5914b358 moonraker: attempt to resolve "event loop closed" errors on restart
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>
2021-11-12 10:11:39 -05:00
Eric Callahan c718e9d1c3 moonraker: don't use a set to load initial components
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>
2021-11-12 10:11:39 -05:00
Eric Callahan 76731b673b moonraker: refactor klipper initialization
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>
2021-11-12 10:11:39 -05:00
Eric Callahan c2bf9bf551 event_loop: add create_future method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 9854fd36cf power: use component_init for post initialization
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan e6bedd1ffe paneldue: use component_init for post initialization
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 799e763050 mqtt: use component_init for post initalization
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan fd59ace4f8 machine: use component_init for post initialization
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 15d99be9f0 update_manager: use component_init method for post initialzation
Clean up retry functionality to use for loops rather than while loops.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan cbdbe83bbd moonraker: refactor component initialization
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>
2021-11-12 10:11:39 -05:00
Eric Callahan 7a8aeae673 file_manager: use the job queue to start gcode uploads
If a print cannot be started then it will be queued.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan b135f48867 moonraker: add job queue to core components
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 0f1aea8df8 moonraker: refactor component loading
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>
2021-11-12 10:11:39 -05:00
Eric Callahan ec12a187fc job_queue: initial implementation
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>
2021-11-12 10:11:39 -05:00
Eric Callahan 358fe9733f history: implement reset totals endpoint
This allows clients to request that job totals are reset to 0.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 21ee446509 history: use the job_state module to manage job events
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan d0c104aceb job_state: initial implementation
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>
2021-11-12 10:11:39 -05:00
Eric Callahan 53291f6887 power: use the default_vals keyword to init gpios
The "default_val" keyword argument is not available in libgpiod version 1.2.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-11 19:35:34 -05:00
Pedro Lamas a3ba4b4169 power: improves GPIO initial_state handling
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2021-11-11 19:09:06 -05:00
Pedro Lamas 7ff126a56e docs: updates to new Fluidd repo address
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2021-11-07 07:00:12 -05:00
Eric Callahan 4e567d72a9 readme: add links for Docker Images
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-05 15:35:54 -04:00
Eric Callahan 78af774413 readme: add links for Pi images
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-05 15:26:41 -04:00
Eric Callahan 800816055e readme: add a clients header
Also update the link to Fluidd.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-05 15:21:18 -04:00
Eric Callahan 61fab42281 moonraker: log unix socket permission errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-04 11:03:53 -04:00
FrY Sennberg 780279d261 docs: fix typo
Signed-off-by: Christoph Frei <fryakatkop@gmail.com>
2021-11-04 08:40:14 -04:00
Eric Callahan 105858b0c7 machine: fix perfomance regression
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>
2021-11-03 09:10:12 -04:00
Eric Callahan 6a39bbd0c3 mqtt: don't publish status updates when disconnected
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-03 08:49:40 -04:00
FrY Sennberg eec60a760b
git_deploy: report git repository name
Signed-off-by: Christoph Frei <fryakatkop@gmail.com>
2021-11-01 19:10:35 -04:00
Eric Callahan 9f89b03aa3 docs: update /server/info documentation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-01 11:24:31 -04:00
Eric Callahan 86ac019572 moonraker: report software version in server.info
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-01 11:24:31 -04:00
Eric Callahan 4f43cf3a9f shell_command: handle ProcessLookupError when cancelling
This suggests that the process has previously exited.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-01 08:25:28 -04:00
Eric Callahan e71e723f89 confighelper: attempt to clarify unparsed config warnings
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-31 19:17:25 -04:00