docs: Added section for spoolman

Signed-off-by: Daniel Hultgren <daniel.cf.hultgren@gmail.com>
This commit is contained in:
Donkie 2023-06-26 20:19:05 +02:00 committed by Eric Callahan
parent 4b9c836743
commit e6b3b8ba48
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
3 changed files with 158 additions and 0 deletions

View File

@ -15,6 +15,8 @@ The format is based on [Keep a Changelog].
- **metadata**: Added support for OrcaSlicer
- **zeroconf**: Added support for a configurable mDNS hostname.
- **zeroconf**: Added support for UPnP/SSDP Discovery.
- **spoolman**: Added integration to the
[Spoolman](https://github.com/Donkie/Spoolman) filament manager.
### Fixed

View File

@ -2609,6 +2609,22 @@ state_response_template:
{set_result("energy", notification["aenergy"]["by_minute"][0]|float * 0.000001)}
```
### `[spoolman]`
Enables integration with the [Spoolman](https://github.com/Donkie/Spoolman)
filament manager. Moonraker will automatically send filament usage updates to
the Spoolman database.
Front ends can also utilize this config to provide a built-in management tool.
```ini
# moonraker.conf
[spoolman]
server: http://192.168.0.123:7912
# URL to the Spoolman instance. This parameter must be provided.
```
## Include directives
It is possible to include configuration from other files via include

View File

@ -5211,6 +5211,127 @@ An object containing all measurements for every configured sensor:
}
```
### Spoolman APIs
The following APIs are available to interact with the Spoolman integration:
#### Set active spool
Set the ID of the spool that Moonraker should report usage to Spoolman of.
HTTP request:
```http
POST /spoolman/spool_id
Content-Type: application/json
{
"spool_id": 1
}
```
JSON-RPC request:
```json
{
"jsonrpc": "2.0",
"method": "spoolman.post_spool_id",
"params": {
"spool_id": 1
},
"id": 4654
}
```
Returns:
The id of the now active spool:
```json
{
"spool_id": 1
}
```
!!! note
Send an empty object, `{}`, to un-set the spool ID and stop any reporting.
The response `spool_id` will then be set to *null*
#### Get active spool
Retrieve the ID of the spool to which Moonraker reports usage for Spoolman.
HTTP request:
```http
GET /spoolman/spool_id
```
JSON-RPC request:
```json
{
"jsonrpc": "2.0",
"method": "spoolman.get_spool_id",
"id": 4654
}
```
Returns:
The id of the active spool:
```json
{
"spool_id": 1
}
```
!!! note
The `spool_id` can be *null* if there is no active spool.
#### Proxy
Moonraker supplies a proxy endpoint where you have full access to the Spoolman
API without having to configure the endpoint yourself.
See Spoolman's [OpenAPI Description](https://donkie.github.io/Spoolman/) for
detailed information about it's API.
HTTP request:
```http
POST /spoolman/proxy
Content-Type: application/json
{
"request_method": "POST",
"path": "/v1/spool",
"query": "a=1&b=4",
"body": {
"filament_id": 1
}
}
```
JSON-RPC request:
```json
{
"jsonrpc": "2.0",
"method": "spoolman.post_proxy",
"params": {
"request_method": "POST",
"path": "/v1/spool",
"query": "a=1&b=4",
"body": {
"filament_id": 1
}
},
"id": 4654
}
```
The following parameters are available. `request_method` and `path` are required, the rest are optional.
- `request_method`: The HTTP request method, e.g. `GET`, `POST`, `DELETE`, etc.
- `path`: The endpoint, including API version, e.g. `/v1/filament`.
- `query`: The query part of the URL, e.g. `filament_material=PLA&vendor_name=Prima`.
- `body`: The request body for the request.
Returns:
The json response from the Spoolman server.
### OctoPrint API emulation
Partial support of OctoPrint API is implemented with the purpose of
allowing uploading of sliced prints to a moonraker instance.
@ -6623,6 +6744,25 @@ webcam is added, removed, or updated.
The `webcams` field contans an array of objects like those returned by the
[list webcams](#list-webcams) API.
#### Spoolman active spool ID changed
Moonraker will emit the `notify_active_spool_set` event when the active spool
ID for the Spoolman integration has been changed.
See the [Spoolman API](#spoolman-apis) for more information.
```json
{
"jsonrpc": "2.0",
"method": "notify_active_spool_set",
"params": [
{
"spool_id": 1
}
]
}
```
#### Agent Events
Moonraker will emit the `notify_agent_event` notification when it
an agent event is received.