mirror of https://github.com/Desuuuu/klipper.git
docs: Document "register_remote_method" endpoint
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
8a5e7d8d28
commit
fc0a18f891
|
@ -146,6 +146,36 @@ transition to a "shutdown" state. It behaves similarly to the G-Code
|
||||||
`M112` command. For example:
|
`M112` command. For example:
|
||||||
`{"id": 123, "method": "emergency_stop"}`
|
`{"id": 123, "method": "emergency_stop"}`
|
||||||
|
|
||||||
|
### register_remote_method
|
||||||
|
|
||||||
|
This endpoint allows clients to register methods that can be called
|
||||||
|
from klipper. It will return an empty object upon success.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
`{"id": 123, "method": "register_remote_method",
|
||||||
|
"params": {"response_template": {"action": "run_paneldue_beep"},
|
||||||
|
"remote_method": "paneldue_beep"}}`
|
||||||
|
will return:
|
||||||
|
`{"id": 123, "result": {}}`
|
||||||
|
|
||||||
|
The remote method `paneldue_beep` may now be called from Klipper. Note
|
||||||
|
that if the method takes parameters they should be provided as keyword
|
||||||
|
arguments. Below is an example of how it may called from a gcode_macro:
|
||||||
|
```
|
||||||
|
[gcode_macro PANELDUE_BEEP]
|
||||||
|
default_parameter_FREQUENCY: 300
|
||||||
|
default_parameter_DURATION: 1.
|
||||||
|
gcode:
|
||||||
|
{action_call_remote_method("paneldue_beep",
|
||||||
|
frequency=FREQUENCY|int,
|
||||||
|
duration=DURATION|float)}
|
||||||
|
```
|
||||||
|
|
||||||
|
When the PANELDUE_BEEP gcode macro is executed, Klipper would send something
|
||||||
|
like the following over the socket:
|
||||||
|
`{"action": "run_paneldue_beep",
|
||||||
|
"params": {"frequency": 300, "duration": 1.0}}
|
||||||
|
|
||||||
### objects/list
|
### objects/list
|
||||||
|
|
||||||
This endpoint queries the list of available printer "objects" that one
|
This endpoint queries the list of available printer "objects" that one
|
||||||
|
|
|
@ -305,6 +305,10 @@ Available "action" commands:
|
||||||
- `action_emergency_stop(msg)`: Transition the printer to a shutdown
|
- `action_emergency_stop(msg)`: Transition the printer to a shutdown
|
||||||
state. The `msg` parameter is optional, it may be useful to describe
|
state. The `msg` parameter is optional, it may be useful to describe
|
||||||
the reason for the shutdown.
|
the reason for the shutdown.
|
||||||
|
- `action_call_remote_method(method_name)`: Calls a method registered
|
||||||
|
by a remote client. If the method takes parameters they should
|
||||||
|
be provided via keyword arguments, ie:
|
||||||
|
`action_call_remote_method("print_stuff", my_arg="hello_world")`
|
||||||
|
|
||||||
### Variables
|
### Variables
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue