Skip to content

Commit

Permalink
Octoprint service (#324) (#560)
Browse files Browse the repository at this point in the history
Add Octoprint service.
  • Loading branch information
bastienwirtz authored Nov 27, 2022
1 parent 98fe0a3 commit 70f583c
Show file tree
Hide file tree
Showing 17 changed files with 596 additions and 18 deletions.
32 changes: 23 additions & 9 deletions docs/customservices.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ within Homer:
- [Speedtest Tracker](#SpeedtestTracker)
- [What's Up Docker](#whats-up-docker)
- [SABnzbd](#sabnzbd)
- [OctoPrint](#sabnzbd)

If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page.

Expand Down Expand Up @@ -84,7 +85,7 @@ Two lines are needed in the config.yml :

```yaml
type: "Medusa"
apikey: "01234deb70424befb1f4ef6a23456789"
apikey: "<---insert-api-key-here--->"
```

The url must be the root url of Medusa application.
Expand All @@ -97,7 +98,7 @@ Two lines are needed in the config.yml :

```yaml
type: "Lidarr", "Prowlarr", "Radarr" or "Sonarr"
apikey: "01234deb70424befb1f4ef6a23456789"
apikey: "<---insert-api-key-here--->"
```

The url must be the root url of Lidarr, Prowlarr, Radarr or Sonarr application.
Expand All @@ -108,7 +109,7 @@ If you are using an older version of Radarr or Sonarr which don't support the ne
- name: "Radarr"
type: "Radarr"
url: "http://localhost:7878/"
apikey: "MY-SUPER-SECRET-API-KEY"
apikey: "<---insert-api-key-here--->"
target: "_blank"
legacyApi: true
```
Expand All @@ -119,7 +120,7 @@ This service displays total number of documents stored. Two lines are required:

```yaml
type: "PaperlessNG"
apikey: "0123456789abcdef123456789abcdef"
apikey: "<---insert-api-key-here--->"
```

API key can be generated in Settings > Administration > Auth Tokens
Expand Down Expand Up @@ -175,7 +176,7 @@ See https://docs.portainer.io/v/ce-2.11/user/account-settings#access-tokens
logo: "assets/tools/sample.png"
url: "http://192.168.0.151/"
type: "Portainer"
apikey: "MY-SUPER-SECRET-API-KEY"
apikey: "<---insert-api-key-here--->"
# environments:
# - "raspberry"
# - "local"
Expand All @@ -190,7 +191,7 @@ You need to set the type to Emby, provide an api key and choose which stats to s
logo: "assets/tools/sample.png"
url: "http://192.168.0.151/"
type: "Emby"
apikey: "MY-SUPER-SECRET-API-KEY"
apikey: "<---insert-api-key-here--->"
libraryType: "music" #Choose which stats to show. Can be one of: music, series or movies.
```

Expand Down Expand Up @@ -220,7 +221,7 @@ the "Web Interface" section of settings on the Tautulli web UI.
logo: "assets/tools/sample.png"
url: "http://192.168.0.151:8181"
type: "Tautulli"
apikey: "MY-SUPER-SECRET-API-KEY"
apikey: "<---insert-api-key-here--->"
```

Because the service type and link don't necessarily have to match, you could
Expand All @@ -233,7 +234,7 @@ endpoint pointing to Tautulli!
url: "http://192.168.0.151:32400/web" # Plex
endpoint: "http://192.168.0.151:8181" # Tautulli
type: "Tautulli"
apikey: "MY-SUPER-SECRET-API-KEY"
apikey: "<---insert-api-key-here--->"
```

## Mealie
Expand All @@ -248,7 +249,7 @@ Two lines are needed in the config.yml :

```yaml
type: "Healthchecks"
apikey: "01234deb70424befb1f4ef6a23456789"
apikey: "<---insert-api-key-here--->"
```

The url must be the root url of the Healthchecks application.
Expand Down Expand Up @@ -377,3 +378,16 @@ the "Config" > "General" section of the SABnzbd config in the SABnzbd web UI.
apikey: "MY-SUPER-SECRET-API-KEY"
downloadInterval: 5000 # (Optional) Interval (in ms) for updating the download count
```

## OctoPrint

The OctoPrint service only needs an `apikey` & `url` and optionally a `display` option.

```yaml
- name: "Octoprint"
logo: "https://cdn-icons-png.flaticon.com/512/3112/3112529.png"
apikey: "xxxxxxxxxxxx" # insert your own API key here. Request one from https://openweathermap.org/api.
url: "http://192.168.0.151:8080"
display: "text" # 'text' or 'bar'. Default to `text`.
type: "OctoPrint"
```
6 changes: 6 additions & 0 deletions dummy-data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
This directory content makes possible to test custom services cards or create a demo without actually running the service.
The principle is simple: save a sample output of the API used in the service in a static file in this directory. The path must be identical as the service endpoint to be used seamlessly.

## Start the mock server to expose dummy data

```sh
yarn mock
```

## How to add a new services sample

- create a directory for your service, and any sub-folder existing in the service api path.
Expand Down
30 changes: 30 additions & 0 deletions dummy-data/octoprint/api/job
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"job": {
"averagePrintTime": 669.3131185749999,
"estimatedPrintTime": 314.87566979223726,
"filament": {
"tool0": {
"length": 134.81171000000032,
"volume": 0.0
}
},
"file": {
"date": 1665547748,
"display": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"name": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"origin": "local",
"path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode",
"size": 129581
},
"lastPrintTime": 669.3131185749999,
"user": "friendlyngeeks"
},
"progress": {
"completion": 27.456185706237797,
"filepos": 35578,
"printTime": 460,
"printTimeLeft": 4612,
"printTimeLeftOrigin": "linear"
},
"state": "Printing"
}
26 changes: 26 additions & 0 deletions dummy-data/octoprint/api/status_printer_offline-error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"error": "SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)",
"job": {
"averagePrintTime": null,
"estimatedPrintTime": null,
"filament": null,
"file": {
"date": null,
"display": null,
"name": null,
"origin": null,
"path": null,
"size": null
},
"lastPrintTime": null,
"user": null
},
"progress": {
"completion": null,
"filepos": null,
"printTime": null,
"printTimeLeft": null,
"printTimeLeftOrigin": null
},
"state": "Offline after error"
}
26 changes: 26 additions & 0 deletions dummy-data/octoprint/api/status_printer_offline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"job": {
"estimatedPrintTime": null,
"filament": {
"length": null,
"volume": null
},
"file": {
"date": null,
"name": null,
"origin": null,
"path": null,
"size": null
},
"lastPrintTime": null,
"user": null
},
"progress": {
"completion": null,
"filepos": null,
"printTime": null,
"printTimeLeft": null,
"printTimeOrigin": null
},
"state": "Offline"
}
26 changes: 26 additions & 0 deletions dummy-data/octoprint/api/status_printer_operational.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"job": {
"estimatedPrintTime": null,
"filament": {
"length": null,
"volume": null
},
"file": {
"date": null,
"name": null,
"origin": null,
"path": null,
"size": null
},
"lastPrintTime": null,
"user": null
},
"progress": {
"completion": null,
"filepos": null,
"printTime": null,
"printTimeLeft": null,
"printTimeOrigin": null
},
"state": "Operational"
}
30 changes: 30 additions & 0 deletions dummy-data/octoprint/api/status_printer_printing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"job": {
"averagePrintTime": 669.3131185749999,
"estimatedPrintTime": 314.87566979223726,
"filament": {
"tool0": {
"length": 134.81171000000032,
"volume": 0.0
}
},
"file": {
"date": 1665547748,
"display": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"name": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"origin": "local",
"path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode",
"size": 129581
},
"lastPrintTime": 669.3131185749999,
"user": "friendlyngeeks"
},
"progress": {
"completion": 0.1551153332664511,
"filepos": 201,
"printTime": 0,
"printTimeLeft": 668,
"printTimeLeftOrigin": "average"
},
"state": "Printing"
}
30 changes: 30 additions & 0 deletions dummy-data/octoprint/api/status_printer_printing_1of2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"job": {
"averagePrintTime": 669.3131185749999,
"estimatedPrintTime": 314.87566979223726,
"filament": {
"tool0": {
"length": 134.81171000000032,
"volume": 0.0
}
},
"file": {
"date": 1665547748,
"display": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"name": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"origin": "local",
"path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode",
"size": 129581
},
"lastPrintTime": 669.3131185749999,
"user": "friendlyngeeks"
},
"progress": {
"completion": 0.1551153332664511,
"filepos": 201,
"printTime": 0,
"printTimeLeft": 668,
"printTimeLeftOrigin": "average"
},
"state": "Printing"
}
30 changes: 30 additions & 0 deletions dummy-data/octoprint/api/status_printer_printing_2of2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"job": {
"averagePrintTime": 669.3131185749999,
"estimatedPrintTime": 314.87566979223726,
"filament": {
"tool0": {
"length": 134.81171000000032,
"volume": 0.0
}
},
"file": {
"date": 1665547748,
"display": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"name": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"origin": "local",
"path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode",
"size": 129581
},
"lastPrintTime": 669.3131185749999,
"user": "friendlyngeeks"
},
"progress": {
"completion": 27.456185706237797,
"filepos": 35578,
"printTime": 476,
"printTimeLeft": 1612,
"printTimeLeftOrigin": "linear"
},
"state": "Printing"
}
30 changes: 30 additions & 0 deletions dummy-data/octoprint/api/status_printing_completion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"job": {
"averagePrintTime": 698.814525153,
"estimatedPrintTime": 314.87566979223726,
"filament": {
"tool0": {
"length": 134.81171000000032,
"volume": 0.0
}
},
"file": {
"date": 1665547748,
"display": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"name": "CE3PRO_3mmX3mm Brass insert V2.gcode",
"origin": "local",
"path": "MISC/CE3PRO_3mmX3mm Brass insert V2.gcode",
"size": 129581
},
"lastPrintTime": 728.315931731,
"user": "friendlyngeeks"
},
"progress": {
"completion": 100.0,
"filepos": 129581,
"printTime": 728,
"printTimeLeft": 0,
"printTimeLeftOrigin": null
},
"state": "Operational"
}
7 changes: 7 additions & 0 deletions dummy-data/speedtesttracker/api/speedtest/latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"data": {
"download": 42.452234,
"upload": 34.3948,
"ping": 12.9873
}
}
Loading

0 comments on commit 70f583c

Please sign in to comment.