Skip to content

Commit

Permalink
docs: Added section for spoolman
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Hultgren <[email protected]>
  • Loading branch information
Donkie authored and Arksine committed Jun 26, 2023
1 parent 4b9c836 commit e6b3b8b
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
140 changes: 140 additions & 0 deletions docs/web_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit e6b3b8b

Please sign in to comment.