Commit Graph

1931 Commits

Author SHA1 Message Date
Eric Callahan 5d079d8c26
gpio: migrate from gpiod to python-periphery
The libgpiod library has breaks API compatibility with version 2.
Given that not all distributions ship gpiod and its unique nature
as a system package, replace it with a wrapper that directly
accesses the GPIO character device.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-22 18:19:58 -05:00
wollew 7fc571643d
power: enable HTTP port option for Zigbee/Hue devices
Signed-off-by: Wolfgang Miller-Reichling <wolfgang+github@miller-reichling.de>
2023-12-22 18:19:05 -05:00
Eric Callahan 088d9ee59a
docs: update power documentation
Note that currently only Gen 1 shelly devices are supported.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-22 16:53:52 -05:00
Eric Callahan 90e2ab6fcf
docs: add JSON-RPC over HTTP documentation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-22 16:51:57 -05:00
Eric Callahan aa16dd671b
app: add jsonrpc HTTP endpoint
Add a POST /server/jsonrpc endpoint that processes jsonrpc
requests from the body.  This allows developers familiar with
the JSON-RPC API to use it in places where a websocket is not
desiriable.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:24 -05:00
Eric Callahan 6dbcdf537f
app: improve endpoint registration logging
Only log registration when verbose (debug) logging is enabled.
In addition, log endpoint removal.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:23 -05:00
Eric Callahan 94989b39dc
app: raise an exception on duplicate endpoint registration
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:23 -05:00
Eric Callahan b3b60757aa
authorization: remove "permitted_paths" attribute
Track authentication requirements in the API Definition.  This
eliminates the need to look up the authentication component
to disable auth on an endpoint.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:22 -05:00
Eric Callahan eed759e111
klippy_apis: allow subscription requests from transports
The default behavior of the subscribe API shares all subscription
requests.  API Transports require their own subscription.  Add
a method to facilitate this request.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:22 -05:00
Eric Callahan bfeb096f31
jsonrpc: share one instance among all transports
This change refactors the APIDefiniton into a dataclass, allowing
defs to be shared directly among HTTP and RPC requests.  In
addition, all transports now share one instance of JSONRPC,
removing duplicate registration.  API Defintiions are registered
with the RPC Dispatcher, and it validates the Transport type.
In addition tranports may perform their own validation prior
to request execution.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:21 -05:00
Eric Callahan 8b2d9b26f5
app: streamline endpoint registration
Refactor endpoint registration to reduce duplicated code.
Rename some APIDefinition attributes for clarity.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:21 -05:00
Eric Callahan 7de61eb113
klippy_connection: track connection state with an enum
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:21 -05:00
Eric Callahan b18e9cc222
all: Replace strings with RequestType flags
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:20 -05:00
Eric Callahan 6e8b720d17
job_state: combine events into a single handler
Emit a single event where the first argument contains
a "JobEvent" enumeration that describes the particular
event.  This reduces the number of callbacks registered
by JobState consumers and allows them react to multiple
state changes in the same callback.

The individual events remain for compatibility, however
they are deprecated.  Current modules should be updated
to use the "job_state:state_changed" event and new modules
must use this event.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:20 -05:00
Eric Callahan 7deb9fac4c
common: add RequestType and TransportType flags
These flags replace strings as constants used to register and
identify Request Types (ie: GET, POST) and API Transport
Types.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:19 -05:00
Eric Callahan 42357891a3
docs: add "check_klipper_config_path" documentation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 15:31:35 -05:00
Eric Callahan 3b53d9532d
file_manager: add option to opt out of klipper check
Some installations do not have Klipper's configuration
in the data path's "config" folder.  Provide a way to
opt out of this check.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 15:25:38 -05:00
Eric Callahan 6d8cb762ff
file_manager: relax registration requirements
Use EAFP techniques to test for directory read permission
during registration.  If access fails continue with registration.
This allows users to potentially fix an issue without restarting.
Inotify failures always require a restart to resolve.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-15 10:53:09 -05:00
Eric Callahan 9ad8fed81e
spoolman: register announcement feed
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-02 07:44:40 -05:00
Eric Callahan cf83c9f709
announcements: implement feed registration
Allow internal components to register announcement feeds.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-02 07:42:50 -05:00
Eric Callahan fb15b2a3de
metadata: increase read size to 1 MiB
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-19 17:56:55 -05:00
Eric Callahan be23f206ee
metadata: refactor regex helper methods
Introduce placeholders for the regex capture groups.
This reduces the length of the original pattern and
makes it easy to change the pattern for a return value
if necessary.

This change modifies the float pattern to accept any
float or integer.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-19 17:49:30 -05:00
Eric Callahan dddd968f82
simplyprint: unknown temperature fix
Omit temperature data for SBCs that Moonraker
cannot report.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-15 19:20:46 -05:00
Eric Callahan 7337c6f762
klippy_connection: fix error message from Klipper
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-15 19:20:46 -05:00
Eric Callahan 07388f4d38
simplyprint: add support for gcode acknowledgements
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-15 19:20:45 -05:00
Eric Callahan e3cf9b2aa9
docs: note changes to bound service init
When "initial_state" is configured, bound services will be
initialzed based on that state...stopped if the state is
"off", started if its "on.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-15 18:09:57 -05:00
Eric Callahan 6c6b7dcff0
power: process bound services when initial_state is set
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-15 18:09:56 -05:00
WALDNER Emmanuel 975011d190
metadata : fix extract to work with Ideamaker
Correction of the regex (Replacing the = with one: and adding the filament index for the regex to work).

Signed-off-by: Emmanuel WALDNER emmanuel.waldner@gmail.com
2023-11-07 16:12:58 -05:00
Eric Callahan d9c16380a4
docs: update readthedocs configuration
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-07 15:09:03 -05:00
Eric Callahan 588454ffee
docs: document agent remote method registration
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-07 14:49:19 -05:00
Eric Callahan 27dddd62ac
extensions: support agent method registration
Create a websocket endpoint that allows clients identified as
agents to register remote methods with Klipper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-07 11:27:11 -05:00
docgalaxyblock 2e27b073c9 docs: add Domoticz power device documentation
Signed-off-by: Olivier Berthomme <olivier@berthomme.fr>
2023-11-05 10:54:48 -05:00
docgalaxyblock b63ca44094 docs: updated prebuild images config path note from `~/klipper_config` to `~/printer_data`
MainsailOS loads the moonraker.conf from `~/printer_data/config/`
Source:
[MainsailOS moonraker](https://github.com/mainsail-crew/MainsailOS/tree/develop/src/modules/moonraker/filesystem/home/pi)
[MainsailOS klipper](https://github.com/mainsail-crew/MainsailOS/blob/develop/src/modules/klipper/config#L28)

Signed-off-by: Joshua Schlicker <potter-91@web.de>
2023-11-03 17:53:14 -04:00
Eric Callahan 40011370a3
update_manager: improve Klipper detection
If the Klipper installation is not updatable (ie not a git repo)
abort reinstantion of the deployer.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-11-02 06:19:14 -04:00
Eric Callahan e03dbe3251
app: raise tornado http exceptions in upload handler
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-30 14:56:33 -04:00
Eric Callahan 4f32f477bd
app: improve upload error handling
Use a lock to guarantee thread safety when parsing data.  If
parsing results an error, save the error and raise it.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-29 20:14:03 -04:00
Eric Callahan a71c5c159d
spoolman: filter spool_id before setting it active
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-24 19:32:24 -04:00
Daisuke Sato 17ffb4455e docs: fix typos in docs
Signed-off-by: Daisuke Sato <tiryoh@gmail.com>
2023-10-24 08:17:40 -04:00
Eric Callahan 2641fc54d6
proc_stats: fix vcio ioctl logging spam
Use the low level os.open() method to open the vcio device.  This
resolves "unknown ioctl" spamming of the kernel log.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-13 18:07:03 -04:00
Eric Callahan b8ce199edd
install: fix dbus provider detection
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-11 07:48:24 -04:00
Eric Callahan fd11c08b99
build: update python dependencies
The latest version of several dependencies has deprecated
Python 3.7.  Update Moonraker's requirements so that
the latest version is installed without breaking existing
installations.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-10 18:23:26 -04:00
Eric Callahan b676773602
metadata: update deprecated pillow constant
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-10 18:23:26 -04:00
Eric Callahan 9785387867
docs: update linting guidelines
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-07 10:42:34 -04:00
Eric Callahan 4fe99e6ebb
json_wrapper: fix linter errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-07 10:37:42 -04:00
Eric Callahan d721ec5d9c
update_manager: fix linter errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-07 10:36:49 -04:00
Eric Callahan 6f6f535d6a
file_manager: fix linter errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-07 10:36:16 -04:00
Eric Callahan b4dfa5a4dd
zeroconf: fix linter errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-07 10:35:58 -04:00
Eric Callahan d25ddc954a
wled: fix linter errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-07 10:35:29 -04:00
Eric Callahan 0afbefc962
simplyprint: fix linter errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-07 10:33:56 -04:00
Eric Callahan a28c7c3f93
power: fix linter errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-07 10:33:20 -04:00