Commit Graph

348 Commits

Author SHA1 Message Date
Arksine 116c1e9f29 shell_command: add run_with_response() method
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>
2020-11-23 06:22:56 -05:00
Arksine 706d86dd21 file_manager: update paths in "ready" event handler
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-23 06:22:56 -05:00
Arksine df81854f89 moonraker: Store info received from initial "info" request to klippy
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>
2020-11-23 06:22:56 -05:00
Arksine b0469da462 moonraker: add software version to system_args
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-23 06:22:56 -05:00
Arksine 2e9c6de5d0 moonraker: refactor references to cmd_line_args
They are now named "system_args", as they represent system wide arguments.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-23 06:22:56 -05:00
Arksine f96fb997da docs: document API for retreiving Klipper "docs"
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-23 06:22:45 -05:00
Arksine b0f781ec16 file_manager: serve Klipper's "docs" directory
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-23 06:17:23 -05:00
Matthias Neumayr 93fd850b63 Added Tasmota SetOption26 to power/Tasmota setup description
Signed-off-by: Matthias Neumayr <matt.neumayr@gmail.com>
2020-11-21 13:59:29 -05:00
Matthias Neumayr a2327a093b Fixed error when reading Tasmota status response
Signed-off-by: Matthias Neumayr <matt.neumayr@gmail.com>
2020-11-21 13:59:29 -05:00
Matthias Neumayr 4415a3c858 Updated documentation with Tasmota power configuration settings and sample
Signed-off-by: Matthias Neumayr <matt.neumayr@gmail.com>
2020-11-21 13:59:29 -05:00
Matthias Neumayr 6ba54d9cb1 Added Tasmota power plugin
Signed-off-by: Matthias Neumayr <matt.neumayr@gmail.com>
2020-11-21 13:59:29 -05:00
Arksine 8d3e185894 docs: fix typo in user_changes.md
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-20 14:36:13 -05:00
Arksine 01a48e530f docs: update documentation for changes to "power" plugin
The power APIs were never properly documented, so this adds them to web_api.md.  In addition, a new "user_changes.md" document has been added to help users transition to the new plugin.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-19 15:43:24 -05:00
Arksine 675fe750f6 test client: log objects received via the "power changed" notification
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-19 08:42:55 -05:00
Arksine 8ead49504b power: add support for tplink smartplug (Kasa) devices
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-19 08:32:37 -05:00
Arksine 47c7cea5a5 power: add initial support for device types
This changes the API endpoints from "/machine/gpio_power" to "/machine/device_power".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-19 08:32:37 -05:00
Arksine f6fa093369 power: refactor power requests
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>
2020-11-19 08:32:37 -05:00
Arksine 6738aa8c68 power: Use libgpiod instead of sysfs for gpio management
This resolves issues inherent with sysfs gpio management.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-19 08:32:37 -05:00
Arksine 48266e0bd6 power: rework configuration
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>
2020-11-17 15:39:13 -05:00
Arksine 1975b875a5 confighelper: Add helper methods
Add "get_name()" and "get_prefix_section" methods

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-17 15:39:13 -05:00
Arksine 0a7b580799 moonraker: handle "prefix" section during inital load
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>
2020-11-17 15:39:13 -05:00
Arksine d18fc889d5 docs: update installation.md with install script's command line options
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-17 15:39:13 -05:00
Arksine a5e8c290ef scripts: update tornado version in requirements file
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-17 15:39:13 -05:00
Arksine 8b5ed3c9da scripts: update install script
Add python3-libgpiod dependency.

As this dependency requiress a rebuild of the python3 environment, add some command line options to the install script:
- "-r" will rebuild the virtualenv
- "-f" will force overwite the defaults file.  By default an existing defaults file will not be modified.
- "-c <config_path>" will direct moonraker to use the supplied path for the config file.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-17 15:39:13 -05:00
Arksine de34fee72a machine: register "reboot_machine" and "shutdown_machine" remote methods
This allows Klippy to command moonraker to reboot or shutdown the host machine.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-17 12:21:16 -05:00
Arksine 346fce177f app: close server connections when closing app
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-17 06:53:05 -05:00
Arksine 7ca910ec46 authorization: add additional CORS logging
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-17 06:52:47 -05:00
Arksine 5081810a96 file_manager: normalize the path for the metadata script
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-16 19:55:37 -05:00
Arksine ac1d798a36 authorization: Add wildcards to cors_domians option
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-11-16 07:13:30 -05:00
Arksine 2d2f8bfbcd authorization: fix issue cors issue when an error is detected
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>
2020-11-14 17:59:08 -05:00
Arksine 7414781b3a docs: update config documentation
The `enable_cors` option has been removed from the [server] config.  CORS is now configured in [authorization] via the `cors_domains` option.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-13 08:57:10 -05:00
Arksine ea62bc9ed1 app: change `enable_cors` option to `cors_domains`
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>
2020-11-13 07:27:17 -05:00
Arksine 2cfc5b9501 docs: update metadata documentation
Document the "gcode_start_byte" and "gcode_end_byte" fields.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-13 06:53:20 -05:00
Arksine 222dda50bc extract_metadata: parse "gcode_start_byte" and "gcode_end_byte"
Determine the byte location of the first and last gcode command (Either Mxxx or Gxxx commands).  This is useful for determining the portion of the file that consists of actual commands.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-13 06:45:21 -05:00
Arksine b021d10de5 klippy_apis: add quotes around filename in call to SDCARD_PRINT_FILE
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-13 06:03:19 -05:00
Arksine 6763ea6197 file_manager: correct issue with directories that contain spaces
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-13 05:25:37 -05:00
Arksine 697be6a822 file_manager: Immedately fetch metadata for file uploads
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-12 17:27:52 -05:00
Arksine a1de70ff89 docs: document "notify_klippy_ready" websocket notfication
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-11 17:59:08 -05:00
Arksine 6254586a65 test_client: support additional notifications
Add support for "notify_klippy_ready" and "notify_power_changed".

SIgned-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-11 17:53:58 -05:00
Arksine 3d827d7513 websockets: Add "notify_klippy_ready" notification
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>
2020-11-11 17:53:58 -05:00
Arksine 4b2f3a6f5f docs: update API documentation
Document the new server.websocket.id method and update the documentation for the subscription APIs.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-11 11:58:28 -05:00
Arksine 2ba41701e1 test_client: Add connection ID to http requests if available
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-11 08:32:06 -05:00
Arksine 07c307f4ea moonraker: Only return subscribed items in response to "objects/subscribe"
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-11 08:32:06 -05:00
Arksine daa93b0a2f app: include all arguments in parsers
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>
2020-11-11 05:37:20 -05:00
Arksine 5836d60d88 app: allow http requests to specifiy a websocket id
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>
2020-11-11 04:46:21 -05:00
Arksine 92d1715d88 app: Simplify request handlers
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>
2020-11-11 04:46:21 -05:00
Arksine 7abc86847e websockets: register `server.websocket.id` remote method
This allows clients to request the unique ID associated with each connected websocket.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-11 04:46:21 -05:00
Arksine a6913a982a moonraker: manage subscriptions independently for each connection
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>
2020-11-11 04:46:21 -05:00
Arksine 8d1239c316 websockets: pass connection to WebRequest
This gives handlers direct access to a websocket client connection.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-11 04:46:21 -05:00
Arksine de1575f757 power: update request handlers to accept WebRequest objects
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-11 04:46:21 -05:00